Navigation
OpenAPI to MCP Generator: Automate Deployments, Slash Dev Time - MCP Implementation

OpenAPI to MCP Generator: Automate Deployments, Slash Dev Time

Easily turn OpenAPI specs into MCP servers—automate deployments, slash dev time, and boost productivity!

Developer Tools
4.0(74 reviews)
111 saves
51 comments

Users create an average of 16 projects per month with this tool

About OpenAPI to MCP Generator

What is OpenAPI to MCP Generator: Automate Deployments, Slash Dev Time?

This command-line tool automates the creation of Model Context Protocol (MCP) server code from OpenAPI specifications. By acting as a bridge between Large Language Models (LLMs) and your existing APIs, it reduces deployment time and simplifies integration workflows. The generator handles everything from endpoint mapping to project setup, supporting stdio, WebSocket, and HTTP communication out of the box.

How to Use OpenAPI to MCP Generator: Automate Deployments, Slash Dev Time?

Installation Options

  • Global npm install: npm install -g openapi-mcp-generator
  • Yarn users: yarn global add openapi-mcp-generator
  • PNPM alternative: pnpm add -g openapi-mcp-generator

Basic Workflow

  1. Run the generator with your OpenAPI file: openapi-mcp-generator --openapi path/to/spec.json --output ./output
  2. Customize options like transport type (--transport http) or server name (--name my-api-proxy)
  3. Install dependencies in the generated folder: npm install
  4. Configure environment variables from .env.example
  5. Start your MCP server: npm start

OpenAPI to MCP Generator Features

Key Features of OpenAPI to MCP Generator: Automate Deployments, Slash Dev Time?

  • Endpoint Autobinding: Automatically converts every API endpoint into a usable MCP tool
  • Transport Flexibility: Supports three communication protocols with zero code changes
  • Full Stack Setup: Generates complete Node.js projects with dependency management
  • Type Safety: Includes TypeScript definitions and configuration files
  • Environment Configuration: Simple .env management for server parameters

Use Cases of OpenAPI to MCP Generator: Automate Deployments, Slash Dev Time?

Here are common scenarios where this tool shines:

  • Rapid prototyping of API-LM integrations
  • Creating standardized interfaces for multiple LLM platforms
  • Building real-time API bridges via WebSocket
  • Enabling secure API access through HTTP gateways
  • TypeScript-first development with auto-generated type definitions

OpenAPI to MCP Generator FAQ

FAQ from OpenAPI to MCP Generator: Automate Deployments, Slash Dev Time?

What Node versions are supported?

Requires Node.js 16+ and npm 7+. Works with all LTS versions.

Can I contribute improvements?

Absolutely! Fork the repo, make changes through standard Git workflow, and submit pull requests for review.

How do I customize server behavior?

Edit the generated .env file for API URLs and headers. Modify server.js for advanced configuration needs.

Does it support OpenAPI 3?

Yes! The tool works with both OpenAPI 2 and 3 specifications.

What if my API needs authentication?

Configure API-specific headers in the API_HEADERS environment variable for secure requests.

Content

OpenAPI to MCP Generator

A command-line tool that generates Model Context Protocol (MCP) server code from OpenAPI specifications. This tool helps you quickly create an MCP server that acts as a bridge between LLMs (Large Language Models) and your API.

npm version License: MIT

Features

  • Automatic Tool Generation : Converts each API endpoint in your OpenAPI spec into an MCP tool
  • Multiple Transport Options : Supports stdio, WebSocket, and HTTP transport methods
  • Complete Project Setup : Generates all necessary files to run an MCP server
  • TypeScript Support : Includes TypeScript definitions and configuration
  • Easy Configuration : Simple environment-based configuration for the generated server

Installation

# Install globally from npm
npm install -g openapi-mcp-generator

# Or with yarn
yarn global add openapi-mcp-generator

# Or with pnpm
pnpm add -g openapi-mcp-generator

Usage

Generate an MCP server from an OpenAPI specification:

openapi-mcp-generator --openapi path/to/openapi.json --output /Path/to/output

Command Line Options

Option Alias Description Default
--openapi -o Path or URL to OpenAPI specification (required)
--output -d Output directory for generated files ./mcp-server
--name -n Name for the MCP server openapi-mcp-server
--version -v Version for the MCP server 1.0.0
--transport -t Transport mechanism (stdio, websocket, http) stdio
--port -p Port for websocket or HTTP server 3000
--help -h Show help information

Examples

Generate from a local OpenAPI file:

openapi-mcp-generator --openapi ./specs/petstore.json --output ./petstore-mcp

Generate from a remote OpenAPI URL:

openapi-mcp-generator --openapi https://petstore3.swagger.io/api/v3/openapi.json --output ./petstore-mcp

Specify a WebSocket transport:

openapi-mcp-generator --openapi ./specs/petstore.json --transport websocket --port 8080

Generated Files

The tool generates the following files in the output directory:

  • server.js - The main MCP server implementation
  • package.json - Dependencies and scripts
  • README.md - Documentation for the generated server
  • .env.example - Template for environment variables
  • types.d.ts - TypeScript type definitions for the API
  • tsconfig.json - TypeScript configuration

Using the Generated Server

After generating your MCP server:

  1. Navigate to the generated directory:

    cd my-mcp-server

  2. Install dependencies:

    npm install

  3. Create an environment file:

    cp .env.example .env

  4. Edit .env to set your API base URL and any required headers:

    API_BASE_URL=https://api.example.com

API_HEADERS=Authorization:Bearer your-token-here
  1. Start the server:

    npm start

Requirements

  • Node.js 16.x or higher
  • npm 7.x or higher

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT

Related MCP Servers & Clients