MCP Swagger Server (mss)

MCP Swagger Server (mss)

Seamlessly convert OpenAPI/Swagger specs into Model Context Protocol tools for AI integration.

38
Stars
8
Forks
38
Watchers
3
Issues
MCP Swagger Server converts OpenAPI/Swagger API specifications into Model Context Protocol (MCP) compatible tools, enabling REST APIs to become directly callable by AI systems. It supports zero-configuration conversion, multiple transport protocols (SSE, Streamable, Stdio), and secure API access through Bearer Token authentication. The tool offers an interactive command-line interface and configuration options to filter operations, customize transports, and manage API security. Its modular structure includes OpenAPI parsing, web UI, and backend services.

Key Features

Converts OpenAPI/Swagger to Model Context Protocol format
Zero-configuration tool for rapid setup
Supports multiple transport protocols (SSE, Streamable, Stdio)
Bearer Token-based security for API access
Interactive command-line interface
Flexible operation filtering by method, path, ID, status, parameters
Configuration via command line or environment files
Progressive CLI for stepwise user guidance
Modular structure with parsing and web UI components
Integration with AI assistants such as Claude Desktop

Use Cases

Exposing existing REST APIs to AI models via MCP
Rapidly converting API specifications for AI toolchains
Enabling secure, authenticated AI access to enterprise APIs
Configuring custom API transports for streaming or standard output
Filtering exposed API operations for precise AI capabilities
Automating API tool deployment for AI assistants
Building web interfaces for API management within MCP
Integrating external data providers into AI workflows
Testing AI agent interaction with real APIs
Onboarding legacy APIs for use in model context environments

README

MCP Swagger Server(mss)

TypeScript Node.js License Trust Score

一个将 OpenAPI/Swagger 规范转换为 Model Context Protocol (MCP) 格式的工具

零配置将您的 REST API 转换为 AI 可调用的工具

🚀 快速开始📖 使用指南🛠️ 开发

Languages: English | 中文


🎯 项目截图

项目截图 项目截图

🎯 项目简介

MCP Swagger Server 是一个将 OpenAPI/Swagger 规范转换为 Model Context Protocol (MCP) 格式的工具。

📦 项目结构

mcp-swagger-server/
├── packages/
│   ├── mcp-swagger-server/     # 🔧 核心 MCP 服务器 (可用)
│   ├── mcp-swagger-parser/     # 📝 OpenAPI 解析器 (可用)
│   ├── mcp-swagger-ui/         # 🎨 Web 界面 (开发中)
│   └── mcp-swagger-api/        # 🔗 REST API 后端 (可用)
└── scripts/                    # 🔨 构建脚本

✨ 核心特性

  • 🔄 零配置转换: 输入 OpenAPI 规范,立即获得 MCP 工具
  • 🎯 渐进式命令行: 提供逐步引导的命令行界面,方便用户配置
  • 🔌 多传输协议: 支持 SSE、Streamable 和 Stdio 传输
  • 🔐 安全认证: 支持 Bearer Token 认证保护 API 访问

🚀 快速开始

环境要求

  • Node.js ≥ 20.0.0
  • pnpm ≥ 8.0.0 (推荐)

安装

bash
npm i mcp-swagger-server -g

快速启动

自定义启动

bash
mss

一键启动

bash
mss --openapi https://api.example.com/openapi.json --operation-filter-methods GET,POST --transport streamable -auth-type bearer --bearer-token "your-token-here"

# 使用配置文件
mcp-swagger-server --config config.json

命令行选项

bash
# 基本用法
mss [选项]

# 选项:
--openapi, -o       OpenAPI 规范的 URL 或文件路径
--transport, -t     传输协议 (stdio|sse|streamable)
--port, -p          端口号
--watch, -w         监控文件变化
--verbose           详细日志输出

# Bearer Token 认证选项:
--auth-type         认证类型 (bearer)
--bearer-token      直接指定 Bearer Token
--bearer-env        从环境变量读取 Token
--config, -c        配置文件路径

