FastAPI-MCP
特征
内置身份验证,使用您现有的 FastAPI 依赖项!
**FastAPI-native:**不仅仅是另一个 OpenAPI -> MCP 转换器
无需/只需极少配置- 只需将其指向您的 FastAPI 应用程序即可运行
保留请求模型和响应模型的模式
保存所有端点的文档,就像在 Swagger 中一样
灵活部署- 将您的 MCP 服务器安装到同一应用程序,或单独部署
ASGI 传输- 直接使用 FastAPI 的 ASGI 接口进行高效通信
Related MCP server: FastAPI-MCP
安装
我们建议使用uv ,一个快速的 Python 包安装程序:
uv add fastapi-mcp或者,您可以使用 pip 安装:
pip install fastapi-mcp基本用法
使用 FastAPI-MCP 最简单的方法是将 MCP 服务器直接添加到你的 FastAPI 应用程序中:
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()就这样!您自动生成的 MCP 服务器现在可以在https://app.base.url/mcp上使用。
文档、示例和高级用法
FastAPI-MCP 提供了详尽的文档。此外,您还可以查看示例目录,获取演示这些功能的代码示例。
FastAPI 优先方法
FastAPI-MCP 被设计为 FastAPI 的原生扩展,而不仅仅是一个从 API 生成 MCP 工具的转换器。这种方法有几个关键优势:
本机依赖项:使用熟悉的 FastAPI
Depends()进行身份验证和授权,保护您的 MCP 端点ASGI 传输:使用其 ASGI 接口直接与您的 FastAPI 应用通信,无需从 MCP 向您的 API 进行 HTTP 调用
统一的基础架构:您的 FastAPI 应用无需与 MCP 服务器单独运行(尽管也支持单独部署)
这种设计理念可确保在向现有 FastAPI 服务添加 MCP 功能时产生最小的摩擦。
开发与贡献
感谢您考虑为 FastAPI-MCP 做出贡献!我们鼓励社区发布问题 (Issues) 并创建拉取请求 (Pull Request)。
在开始之前,请参阅我们的贡献指南。
社区
加入MCParty Slack 社区与其他 MCP 爱好者联系、提出问题并分享您使用 FastAPI-MCP 的经验。
要求
Python 3.10+(推荐3.12)
紫外线
执照
MIT 许可证。版权所有 (c) 2024 Tadata Inc.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
The OpenRouter for tools. One MCP connection gives any AI agent 254 hosted tools, pay per call.
One MCP endpoint for Claude, GPT & Gemini: 100+ tools + no-code connectors + agent workers.
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
Hosted MCP endpoint with realistic fake data for prototyping agents. 12 tools, no setup.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA zero-configuration tool that automatically converts FastAPI endpoints into Model Context Protocol (MCP) tools, enabling AI systems to interact with your API through natural language.2MIT
- AlicenseNot gradedqualityDmaintenanceExposes FastAPI endpoints as Model Context Protocol (MCP) tools while preserving existing authentication, schemas, and documentation. It enables seamless integration of FastAPI services into MCP ecosystems using a native ASGI transport layer.MIT
- AlicenseAqualityCmaintenanceTurn any OpenAPI spec into MCP tools for Claude — instantly. Point mcp-openapi at any OpenAPI 3.x spec and Claude can call every endpoint through natural language. No custom integration code. No manual tool definitions. One line of config.2681MIT
- FlicenseNot gradedqualityDmaintenanceConverts any REST API endpoints into MCP tools, enabling AI clients like Cursor and Claude Desktop to call internal services directly.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tadata-org/fastapi_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server