home / mcp / swagger mcp server
Converts Swagger/OpenAPI endpoints into MCP tools accessible via the standard MCP transport
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.
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.
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-swaggerYou 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-sslYou 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 stagingTools generated from Swagger endpoints following the naming convention prefix_method_path, e.g., example_get_v1_users