Turn any OpenAPI/Swagger or REST API into an MCP server for Claude, ChatGPT and Copilot. Powered by AnythingMCP.
OpenAPI to MCP turns any REST API with an OpenAPI or Swagger spec into MCP tools that Claude, ChatGPT, Copilot and Cursor can call, without code. Import the spec and every operation becomes a tool with its parameters and auth. This repository runs the whole chain locally against a demo orders API.
Last verified: 2026-09-26 against the bundled demo orders API (OpenAPI 3.0.3, API-key auth) (docker compose up + scripts/smoke.mjs: spec import, tools/list, GET with query and path parameters, POST with a JSON body).
Adapter synced: 2026-09-27
Maintained by helpcode.ai, the team that builds and maintains AnythingMCP.
Needs Docker 24+, openssl and Node 18+.
git clone https://github.com/HelpCode-ai/openapi-to-mcp.git
cd openapi-to-mcp
./scripts/install.sh
npm install && node scripts/smoke.mjsinstall.sh starts AnythingMCP and a small REST API (examples/api-demo: customers and sales orders, protected by an API key), creates a REST connector with that key, imports openapi.json and creates an MCP API key. smoke.mjs lists the tools and asks for the open orders.
| OpenAPI operation | MCP tool | Changes data |
|---|---|---|
GET /customers (listCustomers) |
listcustomers |
no |
GET /customers/{id} (getCustomer) |
getcustomer |
no |
GET /orders (listOrders) |
listorders |
no |
GET /orders/{orderNumber} (getOrder) |
getorder |
no |
POST /orders/{orderNumber}/notes (addOrderNote) |
addordernote |
yes |
Tool names are the operationId in lower case (or <method>_<path> without one); descriptions come from summary and description. The API key lives in the connector and never reaches the model.
- In the AnythingMCP UI, Connectors → New connector → REST: base URL and auth (API key, bearer, Basic, OAuth 2.0, HMAC…).
- Import → OpenAPI with the spec URL, a Swagger UI page URL, or the spec pasted as JSON or YAML. OpenAPI 3.0, 3.1 and Swagger 2.0 work.
- Rename tools with cryptic
operationIds and rewrite descriptions in the words your users ask with. - Assign the connector to an MCP server whose role whitelists the operations the AI may call.
Through the API:
curl -s http://localhost:4000/api/connectors/$ID/import -H "Authorization: Bearer $TOKEN" -H "content-type: application/json" \
-d '{"source":"openapi","url":"https://api.example.com/openapi.json"}'Re-importing updates changed operations, adds new ones and disables the ones that disappeared. Roles, response mappings and tools you disabled survive; names and descriptions are refreshed from the spec, so put wording you want to keep into the spec itself.
-
Claude (claude.ai, Desktop, mobile): Customize → Connectors → Add custom connector, paste your MCP server URL and sign in. Claude connects from Anthropic's cloud, so the URL must be public HTTPS: your AnythingMCP Cloud URL, or your own instance behind TLS.
-
Claude Code:
claude mcp add --transport http openapi-to-mcp http://localhost:4000/mcp --header "X-API-Key: <MCP_API_KEY>" -
Cursor (
.cursor/mcp.json) and VS Code / GitHub Copilot (.vscode/mcp.json, keyserversinstead ofmcpServers, plus"type": "http"):{ "mcpServers": { "openapi-to-mcp": { "url": "http://localhost:4000/mcp", "headers": { "X-API-Key": "<MCP_API_KEY>" } } } } -
ChatGPT: add the public HTTPS URL as a connector (app) in ChatGPT's settings. A
localhostURL does not work there.
- Which sales orders are still open, and when did we promise them?
- Show customer 2 and all of their orders.
- Which customers are in Switzerland?
- What is the total value of the open orders?
- Add a note to order SO-24044: "Customer asked for delivery before 10 am." (a write tool)
- Which tickets were opened today in our helpdesk API?
More in examples/prompts.md.
- Credentials stay in the connector, encrypted with AES-256-GCM; the model never sees them.
- Roles decide which operations each MCP server exposes. Start with the GET operations.
- Response mapping trims large or sensitive responses per tool before they reach the model.
- Audit log: every call with input, output, duration and status.
Create a REST connector in AnythingMCP, import the spec (URL, Swagger UI page or pasted JSON/YAML), and add the MCP server URL to your AI client. Each operation becomes a tool; no code.
OpenAPI 3.0, OpenAPI 3.1 and Swagger 2.0.
Import a Postman collection or cURL commands instead, or define the tools by hand in the visual editor.
Into the connector, encrypted with AES-256-GCM. They are added to each request by AnythingMCP; the model never sees them.
Yes. Give the MCP server a role that whitelists only the GET operations; the others are invisible to that client.
Re-import the spec. Changed operations are updated, new ones added, and removed ones disabled instead of failing at call time.
| Problem | Fix |
|---|---|
| The import finds no operations | Point it at the JSON/YAML spec, or at the Swagger UI page: AnythingMCP looks for the spec behind it. |
| Tool names are unreadable | The spec has no operationIds. Add them to the spec, or rename the tools in the editor. |
401 from the API |
The connector auth is missing or wrong. Check header name and key on the connector. |
| "SSRF" or "blocked host" error | The API is on a private network. Add its hostname to SSRF_ALLOWED_HOSTS on a self-hosted instance. |
- odata-to-mcp: OData to MCP: turn any OData V2 or V4 service, SAP Gateway included, into MCP tools for Claude & ChatGPT. Reads $metadata, no code.
- soap-to-mcp: Turn any SOAP/WSDL web service into MCP tools for Claude & ChatGPT. Legacy SOAP APIs as AI tools, no code, self-hosted.
- AnythingMCP: the open-source MCP server and gateway this repository is built on.
AGPL-3.0-only. The adapter definition in adapter/ comes from AnythingMCP (AGPL-3.0).