Swagger 是一种用于设计、构建、文档化和使用 RESTful API的开源工具集。它提供了一套标准化的规范(OpenAPI 规范,原称 Swagger 规范),帮助开发者更高效地开发、测试和集成 API。
http://localhost:8080/swagger-ui.html查看所有 API。call_api就是调外部APIget_all_interfaces从 OpenAPI 文档中获取所有 API 接口get_detail_interface根据描述匹配APIif__name__ =="__main__":
# Initialize and run the server
# mcp.run(transport="stdio")
mcp.run("sse")exportOPEN_API_URL=https://petstore.swagger.io/v2/swagger.json
python swagger_mcp.server.py为了方便演示,就用swagger.io官方提供的例子,经典的宠物商店API
| 欢迎光临 链载Ai (https://www.lianzai.com/) | Powered by Discuz! X3.5 |