OpenAPI to MCP Generator

Convert any OpenAPI 3.0 or 3.1 specification into a ready-to-run Model Context Protocol (MCP) server. Paste your spec (JSON or YAML), pick Python or TypeScript, and copy a complete server file plus a Claude Desktop config snippet — so any LLM client (Claude Desktop, Cursor, Continue, Cline, Goose) can call your REST API as MCP tools.

Auto-detected as JSON or YAML. Live regeneration on every keystroke.
0
Paste a spec to begin

What Is the Model Context Protocol (MCP)?

The Model Context Protocol (MCP) is an open standard, introduced by Anthropic in late 2024, that defines how large language model (LLM) applications expose tools, resources and prompts to AI assistants. Think of it as the USB-C of LLM integrations: a single, stable wire protocol that any compliant client — Claude Desktop, Cursor, Continue, Cline, Goose, Zed, and a growing list of others — can talk to. Before MCP, every IDE and every chat application had its own bespoke way of plugging in tools, which meant tool authors had to write five different wrappers for the same functionality. MCP collapses that to one.

An MCP server is just a small process — typically Python or Node.js — that speaks JSON-RPC over stdio (for local servers) or HTTP+SSE (for remote servers). It exposes one or more tools, each with a name, description and JSON Schema for its arguments. When you ask Claude (or any other MCP-compatible client) a question, it can invoke these tools just like a human would call a function — fetching live data from your APIs, querying your database, or running custom code.

What Is OpenAPI and Why Bridge It to MCP?

OpenAPI (formerly Swagger) is the de facto standard for describing REST APIs. If you have ever called GET /users/{id} on a public API, chances are there is an OpenAPI document somewhere that lists every endpoint, every parameter and every response shape. There are millions of published OpenAPI specs in the wild — GitHub, Stripe, Slack, OpenAI, Anthropic, every Kubernetes cluster, and most enterprise internal services all publish one.

The problem: an OpenAPI spec is not directly usable by an LLM. You cannot point Claude Desktop at https://api.example.com/openapi.json and expect it to call those endpoints. You first need an MCP server that wraps each REST operation as an MCP tool. Writing that wrapper by hand is tedious and error-prone — especially for APIs with dozens or hundreds of endpoints. This generator does it in one paste.

How This OpenAPI to MCP Generator Works

The tool runs entirely in your browser. Here is the flow, step by step:

  1. Paste your OpenAPI spec in either JSON or YAML form. The tool auto-detects the format and parses it with the standards-compliant js-yaml library.
  2. The generator walks every path × method pair in the spec, treating each as one MCP tool. The tool name comes from operationId when present, otherwise from a deterministic method_path slug.
  3. Parameters are extracted from path, query, header and request body fields. Their JSON Schema types are translated to Python type hints (FastMCP) or Zod schemas (TypeScript SDK).
  4. The base URL is taken from servers[0].url in the spec, or you can override it with the input field on the left.
  5. A complete server file is rendered on the right, ready to copy and run. A second snippet, the Claude Desktop config, shows you exactly what to paste into claude_desktop_config.json to register the server.

Using the Generated MCP Server

Python (FastMCP) — Save the generated code as server.py and install the official SDK:

pip install mcp httpx

Then run it once locally to confirm it starts, with python server.py. Finally, paste the Claude Desktop config snippet into claude_desktop_config.json (on macOS at ~/Library/Application Support/Claude/, on Windows at %APPDATA%\Claude\) and restart Claude Desktop. The new tools will appear in the hammer icon menu and Claude can call them.

TypeScript (official SDK) — Save as server.ts and install dependencies:

npm install @modelcontextprotocol/sdk zod

Compile with tsc or run directly with tsx server.ts. The Claude Desktop config snippet points to the compiled .js file. The same generated server will work in Cursor, Continue, Cline and any other MCP-compatible client because the protocol is identical.

Authentication and Secrets

Most real APIs need an authentication token. The generator inspects your spec's components.securitySchemes and adds placeholder environment-variable reads — os.environ["API_TOKEN"] in Python, process.env.API_TOKEN in TypeScript — so you never hardcode secrets. The Claude Desktop config snippet includes an env block where you paste the actual token. The token lives only on your machine; it is never sent to Anthropic or to this site.

Limitations You Should Know

Generated Output Examples

Python (FastMCP) — Petstore GET /pet/{petId}
@mcp.tool()
async def getPetById(petId: int) -> str:
    """Find pet by ID"""
    path = "/pet/{petId}".replace("{petId}", str(petId))
    return await _request("GET", path)
TypeScript (official SDK) — same operation
server.registerTool(
  "getPetById",
  {
    description: "Find pet by ID",
    inputSchema: { petId: z.number() }
  },
  async ({ petId }) => {
    const path = "/pet/{petId}".replace("{petId}", String(petId));
    const text = await callApi("GET", path);
    return { content: [{ type: "text", text }] };
  }
);
Claude Desktop config — registers the generated server
{
  "mcpServers": {
    "petstore-mcp": {
      "command": "python",
      "args": ["/absolute/path/to/server.py"],
      "env": { "API_TOKEN": "your-token-here" }
    }
  }
}

Frequently Asked Questions

MCP is an open protocol, introduced by Anthropic in late 2024, that standardizes how LLM applications expose tools, resources and prompts to AI assistants. It uses JSON-RPC over stdio for local servers and HTTP+SSE for remote ones. Once a server speaks MCP, any compliant client — Claude Desktop, Cursor, Continue, Cline, Goose, Zed — can invoke its tools without further integration work.

Two artefacts. First, a complete MCP server file in Python (using the official mcp SDK's FastMCP convenience layer) or TypeScript (using @modelcontextprotocol/sdk with Zod schemas). Each OpenAPI operation becomes one MCP tool with proper typed arguments. Second, a claude_desktop_config.json snippet you paste into your Claude Desktop config to register the server.

OpenAPI 3.0.x and 3.1.x are supported. Older Swagger 2.0 specs work in many cases (the path/method walk is similar) but a few fields differ — for the best results convert your spec to OpenAPI 3 first using swagger2openapi or any of the online converters.

Save the generated code to a file (for example ~/mcp-servers/petstore.py). Open the Claude Desktop config file: on macOS at ~/Library/Application Support/Claude/claude_desktop_config.json, on Windows at %APPDATA%\Claude\claude_desktop_config.json. Paste the snippet shown on the right, replacing the file path with the absolute path on your machine. Restart Claude Desktop. The hammer icon in the chat input should now list your new tools.

If your spec declares securitySchemes (Bearer token, API key in header, basic auth), the generated server reads the token from an environment variable and injects it on every request. The Claude Desktop config snippet includes a placeholder env block for you to paste the real token. The token stays on your machine — it is never sent to Anthropic or to this tool.

Yes. MCP is a protocol, not a product. The generated server file is identical regardless of which client you use; only the config location and syntax differ. Cursor reads from its own settings, Continue uses a YAML file under ~/.continue/, Cline has its own block, etc. The MCP server you generate here works with all of them.

Yes — the entire generation runs in your browser. Your OpenAPI spec is never uploaded anywhere, never logged, never persisted. You can paste internal specs that contain confidential endpoints and the generated code will live only in the right panel until you close the tab. The base URL in the generated code can point to anything reachable from the machine that runs the MCP server, including localhost and VPN-only hosts.

No. This tool is 100% client-side. The OpenAPI parser (js-yaml) runs in your browser, the code generator runs in your browser, the output renders in your browser. Nothing about your spec is ever sent to Tools Searcher or any other server. You can verify this by opening the network tab in your browser's dev tools while typing.