Converts FastAPI application OpenAPI documentation into queryable MCP tools, enabling AI assistants to efficiently explore API endpoints, models, and schemas without loading complete OpenAPI specifications
FastAPI OpenAPI MCP Server
🚀 将 FastAPI 应用的 OpenAPI 文档转换为 MCP (Model Context Protocol) Tools,让 AI 编程助手能够高效查询 API 信息,减少 Token 消耗。
📖 项目简介
FastAPI OpenAPI MCP Server 是一个用于 FastAPI 应用的 MCP 服务器实现,它能够将 OpenAPI 文档转换为一系列可查询的 Tools,让 AI 编程助手(如 Claude、GPT 等)能够:
🎯 按需查询 - 无需每次加载完整的
openapi.json
🔍 精准定位 - 通过标签、路径、关键词快速找到目标接口
📊 结构化信息 - 获取格式化的、易于理解的 API 信息
💰 节省 Token - 显著减少 AI 编程过程中的 Token 消耗
适用场景
✅ API 接口数量 > 30 个
✅ 需要 AI 辅助开发和调试
✅ 希望减少 AI 上下文 Token 消耗
✅ 需要跨项目复用 MCP 功能
✨ 核心功能
MCP Tools
// TODO
MCP Tools
// TODO
访问方式
✅ JSON-RPC 2.0 - 标准 MCP 协议
✅ Streamable HTTP - 流式 HTTP
🏗️ 架构设计
目录结构
核心组件
1. OpenApiMcpServer
2. OpenApiMcpConfig
🚀 快速开始
安装
💡 立即测试(使用 MCP Inspector)
在开发模式下,你可以立即使用 MCP Inspector 测试:
这会打开一个 Web 界面(http://localhost:5173
),让你可以:
✅ 查看所有 MCP Tools 和 Resources
✅ 交互式调用工具
✅ 实时查看返回结果
基础使用
自定义配置
工具过滤(安全)
🔧 高级功能
缓存管理
自定义 Tools
📚 API 参考
MCP Tools 详细说明
// TODO
MCP Resources 详细说明
// TODO
🤝 贡献指南
我们欢迎各种形式的贡献!
开发环境搭建
提交规范
遵循 Conventional Commits 规范:
📄 许可证
🙏 致谢
📮 联系方式
问题反馈: GitHub Issues
功能建议: GitHub Discussions
注: 本项目当前处于开发阶段,API 可能会有变动。欢迎提前试用并提供反馈!
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Converts FastAPI application OpenAPI documentation into MCP tools for AI assistants to efficiently query API information. Reduces token consumption by enabling on-demand, structured API queries instead of loading complete OpenAPI specifications.