fastapi_mcp
Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!
- 评测生成时间(北京时间)
- 本报告引擎
- v3.10.0
- 当前引擎
- v3.16.0
本报告与当前引擎使用不同规则;原分数不会自动更新,不同版本的分数不宜直接对比。
进入后确认来源与额度,提交才会创建任务。
综合采用结论
核心能力可用,建议在受控范围内试用
- 基础评测完成+25/25确定性评分与静态安全扫描已完成
- README 有效证据+9/253,573 个去重后的有效字符
- 独立证据来源+8/202 类非重复证据,重复文件不叠加
- 仓库元数据+10/10已取得仓库状态与采用数据
- 活跃记录+5/5已取得最近提交时间
- AI 复核+15/15已完成结构化 AI 证据复核
FastAPI-MCP挂载与调用流程
README展示了客户端通过MCP服务器调用FastAPI端点,涉及请求和响应,适合sequence图。
左右滑动查看完整图示
- • ASGI transport: Communicates directly with your FastAPI app using its ASGI interface
- • mcp.mount() 挂载MCP服务器
- • Expose your FastAPI endpoints as MCP tools
- Features: Authentication built in, using your existing FastAPI dependencies
- Basic Usage: mcp.mount() 后自动生成MCP服务器
- Installation: uv add fastapi-mcp 或 pip install fastapi-mcp
- Requirements: Python 3.10+, uv
- License: MIT License
- 问题与用途描述
- 有效 README
- 安装或接入步骤
- 可执行示例
- 未发现已知高风险模式
- 设计分因边界与失败处理证据缺失,由 13 校准为 12
- 缺少限制、权限或边界
- 缺少错误处理或排障
- 缺少限制、权限或边界说明
- 缺少错误处理或排障指南
已有FastAPI应用需快速暴露MCP工具、需要利用现有认证依赖的开发者、希望保留API文档和模型的团队、偏好零配置集成的场景
需要详细错误处理文档的场景、需要离线或完整文档的环境
也有自己的公开项目?先看完证据,再用当前规则生成独立报告。
评测我的项目 →静态扫描不是安全保证,生产接入前仍应人工复核权限和数据边界。
- 01补充限制、权限或边界
- 02补充错误处理或排障
方法、证据与局限展开收起
GitHub Repository API
2 个文件 · 6,717 字符
v3.10.0 · AI 复核已启用(deepseek-chat)
- 静态评测不会安装或执行项目代码
- 安全扫描基于高信号文件与已知模式,不能替代人工审计
- 流行度只反映采用程度,不代表安全或工程质量
30 天热度趋势
README
FastAPI-MCP
Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!
Features
-
Authentication built in, using your existing FastAPI dependencies!
-
FastAPI-native: Not just another OpenAPI -> MCP converter
-
Zero/Minimal configuration required - just point it at your FastAPI app and it works
-
Preserving schemas of your request models and response models
-
Preserve documentation of all your endpoints, just as it is in Swagger
-
Flexible deployment - Mount your MCP server to the same app, or deploy separately
-
ASGI transport - Uses FastAPI's ASGI interface directly for efficient communication
Hosted Solution
If you prefer a managed hosted solution check out tadata.com.
Installation
We recommend using uv, a fast Python package installer:
uv add fastapi-mcp
Alternatively, you can install with pip:
pip install fastapi-mcp
Basic Usage
The simplest way to use FastAPI-MCP is to add an MCP server directly to your FastAPI application:
from fastapi import FastAPI
from fastapi_mcp import FastApiMCP
app = FastAPI()
mcp = FastApiMCP(app)
# Mount the MCP server directly to your FastAPI app
mcp.mount()
That's it! Your auto-generated MCP server is now available at https://app.base.url/mcp.
Documentation, Examples and Advanced Usage
FastAPI-MCP provides comprehensive documentation. Additionaly, check out the examples directory for code samples demonstrating these features in action.
FastAPI-first Approach
FastAPI-MCP is designed as a native extension of FastAPI, not just a converter that generates MCP tools from your API. This approach offers several key advantages:
-
Native dependencies: Secure your MCP endpoints using familiar FastAPI
Depends()for authentication and authorization -
ASGI transport: Communicates directly with your FastAPI app using its ASGI interface, eliminating the need for HTTP calls from the MCP to your API
-
Unified infrastructure: Your FastAPI app doesn't need to run separately from the MCP server (though separate deployment is also supported)
This design philosophy ensures minimum friction when adding MCP capabilities to your existing FastAPI services.
Development and Contributing
Thank you for considering contributing to FastAPI-MCP! We encourage the community to post Issues and create Pull Requests.
Before you get started, please see our Contribution Guide.
Community
Join MCParty Slack community to connect with other MCP enthusiasts, ask questions, and share your experiences with FastAPI-MCP.
Requirements
- Python 3.10+ (Recommended 3.12)
- uv
License
MIT License. Copyright (c) 2025 Tadata Inc.