mcp公共api
让你的AI编码代理能够立即查找、测试和集成1500多个免费公共API中的任何一个。
     
来自社区的数据得到维护 公共api 列表·每日同步
______________________________________________________________________
这是什么?
一 MCP(模型上下文协议) 服务器,使AI编码代理能够实时访问公共api数据集。代理可以在一次对话中搜索、探测和生成工作代码,而不是复制API文档。
You: "Find me a free weather API with no auth that supports HTTPS"
Agent: [calls search_apis] → returns top matches with auth/HTTPS/CORS details
You: "Test the first one — show me what the response looks like"
Agent: [calls probe_api] → live GET request, returns status + response shape
You: "Generate an axios snippet for it"
Agent: [calls generate_snippet] → ready-to-paste curl, fetch, and axios code______________________________________________________________________
安装
为您的客户端选择配置并粘贴。不需要构建步骤-- npx 处理一切。
Claude Desktop
文件: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)\ 文件: %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"public-apis": {
"command": "npx",
"args": ["mcp-public-apis"]
}
}
}Cursor
文件: .cursor/mcp.json 在项目根目录中(或 ~/.cursor/mcp.json 全球)
{
"mcpServers": {
"public-apis": {
"command": "npx",
"args": ["mcp-public-apis"]
}
}
}Windsurf
文件: ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"public-apis": {
"command": "npx",
"args": ["mcp-public-apis"]
}
}
}Cline (VS Code)
打开VS代码→ Cline侧边栏→ MCP服务器 tab → 添加服务器 → 粘贴:
{
"public-apis": {
"command": "npx",
"args": ["mcp-public-apis"]
}
}Local build
git clone https://github.com/josephsenior/pblic-apis-mcp-server
cd pblic-apis-mcp-server
npm install
npm run build
node dist/index.js______________________________________________________________________
工具
| 工具 | 功能 | 关键参数 |
|---|---|---|
search_apis | 按关键字、类别、身份验证类型和HTTPS进行模糊搜索1500多个API | query, category, auth, httpsOnly, limit |
get_categories | 列出每个类别及其API计数 | - |
get_api_detail | 一个API的完整记录(按名称) | name |
probe_api | 实时HTTP GET到任何端点——返回状态、延迟和响应预览 | url, apiKey, timeoutMs |
compare_apis | 一个类别中所有API的并排视图 | category, limit |
find_no_auth_apis | 只有需要零身份验证的API | category, httpsOnly, limit |
generate_snippet | 粘贴就绪 curl, fetch,以及 axios 片段 | url, apiKey, headers |
search_apis 参数
| 参数 | 类型 | 默认值 | 说明 | ||
|---|---|---|---|---|---|
query | string | - | 针对API名称和描述的模糊匹配 | ||
category | string | -- | 准确的类别名称(使用 get_categories 浏览) | ||
auth | "No" | "apiKey" | "OAuth" | -- | 按身份验证要求筛选 |
httpsOnly | 布尔值 | true | 排除非HTTPS API | ||
limit | 编号 | 5 | 最大结果(1–20) |
______________________________________________________________________
运作原理
MCP Client (Claude / Cursor / etc.)
│ JSON-RPC over stdio
▼
mcp-public-apis server
│
├─ In-memory cache (24 h TTL)
│
└─ GitHub raw · public-apis/public-apis README.md- 首次使用时,服务器从GitHub获取公共api README,将每个Markdown表行解析为结构化
PublicAPI对象,并将其存储在24小时内存缓存中。 - 所有搜索和筛选操作都在本地针对该缓存运行,每个查询都没有外部调用。
probe_api是向第三方端点(您显式传递的端点)发出请求的唯一工具。
______________________________________________________________________
数据源
所有API记录来自 公共api/公共api --一个由社区维护的列表,包含60多个类别的1500多个免费API。数据每24小时更新一次。
______________________________________________________________________
