Get the FREE Ultimate OpenClaw Setup Guide →

mcp-swagger

MCP Swagger Server 将任何符合 OpenAPI/Swagger 规范的 REST API 转换为 Model Context Protocol (MCP) 格式,让 AI 助手能够理解和调用您的 API。

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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

Sponsor this space

Reach thousands of developers