🚀 FastMCP:25k Stars 的 MCP 服务器框架,70% 的 MCP 服务器都靠它跑 / FastMCP: 25k Stars — the Pythonic MCP Framework Powering 70% of MCP Servers
项目地址:https://github.com/PrefectHQ/fastmcp | ⭐ 25,184 | 🛠 Python | 作者:Prefect
老实说,自从 MCP 协议火起来后,我试过好几种方式写 MCP Server。要么手动拼 JSON Schema 累死,要么官方 SDK 一堆样板代码。FastMCP 解决了这个问题——它现在是下载量百万/天的 MCP 框架,70% 的 MCP 服务器都基于它。Prefect 出品,业内标准。
To be honest, I tried several ways to write MCP servers after the protocol took off. Either manually stitching JSON Schema, or dealing with boilerplate from the official SDK. FastMCP solves this — a million downloads a day, powering 70% of MCP servers across all languages. Made by Prefect, it's become the standard.
⚡ 5 行代码写一个 MCP Server
FastMCP 的思路极其粗暴:你的 Python 函数加个装饰器,自动变成 MCP Tool。
from fastmcp import FastMCP
mcp = FastMCP("Demo")
@mcp.tool
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
if __name__ == "__main__":
mcp.run()
Schema、验证、文档全部自动生成。mcp.run() 启动后,任何 MCP Client(Claude Code、Cursor、VS Code 插件)都能直接调用你的工具。
FastMCP's approach is brutally simple: decorate your Python function, it becomes an MCP Tool. Schema, validation, documentation — all auto-generated.
# 安装
uv pip install fastmcp
# 运行
python demo.py
# 默认启动在 stdio 传输,Claude Code 可以直接连
🎯 三大支柱:Servers + Clients + Apps
FastMCP 不止能写 Server,还包了 Client 和 UI:
Servers — 暴露 Tools、Resources、Prompts 给 LLM。一个装饰器搞定,Type hints 自动推导参数类型。
Clients — 连接任意 MCP Server,本地或远程都行。支持 transport 协商、认证、协议生命周期管理。
Apps — 给工具加交互 UI,直接在对话里渲染。不用自己写前端。
Three pillars: Servers expose tools/resources/prompts to LLMs, Clients connect to any MCP server, Apps give tools interactive UIs rendered in the conversation.
📋 一句话总结
- FastMCP 是 MCP 生态的事实标准框架,25k Stars,70% 市占率
uv pip install fastmcp+ 装饰器 = 你的第一个 MCP Server- 支持 Servers / Clients / Apps 三件套,一个库搞定全部
- Prefect 出品,有 Horizon 企业版托管方案
- The de facto standard MCP framework with 25k Stars and 70% market share
uv pip install fastmcp+ decorator = your first MCP server- Servers, Clients, and Apps — one library covers everything
- Built by Prefect, with Horizon for enterprise deployment
标签:#MCP #FastMCP #AI #Agent #Python #Prefect #ModelContextProtocol