harsha-iiiv/openapi-mcp-generator

A tool that converts OpenAPI specifications to MCP server

What it solves

Many LLM applications use the Model Context Protocol (MCP) to connect to external tools and data sources. Manually writing MCP servers for every REST API is repetitive and error-prone. This project automates that: you give it an OpenAPI specification (a standard description of a REST API), and it generates a complete, typed TypeScript MCP server that can call that API.

How it works

The tool reads an OpenAPI 3.x file (JSON or YAML) and converts every operation (like GET /pets) into an MCP tool definition. It also generates a full project scaffold: package.json, tsconfig, entry point, and environment variable examples. The generated server validates arguments using JSON Schema before sending requests to your real API, and it supports authentication methods such as API keys, Bearer tokens, Basic auth, and OAuth2. You can deploy the server in several ways: standard input/output for local use, an HTTP server with SSE, a Streamable HTTP server for scaling, or a Cloudflare Worker for edge deployment.

Who it’s for

Developers building MCP integrations, especially those who want to expose an existing REST API to LLM clients without writing MCP boilerplate by hand. It suits teams using Node.js and TypeScript, and those who need to support multiple deployment environments.

Highlights

  • Converts any OpenAPI 3.0/3.1 spec into MCP tool definitions and a runnable server.
  • Provides a typed, maintainable TypeScript codebase with a full project scaffold.
  • Validates tool arguments against JSON Schema 2020-12 before calls, with no code generation or eval.
  • Supports multiple transport modes: stdio, SSE (web), Streamable HTTP, and Cloudflare Workers.
  • Includes a browser playground for testing web-based transports.
  • Supports filtering operations by tags, operation IDs, or custom functions.
  • Exposes a programmatic API (getToolsFromOpenApi) for embedding the conversion in your own scripts.
  • Free and MIT licensed.

Related

  • Project
  • Project
  • Project
  • Project
  • Project