mcpify
mcpify
将任何 API 转换为 MCP 服务器。一条命令。无需代码。
npx mcpify https://petstore3.swagger.io/api/v3/openapi.json✓ mcpify: Petstore v1.0.0 — 19 tools
base: https://petstore3.swagger.io/api/v3
transport: stdio就是这样。你的 AI 智能体现在可以访问整个 Petstore API 了。无需安装 SDK,无需编写胶水代码,无需部署服务器。
指向任何 OpenAPI 规范 → 获得一个功能完备的 MCP 服务器。
为什么选择它
每个构建智能体的团队都会遇到同样的障碍:模型需要调用 API,而连接每一个 API 都意味着数天的定制 MCP 服务器代码、模式转换和身份验证管道工作。
mcpify 将这一切简化为一条命令。OpenAPI 规范已经描述了一切——端点、参数、模式、身份验证。我们在运行时将其转换为 MCP 服务器,无需代码生成步骤,也无需维护源代码文件。
Related MCP server: mcpify
安装
按需使用 npx(推荐):
npx mcpify <spec>或者全局安装:
npm install -g mcpify需要 Node.js 18+。
使用
从托管规范使用
npx mcpify https://api.example.com/openapi.json从本地文件使用(JSON 或 YAML)
npx mcpify ./spec.yaml从单个 curl 命令使用
npx mcpify --curl "curl -H 'Authorization: Bearer xxx' https://api.github.com/user/repos"从任何 curl 命令生成单工具 MCP 服务器。请求体会被解析并转换为输入模式。
列出工具而不启动服务
npx mcpify list ./spec.json生成一个独立、可手动编辑的项目
npx mcpify generate ./spec.json ./my-mcp
cd my-mcp && npm install && npm start当你想要修改行为时使用此功能——添加缓存、自定义身份验证流程、后处理等任何内容。
身份验证
在启动前设置环境变量。mcpify 会读取规范中的 securitySchemes 并自动匹配它们。
# HTTP bearer schemes
export MCPIFY_BEARER_TOKEN=xxx
# apiKey schemes (header or query, as the spec says)
export MCPIFY_API_KEY=xxx
# HTTP basic
export MCPIFY_BASIC_AUTH=user:password
# Per-scheme override (use the scheme's name from the spec)
export MCPIFY_AUTH_<SCHEME_NAME>=xxx
# Free-form extra headers on every request
export MCPIFY_HEADERS='{"X-Trace-Id":"abc","X-Internal":"1"}'过滤大型规范
Stripe 的完整 OpenAPI 包含约 600 个端点。大多数智能体不需要全部这些端点,且大多数客户端也无法处理这么多工具。进行裁剪:
# Only the customers tag
npx mcpify ./stripe.json --tag customers
# Only operations whose tool name matches a regex
npx mcpify ./stripe.json --filter "^createCustomer|^getCustomer"
# Hard cap
npx mcpify ./stripe.json --max-tools 30与 Claude Desktop 一起使用
~/.config/claude/claude_desktop_config.json (Linux/macOS) 或 %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"petstore": {
"command": "npx",
"args": ["-y", "mcpify", "https://petstore3.swagger.io/api/v3/openapi.json"]
},
"github": {
"command": "npx",
"args": ["-y", "mcpify", "--curl",
"curl -H 'Authorization: Bearer ghp_xxx' https://api.github.com/user/repos"]
}
}
}与 Cursor / Cline / Claude Code 一起使用
同样的思路——只要你能通过 command 和 args 配置 MCP 服务器的地方,它都能工作。mcpify 使用 stdio 进行通信。
# Claude Code:
claude mcp add petstore -- npx -y mcpify https://petstore3.swagger.io/api/v3/openapi.json编程 API
import { loadOpenApiSpec, parseOpenApi, serve } from "mcpify";
const raw = await loadOpenApiSpec("./spec.yaml");
const spec = parseOpenApi(raw);
await serve(spec, {
baseUrl: "https://staging.example.com",
filterTag: "users",
});工作原理
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ OpenAPI spec │ ─→ │ mcpify runtime │ ─→ │ MCP client │
│ (JSON / YAML) │ │ (stdio server) │ │ (Claude/Cursor) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
↓ tool call
┌─────────┐
│ fetch │ → your API
└─────────┘解引用规范(解析
$ref)。将每个操作转换为 MCP 工具:路径/查询/头部参数变为输入属性;请求体变为嵌套的
body属性。在工具调用时,构建 URL,附加来自环境变量的身份验证信息,发送请求,并返回响应。
无需代码生成。无需重启循环。规范就是事实来源。
局限性
流式响应体 — 目前已缓冲,上限为 64KB。
OAuth2 流程 — 不会自动运行;请通过
MCPIFY_BEARER_TOKEN提供预先获取的令牌。文件上传 (
multipart/form-data) — 尚不支持。Webhooks / 回调 — 超出范围。
Swagger 2.0 — 部分支持;为获得最佳效果,请先转换为 OpenAPI 3。
欢迎提交 PR 改进上述内容。
开发
git clone https://github.com/qualuo/mcpify
cd mcpify
npm install
npm run build
npm test许可证
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Discover and call 10,000+ production APIs from one MCP server. Pay-per-call billing for AI agents.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAutomatically converts Swagger/OpenAPI specifications into MCP servers, enabling AI agents to interact with any REST API through natural language by exposing endpoints as AI-friendly tools.3-
- AlicenseNot gradedqualityCmaintenanceConverts any OpenAPI specification into an MCP server, allowing AI assistants to interact with REST APIs through natural language.9 npm1MIT
- AlicenseNot gradedqualityDmaintenanceTurns any OpenAPI REST or GraphQL API into an MCP server, allowing AI assistants like Claude to interact with APIs without writing code.8 npmMIT
- AlicenseNot gradedqualityDmaintenanceConverts an OpenAPI spec into an MCP server, enabling AI agents to call your API without writing tool definitions or integration code.3MIT