Back to MCP Servers

Openapi To

MCP server that automatically converts any OpenAPI/Swagger specification into a set of usable MCP tools. Unlike manual tool definition, this approach auto-generates tools directly from the Swagger spec, ensuring consistency, reducing maintenance effort, and preventing mismatches…

developer-toolsapiai
By bbonnin
64Updated 6 months agoJavaMIT

Installation

npx -y openapi-to-mcp

Configuration

{
  "mcpServers": {
    "openapi-to-mcp": {
      "command": "npx",
      "args": ["-y", "openapi-to-mcp"]
    }
  }
}

How to use

  1. Run the installation command above (if needed)
  2. Open your Claude Code settings file (~/.claude/settings.json)
  3. Add the configuration to the mcpServers section
  4. Restart Claude Code to apply changes

OpenApi MCP Server

OpenApiMCPServer is an MCP server that automatically converts any OpenAPI/Swagger specification into a set of usable MCP tools.

It analyzes all API endpoints, generates structured tool definitions, and routes tool calls to the underlying REST API. This allows AI agents to interact with any OpenAPI-based service instantly, without manual tool coding.

Modules

There are several modules:

  • openapi-mcp-server: the application that is a MCP server providing the tools defined in an OpenAPI definition (provided as a local file or an HTTP endpoint)

    • This server dynamically loads the Swagger content and provides the functions of the API through the MCP protocol, so they can be used in a generative AI architecture without recoding anything
    • At startup: MCP Server Startup
    • At runtime: Usage
  • openapi-mcp-example: a simple example divided in two parts

    • In api package : a fake infrastructure API for managing virtual machines. The API will be invoked by the OpenAPI MCP Server
    • In assistant package : an assistant with a simple chat that will use the infrastructure API through the MCP server accessing the API

Run

MCP Server

To start the MCP Server

java -jar $PATH_TO_JAR/openapi-mcp-server.jar --openapi.location=<swagger file or URL>

Example

Example

View source on GitHub