登录 注册
AI 模型与开发框架AI 应用与 AI Agent安全与隐私工具 aiauthenticationauthorizationclaudecursorfastapi
12,030
Stars
965
Forks
92
Watchers
175
Open Issues
MIT
许可证
Python
语言
2025-03-08
创建时间
2025-11-24
最近更新

项目能做什么

将 FastAPI 端点直接转换为 MCP(模型上下文协议)工具,并支持鉴权。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
<p align="center"><a href="https://github.com/tadata-org/fastapi_mcp"><img src="https://github.com/user-attachments/assets/7e44e98b-a0ba-4aff-a68a-4ffee3a6189c" alt="fastapi-to-mcp" height=100/></a></p>

<div align="center">
  <span style="font-size: 0.85em; font-weight: normal;">Built by <a href="https://tadata.com">Tadata</a></span>
</div>

<h1 align="center">
  FastAPI-MCP
</h1>

<div align="center">
<a href="https://trendshift.io/repositories/14064" target="_blank"><img src="https://trendshift.io/api/badge/repositories/14064" alt="tadata-org%2Ffastapi_mcp | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
</div>

<p align="center">Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!</p>
<div align="center">

[![PyPI version](https://img.shields.io/pypi/v/fastapi-mcp?color=%2334D058&label=pypi%20package)](https://pypi.org/project/fastapi-mcp/)
[![Python Versions](https://img.shields.io/pypi/pyversions/fastapi-mcp.svg)](https://pypi.org/project/fastapi-mcp/)
[![FastAPI](https://img.shields.io/badge/FastAPI-009485.svg?logo=fastapi&logoColor=white)](#)
[![CI](https://github.com/tadata-org/fastapi_mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/tadata-org/fastapi_mcp/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/tadata-org/fastapi_mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/tadata-org/fastapi_mcp)

</div>


<p align="center"><a href="https://github.com/tadata-org/fastapi_mcp"><img src="https://github.com/user-attachments/assets/b205adc6-28c0-4e3c-a68b-9c1a80eb7d0c" alt="fastapi-mcp-usage" height="400"/></a></p>


## 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](https://tadata.com).

## Installation

We recommend using [uv](https://docs.astral.sh/uv/), a fast Python package installer:

```bash
uv add fastapi-mcp
```

Alternatively, you can install with pip:

```bash
pip install fastapi-mcp
```

## Basic Usage

The simplest way to use FastAPI-MCP is to add an MCP server directly to your FastAPI application:

```python
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 doc
阅读完整原文

商业机会分析 AI 生成

MCP 安全与审计网关(SaaS / 独立轻量中间件)

产品构想针对使用 fastapi-mcp 暴露的生产级接口,提供一层专门面向 LLM/Agent 调用的安全网关,增加 Prompt 注入防御、数据脱敏、人工审批流(Human-in-the-loop)和调用链日志。
核心功能写操作二级审批机制、敏感字段自动脱敏(PII Masking)、Token/调用频率按 Agent/用户配额限制、审计日志导出。
目标用户将核心业务 API 暴露给 AI Agent 调用的技术团队、企业安全合规负责人。
难度/周期中等 · 3 - 5 周 · 成本:极低(主要是服务器部署与鉴权代理开发,无重度算力依赖)
收费模式按受保护 API 数量或按月调用请求量计费的订阅制 SaaS / 商业私有部署 License。
竞争风险FastAPI 原生安全组件成熟,部分开发者倾向于用现有网关(如 Kong/APISIX)扩展替代。
依据 已验证事实

垂直行业/常用 SaaS 的即插即用 FastAPI-MCP 模板与插件包

产品构想预先封装针对常用服务(如 Stripe、HubSpot、Jira、企业内部数据库 CRUD)的 FastAPI-MCP 开箱即用套件,附带完整的角色权限模型和一键部署脚本。
核心功能开箱即用的预集成业务模板、多租户 Auth 模板、前端可视化管理面板、一键 Docker 部署配置。
目标用户快速为团队配置 Cursor/Windsurf 自动化运维、销售跟进等工具的独立开发者与中小团队。
难度/周期较低 · 1 - 2 周 · 成本:微量(主要是文档与模板维护成本)
收费模式数字资产销售(Gumroad 购买模板源码)或赞助者专享高级模板仓库。
竞争风险生命周期较短,易被开源社区仿制或随 MCP 官方生态扩充而被稀释价值。
依据 AI推测

面向开发团队的 MCP 权限与调试可视化控制台

产品构想提供一个配套的前端管理面板,直观查看所有挂载的 FastAPI-MCP 工具列表,支持在 Web 端以不同用户角色实时调试 MCP 工具并配置哪些 endpoint 允许暴露给 AI。
核心功能UI 界面动态启停/隐藏特定 MCP Tools、模拟 MCP Client 联调协议数据、基于角色的 Endpoint 访问矩阵控制。
目标用户在团队内部统一管理多个 FastAPI-MCP 服务配置的 Tech Lead 与后端开发人员。
难度/周期中等 · 2 - 4 周 · 成本:低(前后端轻量开发,轻量云服务器运行 Demo)
收费模式基础开源 + 团队版高级功能(团队成员多租户协作、SSO、审计导出)收费。
竞争风险官方商业公司 Tadata 自身已有云端托管方案(tadata.com),同质化产品可能面临直接竞争。
依据 数据支持的判断
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
morluto/rea 中文介绍暂未生成
Reverse engineer anything with agents, from app behavior dow
452,138 TypeScript
openclaw/openclaw 中文介绍暂未生成
The AI that really does things. Any OS. Any Platform. The lo
394,346 TypeScript
obra/superpowers 中文介绍暂未生成
An agentic skills framework & software development methodolo
316,145 Shell
NousResearch/hermes-agent 中文介绍暂未生成
The agent that grows with you
262,670 Python
n8n-io/n8n 中文介绍暂未生成
Fair-code workflow automation platform with native AI capabi
210,157 TypeScript
firecrawl/firecrawl 中文介绍暂未生成
Supercharge your AI agents with data from the web and beyond
200,859 TypeScript
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建于 2025-03-08,最近推送 2025-11-24,发布过 10 个 Release
社区活跃Star 12,030 / Fork 965 / Issue 175(数据支持,可自行核实)
许可证MIT
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

快速开始(以仓库 README 为准)
git clone https://github.com/tadata-org/fastapi_mcp.git
cd fastapi_mcp
# 请阅读仓库 README 获取确切安装步骤(依赖、配置、启动命令)
阅读原仓库文档
术语说明:Docker=应用容器(把程序和依赖打包运行);API Key=调用外部服务的密钥;Git Clone=把仓库代码下载到本地。常见错误:API Key 未配置 / 端口占用 / 数据库连接失败,多数项目在 README 的 Troubleshooting 章节有说明。