GM

g12789/mcp-quickstart

API 开发

本页由 AI 翻译,技术细节请以原文为准。 查看原文

80 stars 1 forks 质量 67 趋势 4MIT

g12789/mcp-quickstart 是从 https://github.com/g12789/mcp-quickstart. 导入的 MCP 服务器候选服务器。

概览

g12789/mcp-quickstart 是从 https://github.com/g12789/mcp-quickstart. 导入的 MCP 服务器候选服务器。

概述(AI 翻译)

⭐ 推荐: npx ship-skills init(已登录 gh 会自动支持作者)

在30秒内打造一个可运行、可测试、可发布的MCP服务器。 一个命令。TypeScript 或 Python。示例工具、Inspector和测试——全部连接好。 或者指向一个OpenAPI规范,自动为每个API端点获取一个MCP工具。**

大多数“创建MCP服务器”的指南都会给你一个空的骨架和20步设置。mcp-quickstart给你一个服务器,第一次尝试就能运行、测试并连接Claude / Cursor——然后让开你的路。


将任何 REST API 转换为 MCP 服务器

大多数支架工会给你一个空模板,然后说“现在去写你的工具吧”。mcp-quickstart 可以读取现有API,帮你写工具——用OpenAPI规范或者一个curl命令:

指向任意 OpenAPI 3.x 文档(URL 或本地 .json / .yaml),它生成一个真实的类型化 MCP 服务器——每个操作一个工具,路径/查询参数和请求体连接到一个小型 HTTP 客户端。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

mcp-quickstart

⭐ 推荐: npx ship-skills init(已登录 gh 会自动支持作者)

Forge a working, testable, publishable MCP server in 30 seconds. One command. TypeScript or Python. Example tools, the Inspector, and tests — all wired up. Or point it at an OpenAPI spec and get one MCP tool per API endpoint, automatically.

npm create mcp-quickstart@latest my-server

Most “create an MCP server” guides leave you with an empty skeleton and a 20-step setup. mcp-quickstart hands you a server that runs, tests, and connects to Claude / Cursor on the first try — then gets out of your way.


Turn any REST API into an MCP server

Most scaffolders hand you an empty template and say “now go write your tools.” mcp-quickstart can instead read an existing API and write the tools for you — from an OpenAPI spec or a single curl command:

# whole API, from an OpenAPI spec:
npx mcp-quickstart petstore-mcp --from-openapi https://petstore3.swagger.io/api/v3/openapi.json

# one endpoint, straight from a curl you already have:
npx mcp-quickstart my-tool --from-curl "curl https://api.example.com/v1/search?q=hi -H 'Authorization: Bearer X'"

Point it at any OpenAPI 3.x document (a URL or a local .json / .yaml) and it generates a real, typed MCP server — one tool per operation, with path/query params and request bodies wired up to a small HTTP client. Request bodies are expanded into per-field zod types ($ref, nested objects, arrays and enums resolved), not an opaque blob — so the AI gets a real schema for each tool. Set API_BASE_URL (and an optional auth header) in .env, run npm run dev, and your AI agent can call the API immediately.

--from-curl does the same for a single request: paste a curl command (or a file with one) and get one MCP tool. Query params and the JSON body become overridable tool inputs, and auth headers are moved to .env instead of being hard-coded into the generated source.

my-api-mcp/
├── src/
│   ├── index.ts   # one registerTool(...) per API operation — plain, editable TS
│   └── http.ts    # generic caller: URL building, auth header, body
└── .env.example   # API_BASE_URL, API_AUTH_HEADER, API_AUTH_VALUE

No magic, no runtime spec parsing — just generated TypeScript you own and can edit.


在 GitHub 查看完整 README

安装

npx mcp-quickstart petstore-mcp --from-openapi https://petstore3.swagger.io/api/v3/openapi.json
新手?先看 mcpskill.org 教程 →