swagger-mcp
swagger-mcp
概述
swagger-mcp是一款用于抓取 Swagger UI 的工具,它提取swagger.json文件,并在运行时动态生成定义明确的 mcp 工具。MCP 客户端可以利用这些工具进行进一步的工具选择。
Related MCP server: MCP Swagger Server
📽️演示视频
查看展示该项目实际运行情况的演示视频:
🙌 支持
如果您发现这个项目有价值,请通过以下方式在LinkedIn上支持我:
👍 喜欢并分享我们的演示帖子
💬 在评论中留下你的想法和反馈
🔗 与我联系以获取未来更新
您在 LinkedIn 上的支持将帮助我接触更多人并改进项目!
先决条件
要使用swagger-mcp ,请确保您具有以下依赖项:
LLM 模型 API 密钥/本地 LLM :需要访问 OpenAI、Claude 或 Ollama 模型。
任何 MCP 客户端:(使用mark3labs - mcphost )
安装和设置
按照以下步骤安装并运行swagger-mcp :
go install github.com/danishjsheikh/swagger-mcp@latest
swagger-mcp运行配置
要直接运行swagger-mcp ,请使用:
swagger-mcp --specUrl=https://your_swagger_api_docs.json主要旗帜:
--specUrl:Swagger/OpenAPI JSON URL(必需)--sseMode:以 SSE 模式运行(默认值:false,如果为 true 则作为 SSE 服务器运行,否则使用 stdio)--sseAddr:SSE 服务器监听地址,采用 IP:Port 或 :Port 格式(如果为空,将使用 --sseUrl 中的 IP:Port)--sseUrl:SSE 服务器基本 URL(如果为空,将使用 sseAddr 生成,例如http://IP:Port或http://localhost:Port )如果同时设置了 --sseAddr 和 --sseUrl,则它们将按原样使用,不会自动补充。
--baseUrl:覆盖 API 请求的基本 URL--security:API 安全类型(basic、apiKey或bearer)--basicAuth:以用户:密码格式进行基本身份验证--bearerAuth:授权标头的 Bearer 令牌--apiKeyAuth:API 密钥,格式passAs:name=value(例如header:token=abc,query:user=foo,cookie:sid=xxx)请参阅 main.go 了解所有支持的标志和选项。
MCP 配置
要与mcphost集成,请在.mcp.json中包含以下配置:
{
"mcpServers":
{
"swagger_loader": {
"command": "swagger-mcp",
"args": ["--specUrl=<swagger/doc.json_url>"]
}
}
}演示流程
一些后端:
go install github.com/danishjsheikh/go-backend-demo@latest go-backend-demo奥拉马
ollama run llama3.2MCP 客户端
go install github.com/mark3labs/mcphost@latest mcphost -m ollama:llama3.2 --config <.mcp.json_file_path>
流程图

🛠️需要帮助
我正在致力于改进工具定义以增强:
✅更好的错误处理以获得更准确的响应
✅ LLM 行为控制,确保它仅依赖于 API 响应,而不使用自己的内存
✅ 通过强制 API 进行严格的数据检索来防止幻觉和随机数据生成
如果您对改进这些方面有任何见解或建议,请通过以下方式做出贡献:
分享类似实施的经验
建议修改工具定义
提供有关当前限制的反馈
您的意见对于提高此工具的可靠性和有效性至关重要!🚀
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for AI access to Swagger by SmartBear.
327 dev tools via REST API and MCP. Generate Dockerfiles, schemas, K8s, APIs, and more.
MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.
APIs.guru MCP — keyless directory of 2,500+ public APIs and their OpenAPI specs.
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server that provides tools for exploring and testing APIs through Swagger/OpenAPI documentation.5251 npm12MIT
- AlicenseNot gradedqualityDmaintenanceAutomatically converts REST APIs with Swagger/OpenAPI documentation into MCP tools, making any documented API accessible to MCP-compatible clients. Supports authentication, SSL handling, and flexible configuration for seamless API integration.6 npmMIT
- -licenseNot gradedqualityNot gradedmaintenanceDynamically generates MCP tools from Swagger/OpenAPI specifications by extracting swagger.json files at runtime. Enables natural language interaction with any REST API that has Swagger documentation.-
- AlicenseNot gradedqualityDmaintenanceA dynamic MCP server that automatically discovers and generates tools from any REST API using OpenAPI/Swagger specifications, enabling instant endpoint access with zero manual configuration.MIT