home / mcp / swagger mcp server

Swagger MCP Server

Converts Swagger/OpenAPI endpoints into MCP tools accessible via the standard MCP transport

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "hainanzhao-mcp-swagger": {
      "url": "https://api.example.com/swagger.json",
      "headers": {
        "SWAGGER_DOC_URL": "https://api.example.com/swagger.json",
        "SWAGGER_IGNORE_SSL": "true",
        "SWAGGER_TOOL_PREFIX": "example"
      }
    }
  }
}

You can turn Swagger/OpenAPI documentation into MCP-compatible tools that you can access via a standard MCP client. This server continuously converts REST endpoints described by Swagger into usable MCP tools, letting you query, call, and explore APIs in a consistent, transport-agnostic way.

How to use

To start using the MCP Swagger Server, run it as an MCP stdio service and point it to your Swagger documentation. You can load documentation from a URL or a local file, and you can organize the generated tools with a custom prefix. The server will expose each API endpoint as an MCP tool that you can call from any MCP-compatible client.

How to install

Prerequisites you need before installation are Node.js and npm. Install Node.js from the official site if you don’t already have it.

Global installation (optional): install the MCP Swagger tool globally so you can run it from any directory.

npm install -g mcp-swagger

Configuration and usage tips

You can run the server using either a remote Swagger URL or a local Swagger file. You can also customize the tool prefix, override the base API URL, and choose to ignore SSL certificate validation for internal APIs.

Using a URL with a custom prefix and SSL ignored:

mcp-swagger --doc-url https://api.example.com/swagger.json --tool-prefix example --ignore-ssl

Additional configuration options

You can also load documentation from a local file and override the base URL used for API calls. Authentication headers can be supplied if the API requires them.

From a local file with a custom base URL and prefix:

mcp-swagger --doc-file ./api-docs.json --base-url https://staging.api.com --tool-prefix staging

Available tools

swagger_tools

Tools generated from Swagger endpoints following the naming convention prefix_method_path, e.g., example_get_v1_users