# 操作过滤选项:
--operation-filter-methods <methods>        HTTP方法过滤 (可重复) [示例: GET,POST]
--operation-filter-paths <paths>            路径过滤 (支持通配符, 可重复) [示例: /api/*]
--operation-filter-operation-ids <ids>      操作ID过滤 (可重复) [示例: getUserById]
--operation-filter-status-codes <codes>     状态码过滤 (可重复) [示例: 200,201]
--operation-filter-parameters <params>      参数过滤 (可重复) [示例: userId,name]

🔐 Bearer Token 认证

mcp-swagger-server 支持 Bearer Token 认证,可以保护需要身份验证的 API 访问。

认证方式

1. 直接指定 Token

bash
mss --auth-type bearer --bearer-token "your-token-here" --openapi https://api.example.com/openapi.json --transport streamable

环境变量配置

创建 .env 文件:

env
# 基础配置
MCP_PORT=3322
MCP_TRANSPORT=stdio
MCP_OPENAPI_URL=https://api.example.com/openapi.json

# 认证配置
MCP_AUTH_TYPE=bearer
API_TOKEN=your-bearer-token-here

🤖 与 AI 助手集成

Claude Desktop 配置

json
{
  "mcpServers": {
    "swagger-converter": {
      "command": "mss",
      "args": [
        "--openapi", "https://petstore.swagger.io/v2/swagger.json",
        "--transport", "stdio"
      ]
    },
    "secured-api": {
      "command": "mss",
      "args": [
        "--openapi", "https://api.example.com/openapi.json",
        "--transport", "stdio",
        "--auth-type", "bearer",
        "--bearer-env", "API_TOKEN"
      ],
      "env": {
        "API_TOKEN": "your-bearer-token-here"
      }
    }
  }
}

🛠️ 开发

构建系统

bash
# 构建所有包
pnpm build

# 仅构建后端包
pnpm build:packages

# 开发模式
pnpm dev

# 清理构建产物
pnpm clean

🤝 贡献

欢迎贡献!请先阅读 贡献指南

📄 许可证

MIT License - 详见 LICENSE 文件。


Built with ❤️ by ZhaoYaNan(ZTE)

⭐ Star🐛 Issues💬 Discussions

Star History

Star History Chart

Repository Owner

zaizaizhao
zaizaizhao

User

Repository Details

Language TypeScript
Default Branch main
Size 2,564 KB
Contributors 2
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

TypeScript
64.68%
Vue
29.02%
JavaScript
4.02%
HTML
1.16%
CSS
0.51%
Powershell
0.43%
Shell
0.14%
Dockerfile
0.04%

Topics

mcp mcpserver openapi openapi-mcp swagger swagger-mcp

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • mcp-cli

    mcp-cli

    A command-line inspector and client for the Model Context Protocol

    mcp-cli is a command-line interface tool designed to interact with Model Context Protocol (MCP) servers. It allows users to run and connect to MCP servers from various sources, inspect available tools, resources, and prompts, and execute commands non-interactively or interactively. The tool supports OAuth for various server types, making integration and automation seamless for developers working with MCP-compliant servers.

    • 391
    • MCP
    • wong2/mcp-cli
  • Taskade MCP

    Taskade MCP

    Tools and server for Model Context Protocol workflows and agent integration

    Taskade MCP provides an official server and tools to implement and interact with the Model Context Protocol (MCP), enabling seamless connectivity between Taskade’s API and MCP-compatible clients such as Claude or Cursor. It includes utilities for generating MCP tools from any OpenAPI schema and supports the deployment of autonomous agents, workflow automation, and real-time collaboration. The platform promotes extensibility by supporting integration via API, OpenAPI, and MCP, making it easier to build and connect agentic systems.

    • 90
    • MCP
    • taskade/mcp
  • Weblate MCP Server

    Weblate MCP Server

    Seamlessly connect AI assistants to Weblate for translation management via the Model Context Protocol.

    Weblate MCP Server enables AI assistants and clients to directly manage Weblate translation projects through the Model Context Protocol (MCP). It integrates with the Weblate REST API, allowing natural language interaction for project and translation management. The tool offers multiple transport options including HTTP, SSE, and STDIO, and is optimized for large language model workflows. Full support for project, component, and translation operations is provided, with a focus on type safety and flexible environment configuration.

    • 9
    • MCP
    • mmntm/weblate-mcp
  • Azure DevOps MCP Server

    Azure DevOps MCP Server

    Standardized AI access to Azure DevOps via Model Context Protocol.

    Implements the Model Context Protocol (MCP) to enable AI assistants to securely and efficiently interact with Azure DevOps resources. Provides a standardized bridge for managing projects, work items, repositories, pull requests, and pipelines through natural language interfaces. Supports modular authentication and a feature-based architecture for scalability and integration. Facilitates seamless integration with AI tools such as Claude Desktop and Cursor AI.

    • 306
    • MCP
    • Tiberriver256/mcp-server-azure-devops
  • OpenAI MCP Server

    OpenAI MCP Server

    Bridge between Claude and OpenAI models using the MCP protocol.

    OpenAI MCP Server enables direct querying of OpenAI language models from Claude via the Model Context Protocol (MCP). It provides a configurable Python server that exposes OpenAI APIs as MCP endpoints. The server is designed for seamless integration, requiring simple configuration updates and environment variable setup. Automated testing is supported to verify connectivity and response from the OpenAI API.

    • 77
    • MCP
    • pierrebrunelle/mcp-server-openai
  • Markdownify MCP Server

    Markdownify MCP Server

    Convert diverse files and web content into Markdown via the Model Context Protocol.

    Markdownify MCP Server offers a protocol-based server that transforms various file types—including PDF, images, audio, DOCX, XLSX, and PPTX—as well as web content like YouTube videos, Bing search results, and web pages into Markdown format. The server exposes a suite of conversion tools through a standardized interface for easy integration with applications. Optional configuration allows retrieval of Markdown files from restricted directories, and the platform supports development customization for additional tool integration. Deployment and operation are straightforward with cross-platform support (with pending Windows improvements).

    • 2,256
    • MCP
    • zcaceres/markdownify-mcp
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results