工具发现
从任何文档URL中提取API工具/端点。将其指向API文档页面,并获取带有参数、类型和身份验证信息的结构化工具定义。
支持
- OpenAPI/Swagger规格 --自动检测,直接解析(无需人工智能)
- MCP端点 --标准
tools/list协议 - HTML文档页面 --AI驱动的提取(需要OpenAI密钥)
安装
npm install
cp .env.example .env
# Add your OPENAI_API_KEY to .env用法
# OpenAPI spec (auto-detected)
node discover.mjs https://petstore3.swagger.io/api/v3/openapi.json
# HTML docs - single page
node discover.mjs https://resend.com/docs/api-reference/emails/send-email
# HTML docs - crawl entire docs site
node discover.mjs https://resend.com/docs/api-reference/emails/send-email --crawl
# Save output
node discover.mjs --output tools.json
# Control crawl depth
node discover.mjs --crawl --max-pages 30运作原理
- 检测格式 --按照OpenAPI规范尝试URL,探测已知的规范路径,检查HTML中的嵌入式规范,尝试MCP
- 如果OpenAPI/Swagger --直接解析规范。获取具有完整参数架构、身份验证信息和响应类型的每个端点
- 如果MCP --电话
tools/list用于结构化工具定义 - 如果HTML文档 --智能爬虫:
- 检测文档框架(Mintlify、ReadMe、GitBook、Docusaurus、Redoc等) - 检查sitemap.xml以查找URL - 提取带有优先级评分的侧边栏/导航链接 - 检测SPA shell并使用Jina Reader进行JS渲染 - 在提取之前为类似API的内容筛选页面 - AI从页面内容中提取端点定义 - 消除重复结果
输出格式
{
"url": "https://api.example.com/openapi.json",
"sourceType": "openapi",
"discoveredAt": "2026-02-24T03:15:19.343Z",
"toolCount": 19,
"tools": [
{
"name": "send_email",
"method": "POST",
"path": "/v1/emails",
"description": "Send an email to a recipient",
"params": [
{ "name": "to", "type": "string", "required": true, "description": "Recipient email" },
{ "name": "subject", "type": "string", "required": true, "description": "Email subject" },
{ "name": "body", "type": "string", "required": true, "description": "Email body" }
],
"auth": { "type": "bearer", "header": "Authorization" },
"sourceUrl": "https://api.example.com/v1/emails",
"sourceType": "openapi"
}
]
}已测试
- Swagger宠物店 --已提取19个端点
- GitHub REST API --已提取1080个端点
- 重新发送文档 (Mintlify)-检测到框架,抓取页面,准备进行AI提取
