openapi-mcp-generator CLI

A CLI that builds a ready-made TypeScript MCP server from an OpenAPI 3 spec, with tools, validation and auth generated for you

  • 643 ★ on the repository
  • Last commit
  • MIT
CLI

Extended access

Why this level

  • The generator reads a spec from a path or URL and writes a project to the folder you name
  • The generated server calls your REST API with keys and tokens from environment variables and exposes every operation in the spec, including data-changing ones, until you exclude them with `x-mcp: false`
  • The `--insecure` flag turns off TLS certificate verification in the generated server
All reasons and checks

harsha-iiiv/openapi-mcp-generator

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/openapi-mcp-generator

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The generator reads a spec from a path or URL and writes a project to the folder you name
  • The generated server calls your REST API with keys and tokens from environment variables and exposes every operation in the spec, including data-changing ones, until you exclude them with `x-mcp: false`
  • The `--insecure` flag turns off TLS certificate verification in the generated server

This is third-party code. Review the repository files before installing.

What it does

You have a REST API described in OpenAPI and an agent that needs it through MCP. The command `openapi-mcp-generator --input openapi.json --output ./server` reads the spec (a file or a URL, YAML or JSON) and creates a Node.js project: `package.json`, `tsconfig.json`, an entry point, an `.env.example` and the server code. Every API operation becomes an MCP tool, and the server forwards calls to the original REST API while validating the request structure. Zod schemas are generated from the OpenAPI definitions, so inputs are validated at runtime. Authentication is configured through environment variables: API key, Bearer token, Basic and OAuth2. The `--transport` flag picks the transport: stdio for local work, a web server with SSE, StreamableHTTP, or a ready project for Cloudflare Workers that deploys with `npx wrangler deploy`. Web modes ship with a built-in browser test client. The `x-mcp: true | false` extension decides which operations become tools. It can be set on the root, a path or an operation, and the narrowest level wins. For use inside code, the package offers a programmatic API, for example the `getToolsFromOpenApi` function.

Who it is for. For developers and teams that already have a REST API with an OpenAPI spec and want to expose it to agents through MCP without writing the server by hand.

Good fit when

  • An internal service is described in openapi.yaml and you need an MCP server for Claude Desktop or another MCP client without hand-writing the server
  • The MCP server has to be reachable over the network: `--transport=web` and `--transport=streamable-http` create an HTTP server with a test page
  • You need an MCP server without your own hosting: the `cloudflare-worker` mode creates a project for the free Cloudflare Workers tier
  • Not every API operation should reach the agent: the `x-mcp: false` extension excludes dangerous methods, and `--default-include false` excludes everything by default
  • Each user needs their own key: the `--header-passthrough` flag forwards chosen client headers to the upstream API

Not a fit when

  • The API has no OpenAPI 3 spec: the generator builds a server only from one
  • You need an MCP server for a ready-made service such as GitHub or Postgres: an existing server from the catalog is simpler
  • You want terminal commands: openapi-to-cli exists for that
  • Your environment lacks Node.js 20 or newer: both the generator and the created project require it

Example request

Generate an MCP server from openapi.yaml with openapi-mcp-generator on stdio transport, expose only read operations to the agent and show how to connect it to Claude Desktop

Limitations

Node.js 20 or newer is required. The generator accepts OpenAPI 3.0 and later specs. If the spec's `servers` field has no address or an ambiguous one, set it with `--base-url`. External `$ref` links over http and https are off by default to prevent SSRF during parsing; `--allow-external-refs` turns them on.

In the `cloudflare-worker` mode several flags (`--header-passthrough`, `--custom-auth`, `--port`, `--insecure`, `--generate-lib`, `--oauth-creds-in-body`) do not apply, and the generator prints a warning. Tool names are truncated to 64 characters because Claude Desktop accepts nothing longer. You have to run and maintain the generated project yourself.

How to disable. Remove the generator with `npm uninstall -g openapi-mcp-generator`. The servers it creates live in separate folders: delete the project folder and remove the server entry from your MCP client settings.

FAQ

How do I make an MCP server from an OpenAPI spec?

Install the package with `npm install -g openapi-mcp-generator` and run `openapi-mcp-generator --input path/to/openapi.json --output path/to/output/dir`. Then run `npm install` and `npm start` in the created folder. By default you get a standard input and output server.

Which authentication types does openapi-mcp-generator support?

API key, Bearer token, Basic and OAuth2. The values come from environment variables such as API_KEY_, BEARER_TOKEN_, BASIC_USERNAME_ and OAUTH_CLIENT_ID_ with the scheme name from the spec as a suffix. For non-standard logic, the `--custom-auth` flag creates an editable `src/auth.ts` file with an applyCustomAuth function.

How do I keep some API methods away from the agent?

Put the `x-mcp: false` extension on the root, a path or an operation in the spec. The narrowest level wins: an operation beats a path, a path beats the root. To exclude everything and include by list, run the generator with `--default-include false`.

How do I deploy the generated MCP server to Cloudflare Workers?

Run the generator with `--transport cloudflare-worker`, then `npm install` in the created folder, set secrets with `npx wrangler secret put API_KEY` and deploy with `npx wrangler deploy`. The server answers over Streamable HTTP at /mcp and runs on the free Workers tier.

How do I test the generated server without an MCP client?

For the web and streamable-http transports the generator puts a test client into the project. Start the server with `npm run start:web` or `npm run start:http` and open `http://localhost:3000` (the `--port` flag sets the port). The Cloudflare Workers mode has no test client, so use MCP Inspector there.

Discussion

No questions or reviews yet.

CLI tools

OpenMCP turns any OpenAPI specification into an MCP server and lets you choose which tools the agent sees

MCP serverExtended access303Repository stars

A plugin with skills for building TypeScript MCP servers and MCP apps: the agent scaffolds, edits, debugs and verifies them

PluginExtended access10.8KRepository stars

A gateway that turns any API with an OpenAPI V3 spec into an MCP server, without touching the original API

MCP serverExtended access625Repository stars

A CLI and TypeScript runtime for calling MCP servers from a terminal, scripts and generated typed clients

CLIExtended access5.1KRepository stars

An MCP server that lets an agent read files, search code and run commands in a workspace

MCP serverBroad access1.2KRepository stars

A lightweight CLI to discover, inspect and call MCP server tools straight from the shell

CLIExtended access1.3KRepository stars

Comparison with similar tools

Entries that share the main search query, and how they differ.

EntryOfficialAuthenticationRepository starsMain difference
openapi-mcp-generator (this entry)no643
MCP Linknonot required625a gateway that turns an API with an OpenAPI V3 description into an MCP server on the fly, with no generated project
OpenAPI to CLI (ocli)no267turns an API from a spec into terminal commands

README in short

The README begins with a feature list: OpenAPI 3.0 support, call proxying, authentication, Zod schemas, typed code, several transports, a project scaffold and test clients. It continues with installation, call examples for four transports, a table of all flags, a programmatic example and the layout of the generated project. Separate sections cover transport modes with a comparison table, authentication environment variables, operation filtering through `x-mcp` and running the finished server.

README badge

Report a problem

Foxx AIopenapi-mcp-generator
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.