openapi-mcp-generator

by @harsha-iiiv

Openapi Generator MCP Server

Generate standalone, strongly typed TypeScript MCP servers from any OpenAPI 3.0 or 3.1 spec targeting stdio, SSE, Streamable HTTP, or Cloudflare Workers. This MIT-licensed Node.js CLI and library validates tool arguments against JSON Schema 2020-12 and ships a built-in browser test playground.

Server facts

openapi-mcp-generator

GitHub stars

644

Last commit

Nov 19, 2026

Runtime

node

License

MIT

Tech

Runtime
node
Transports
stdiostreamable-httpsse
Remote access
No
Authentication
Upstream API Key / Bearer / Basic / OAuth2 / OpenID; optional Inbound Bearer

Activity

GitHub stars
644
Last commit
Data as of

Overview

Teams searching for an openapi generator mcp tool want maintainable source code they own rather than a black-box hosted proxy. Published on npm under the MIT license, `openapi-mcp-generator` v5.0 compiles local or remote OpenAPI 3.0/3.1 JSON or YAML files into complete TypeScript MCP server projects built on `@modelcontextprotocol/server` (^2.4.0) and `@cfworker/json-schema`. Running the CLI via `npx` with `--input` and `--output` paths (Node.js 22.19+ required to run the generator; Node.js 22+ for generated servers) scaffolds `package.json`, `tsconfig.json`, and transport entry points supporting MCP 2026-07-28 alongside 2025-era clients, plus a programmatic `getToolsFromOpenApi` parser for custom Node.js workflows.

Choose `--transport` among `stdio` (default), `web` (Hono SSE), stateless `streamable-http`, or zero-config serverless `cloudflare-worker` (deployable via `wrangler deploy` without KV or Durable Objects). Generated tools enforce JSON Schema 2020-12 argument checks without `eval`, emit read-only/destructive/idempotent annotations, support optional `--output-schema` validation, and fail closed when upstream API keys, Bearer tokens, Basic auth, OAuth2, or OpenID credentials are absent. For exposed HTTP deployments, add `--inbound-auth bearer` (`MCP_AUTH_TOKEN`), `--header-passthrough` for per-user API keys, `MCP_ALLOWED_ORIGINS` DNS-rebinding guards, `x-mcp` or `--include-tags`/`--exclude-operations` filtering, and test interactively through the built-in browser playground or `mcp.pidata.tech/playground`.

Install & configure

Requirements

  • Node.js 22.19 or newer to run v5.0 of the generator (generated servers require Node.js 22+)
  • Valid OpenAPI 3.0 or 3.1 JSON/YAML specification (convert Swagger 2.0 specs first using `npx swagger2openapi`)
  • Upstream API credentials via `.env` / Wrangler secrets (or `--header-passthrough`), plus optional `MCP_AUTH_TOKEN` for HTTP inbound auth
Documented launch / install command
npx openapi-mcp-generator --input ./openapi.json --output ./my-mcp

Run directly with `npx openapi-mcp-generator --input ./openapi.json --output ./my-mcp` or install globally via `npm install -g openapi-mcp-generator`. Pick `--transport` from `stdio`, `web`, `streamable-http`, or `cloudflare-worker`, then run `npm install` inside the generated directory.

Use cases

  • Wrap internal REST microservices described by OpenAPI 3.x specs into local stdio MCP servers for Claude Code, Cursor, and VS Code.
  • Deploy stateless, edge-hosted MCP endpoints on Cloudflare Workers free tier with `--transport=cloudflare-worker`, `--inbound-auth bearer`, and Wrangler secrets.
  • Curate safe read-only tool subsets from massive enterprise APIs using `x-mcp: false`, `--include-tags`, `--exclude-operations`, or `getToolsFromOpenApi` filter predicates.
  • Debug tool schemas, custom headers, OAuth flows, and raw JSON-RPC payloads interactively in the generated HTTP browser playground.

Strengths

  • Outputs clean, editable TypeScript projects on MCP SDK v2 supporting both MCP 2026-07-28 and 2025-era clients across stdio, SSE, Streamable HTTP, and Cloudflare Workers.
  • Validates every tool call against JSON Schema 2020-12 using `@cfworker/json-schema` (no `eval`) and fails closed when upstream credentials are missing.
  • Rich security and curation flags: `--inbound-auth bearer`, `--header-passthrough`, `MCP_ALLOWED_ORIGINS`, `--custom-auth`, `x-mcp` extensions, and `--max-tool-name-length` (default 64).
  • Includes a zero-CORS local browser playground at `/` plus a hosted playground at `mcp.pidata.tech/playground` generating Claude Code, Cursor, and VS Code configs.

Limitations

  • Refuses Swagger 2.0 specifications outright—legacy specs must be converted with `swagger2openapi` before generation.
  • Requires Node.js 22.19+ for v5.0 (Node 20 is EOL) and generates TypeScript/Node servers only, not Python servers.
  • Regenerating with `--force` overwrites manual edits inside the output directory unless tracked carefully in Git.

Frequently asked questions

Run `npx openapi-mcp-generator --input ./openapi.json --output ./my-mcp` (using Node.js 22.19+), then `cd my-mcp && npm install`. You can switch output targets with `--transport=stdio`, `--transport=streamable-http`, `--transport=web` (SSE), or `--transport=cloudflare-worker`, and filter operations with `--include-tags` or `--exclude-operations`.

Related MCP servers