swagger-mcp
概述
swagger-mcp
是一款用于抓取 Swagger UI 的工具,它提取swagger.json
文件,并在运行时动态生成定义明确的 mcp 工具。MCP 客户端可以利用这些工具进行进一步的工具选择。
📽️演示视频
查看展示该项目实际运行情况的演示视频:
🙌 支持
如果您发现这个项目有价值,请通过以下方式在LinkedIn上支持我:
- 👍 喜欢并分享我们的演示帖子
- 💬 在评论中留下你的想法和反馈
- 🔗 与我联系以获取未来更新
您在 LinkedIn 上的支持将帮助我接触更多人并改进项目!
先决条件
要使用swagger-mcp
,请确保您具有以下依赖项:
- LLM 模型 API 密钥/本地 LLM :需要访问 OpenAI、Claude 或 Ollama 模型。
- 任何 MCP 客户端:(使用mark3labs - mcphost )
安装和设置
按照以下步骤安装并运行swagger-mcp
:
运行配置
要直接运行swagger-mcp
,请使用:
主要旗帜:
--specUrl
:Swagger/OpenAPI JSON URL(必需)--sseMode
:以 SSE 模式运行(默认值:false,如果为 true 则作为 SSE 服务器运行,否则使用 stdio)--sseAddr
:SSE 服务器监听地址,采用 IP 或 格式(如果为空,将使用 --sseUrl 中的 IP)--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
中包含以下配置:
演示流程
- 一些后端:
- 奥拉马
- MCP 客户端
流程图
🛠️需要帮助
我正在致力于改进工具定义以增强:
✅更好的错误处理以获得更准确的响应
✅ LLM 行为控制,确保它仅依赖于 API 响应,而不使用自己的内存
✅ 通过强制 API 进行严格的数据检索来防止幻觉和随机数据生成
如果您对改进这些方面有任何见解或建议,请通过以下方式做出贡献:
- 分享类似实施的经验
- 建议修改工具定义
- 提供有关当前限制的反馈
您的意见对于提高此工具的可靠性和有效性至关重要!🚀
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
swagger-mcp 是一款用于抓取 Swagger UI 的工具,它提取 swagger.json 文件,并在运行时动态生成定义明确的 mcp 工具。MCP 客户端可以利用这些工具进行进一步的工具选择。
Related MCP Servers
- -securityFlicense-qualityA Management Control Plane server that allows users to explore and analyze Swagger/OpenAPI specifications, providing features such as endpoint exploration, schema analysis, and customizable response formatting, with support for authentication and integration with tools like Claude.Last updated 6 months ago4TypeScript
- -securityAlicense-qualityA server that enables interaction with any API that has a Swagger/OpenAPI specification through Model Context Protocol (MCP), automatically generating tools from API endpoints and supporting multiple authentication methods.Last updated 2 months ago61TypeScriptApache 2.0
- -securityAlicense-qualityAn MCP server that connects to a Swagger specification and helps an AI to build all the required models to generate a MCP server for that service.Last updated 2 months ago19TypeScriptMIT License
- -securityAlicense-qualityMCP server providing token-efficient access to OpenAPI/Swagger specs via MCP Resources for client-side exploration.Last updated 6 days ago7325TypeScriptMIT License