OpenAPI to MCP Converter
Paste an OpenAPI 3.0/3.1 or Swagger 2.0 document in JSON or YAML and get one MCP tool per API operation: a name from the operationId, a description from the summary, and an inputSchema built from path, query and header parameters and the request body.
Pick the operations an agent may call, then download a TypeScript or Python MCP server that sends real HTTP requests to your API, with a ready config for Claude Desktop and Cursor. Nothing is uploaded.
Convert OpenAPI to MCP
How OpenAPI maps to MCP
| OpenAPI | MCP tool | Notes |
|---|---|---|
operationId | name | Converted to snake_case, max 64 characters, unique. Without an operationId the name comes from method and path, for example get_books_by_book_id. |
summary + description | description, title | The model reads the description to decide when to call the tool. The method and path are appended. |
| path, query, header parameters | top-level inputSchema properties | Path parameters are always required. Authorization, Content-Type and cookie parameters are left out. |
requestBody / Swagger in: body | body property | JSON bodies are sent as JSON; formData and URL-encoded bodies as form fields. readOnly fields are removed. |
$ref, nullable, allOf/oneOf | plain JSON Schema | Local references are inlined; nullable: true becomes ["type", "null"]. |
| HTTP method | annotations | GET is readOnlyHint, DELETE is destructiveHint, PUT and DELETE are idempotentHint; all are openWorldHint. |
servers / host + basePath | API_BASE_URL default | Override it in the host config, for example to point at staging. |
securitySchemes | env variables | API key (API_KEY), bearer or OAuth2 token (API_TOKEN), or Basic (API_USERNAME, API_PASSWORD). |
What the ZIP contains
- TypeScript:
src/index.tson@modelcontextprotocol/sdk, using Node's built-infetch;package.json,tsconfig.json. - Python:
server.pyon themcppackage (2.x low-level server), using the standard library for HTTP, somcpis the only dependency;requirements.txt,pyproject.toml. tools.jsonwith the exacttools/listresult,.env.example, and a README with run, MCP Inspector and host config steps.
Each tool call returns the HTTP status line and the response body (cut at 100,000 characters). A 4xx or 5xx response comes back with isError: true so the model sees the failure. Missing required arguments are rejected before any request is sent.
Tested with real specs and real APIs
On 2026-10-19 we converted five public specs: the Swagger Petstore in Swagger 2.0 JSON and OpenAPI 3.0 JSON, the OpenAPI Initiative's petstore-expanded YAML, the XKCD YAML from APIs.guru, and GitHub's REST API description (13.5 MB, 1,242 operations, converted in under half a second in Node). Every tool name matched ^[A-Za-z0-9_]{1,64}$, which fits the Claude API's 64-character tool-name limit, and every property name matched ^[A-Za-z0-9_.-]{1,64}$.
We then ran the generated servers with an MCP client: TypeScript on @modelcontextprotocol/sdk 1.32.1 (Node 20, tsc --strict clean) and Python on mcp 2.3.0 (Python 3.13). Against a local mock API both languages sent identical requests for path, query, array, header API key, JSON body and form body cases. Against live APIs, GitHub tools such as repos_get and search_repos returned HTTP 200 with real data, and Petstore's find_pets_by_status returned live pets. Petstore's inventory endpoint returned HTTP 500, which a plain curl to the same URL also returned; the server passed it through as an error result, as intended.
When to convert, and when to write tools by hand
Converting is the fastest way to let Claude or Cursor call an API that already has a spec. It works best when operations have clear summaries and you expose a few of them. A generated tool mirrors the endpoint, so an agent that needs several calls for one task may do better with a hand-written tool that wraps them; the FastMCP documentation makes the same point about auto-converted servers.
Other ways to convert: FastMCP.from_openapi() in Python builds tools at runtime, the open-source openapi-mcp-generator CLI writes a TypeScript project, and Speakeasy, Stainless and Postman offer hosted or SDK-based generators. This page is for a quick, free, inspectable project you own, without installing anything. No spec at all? Use the form-based MCP Server Generator, and see MCP Server Generator vs OpenAPI generators for the trade-offs.
Next: connect and test it
Run the server with MCP Inspector, then add it to your host. The config generator writes the right file for Claude Desktop, Cursor, VS Code, Claude Code and Windsurf.
FAQ
How do I convert an OpenAPI spec to an MCP server?
Paste the spec (or upload it, or fetch it by URL), click Convert, untick the operations the agent should not call, pick TypeScript or Python and download the ZIP. Install the dependencies, set API_BASE_URL and the credential variable, and add the included config to Claude Desktop or Cursor.
Does it support Swagger 2.0 and YAML?
Yes. OpenAPI 3.0, 3.1 and Swagger 2.0 are supported, in JSON or YAML. Local $ref references (#/components/... and #/definitions/...) are resolved; recursive schemas are cut off after a few levels. References to other files or URLs are not followed and are listed as warnings.
Is my OpenAPI spec uploaded anywhere?
No. Parsing and code generation run in your browser. The only network request is the optional Fetch button, which your browser sends straight to the URL you type.
How are API keys and tokens handled?
The converter reads the security schemes in the spec and picks one: an API key in a header or query parameter is read from API_KEY, a bearer or OAuth2 token from API_TOKEN, and HTTP Basic from API_USERNAME and API_PASSWORD. Credentials go in the env block of the host config, never in the code. Only one scheme per server is supported; for OAuth2 you obtain the token yourself.
Should I convert every endpoint into a tool?
Usually not. Models choose better from a short list of well-described tools, and the FastMCP docs also recommend curated servers over mirroring a whole API. Use Read-only only or untick admin and DELETE routes, and improve summaries in the spec before converting.
What if I do not have an OpenAPI spec?
Then you do not need this page. The MCP Server Generator builds a TypeScript or Python server from a form where you name the tools and parameters yourself, and the tool schema generator helps you design richer inputSchema JSON.