mcp-swagger
MCP Swagger Server 将任何符合 OpenAPI/Swagger 规范的 REST API 转换为 Model Context Protocol (MCP) 格式,让 AI 助手能够理解和调用您的 API。
claude mcp add --transport stdio zaizaizhao-mcp-swagger-server mss --openapi https://petstore.swagger.io/v2/swagger.json --transport stdio
How to use
MCP Swagger Server (mcp-swagger) is a Node.js-based toolchain that converts OpenAPI/Swagger specifications into MCP (Model Context Protocol) format. It provides a command-line interface (mss) for interactive use, a standard CLI (mcp-swagger-server / mcp-swagger) for scripting and AI client integration, and an open API mode (mss --openapi ...) for directly starting with a given spec. The server supports multiple transports, including stdio, streamable, and SSE, and can enforce Bearer Token authentication to protect access to API conversions. This makes it suitable for integrating OpenAPI-powered tooling into AI assistants, automation scripts, and other MCP-enabled workflows.
Typical workflows include starting with an OpenAPI document (either a URL or a local file), optionally filtering operations, choosing a transport, and configuring authentication and custom headers. You can operate interactively with mss or run in non-interactive mode for automation by providing --openapi along with --transport. You can also use a configuration file or environment variables to manage tokens and endpoints, and you can expose the resulting MCP payloads via supported transports for downstream clients.
How to install
Prerequisites:\n- Node.js 20.x or newer (as required by the project)\n- npm (comes with Node.js) or pnpm if you prefer the project’s tooling\n\nInstall globally (recommended for quick usage):\nbash\nnpm i mcp-swagger-server -g\n\n\nUsage example (interactive mode):\nbash\nmss\n\nOr non-interactive mode directly from an OpenAPI document:\nbash\nmss --openapi https://api.example.com/openapi.json --transport streamable --auth-type bearer --bearer-token "your-token-here"\n\nFor script integration, you can reference the CLI directly as shown in the MCP config example.\n
Additional notes
Tips and notes:\n- This server converts OpenAPI/Swagger specs into MCP format with multiple transport options: stdio, streamable, and SSE.\n- Bearer Token authentication is supported to protect API access. You can supply tokens directly, via environment variables, or through a config file.\n- If the OpenAPI document uses relative servers URLs, you may want to provide --base-url or a full URL to ensure correct MCP wiring.\n- The toolset includes:\n - mss: Interactive CLI for guided configuration\n - mcp-swagger-server / mcp-swagger: Standard CLI for scripting\n - mcp-swagger-parser and mcp-swagger-api as internal components (OpenAPI parser and backend)\n- You can use a config.json file with --config to load a predefined setup.\n- When using STDIO transport, interactive mode is skipped, so prefer --transport stdio with --openapi for automation.\n
Related MCP Servers
openmcp
Turn any openapi file into an mcp server, with just the tools you need.
mcp-openapi
OpenAPI specification MCP server.
openapi -generator
A Python tool that automatically converts OpenAPI(Swagger, ETAPI) compatible specifications into fully functional Model Context Protocol (MCP) servers. Generates Docker-ready implementations with support for SSE/IO communication protocols, authentication, and comprehensive error handling. https://pypi.org/project/openapi-mcp-generator/
openapi-to
Turns any OpenAPI/Swagger API into an MCP server. One MCP tool per endpoint, Streamable HTTP - for AI clients calling your REST API.
nitro
MCP (Model Context Protocol) server powered by Nitro
openapi-directory
An MCP Server for APIs.guru remarkable Wikipedia for Web APIs. Providing tools, prompts and resources to help eliminate LLM Coding Agent hallucinations.