fastmcp README

The project's README from github.com/PrefectHQ/fastmcp. As one markdown file: README.md.

FastMCP Logo

FastMCP 🚀

Move fast and make things.

Made with 💙 by Prefect

Docs Discord PyPI - Version TypeScript Tests License

prefecthq%2Ffastmcp | Trendshift


The Model Context Protocol (MCP) connects LLMs to tools and data. FastMCP is a full MCP application framework for servers, clients, and interactive apps. A server starts with ordinary Python:

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()

Why FastMCP

Building an effective MCP application is harder than it looks. FastMCP handles all of it. Declare a tool with a Python function, and the schema, validation, and documentation are generated automatically. Connect to a server with a URL, and transport negotiation, authentication, and protocol lifecycle are managed for you. You focus on your logic, and the MCP part just works: with FastMCP, best practices are built in.

That's why FastMCP is the standard framework for working with MCP. FastMCP 1.0 was incorporated into the official MCP Python SDK in 2024. Today, the actively maintained standalone project is downloaded a million times a day, and some version of FastMCP powers 70% of MCP servers across all languages.

FastMCP has three pillars:

Servers
Servers

Expose tools, resources, and prompts to LLMs.
Apps
Apps

Give your tools interactive UIs rendered directly in the conversation.
Clients
Clients

Connect to any MCP server — local or remote, programmatic or CLI.

Servers wrap your Python functions into MCP-compliant tools, resources, and prompts. Clients connect to any server with full protocol support. And Apps give your tools interactive UIs rendered directly in the conversation.

Building in TypeScript? FastMCP for TypeScript is the official counterpart, built and maintained by the same team. Same pillars, same ideas, npm install @prefecthq/fastmcp-ts.

Ready to build? Start with the installation guide or jump straight to the quickstart.

Scale MCP with Horizon

FastMCP handles the MCP application layer. Prefect Horizon is the enterprise MCP gateway for scaling servers and tools across teams, with centralized governance over how they are deployed, discovered, secured, and used.

FastMCP and Horizon are built by the same team at Prefect.

Deploy FastMCP servers from GitHub with branch previews and instant rollback. Create a private registry of every MCP your company uses. Secure access with SSO and tool-level RBAC. Get audit logs, observability, and governance across your MCP stack. Remix approved tools into purpose-built endpoints for teams and agents.

Start with FastMCP. Scale with Horizon →

Installation

We recommend adding FastMCP to your project with uv:

uv add fastmcp

For full installation instructions, including verification and upgrading, see the Installation Guide.

Upgrading? We have guides for:

📚 Documentation

FastMCP's complete documentation is available at gofastmcp.com, including detailed guides, API references, and advanced patterns.

Documentation is also available in llms.txt format, which is a simple markdown standard that LLMs can consume easily:

Community: Join our Discord server to connect with other FastMCP developers and share what you're building.

Contributing

We welcome contributions! See the Contributing Guide for setup instructions, testing requirements, and PR guidelines.

fastmcp (PrefectHQ/fastmcp)

Searching Database…

28.1K ·GitHub
这是什么?FastMCP 是一个开源的 Python 框架,用于构建 MCP(Model Context Protocol,模型上下文协议)应用——也就是把大语言模型连接到工具和数据的那一层。它涵盖服务器、客户端和交互式应用。
那它到底是一个框架还是一个库?它是一个完整的应用框架,不是一层薄封装:服务器把你写好的 Python 函数包装成 MCP 工具、资源和提示词,客户端可以连接任何 MCP 服务器,应用则能给工具配上交互式界面,直接在对话中使用。
怎么把它加到我的项目里?README 推荐用 uv 来添加 FastMCP;gofastmcp.com 上的安装指南还涵盖安装验证、升级,以及从 FastMCP 2/3 或底层 MCP SDK 迁移的方法。
用它的话,我需要了解 MCP 协议的内部细节吗?几乎不需要:把工具声明成一个普通的 Python 函数,schema、校验和文档都会自动生成;在客户端这边,传输协商、身份认证和生命周期都替你管理好了。
这只适合 Python 开发者用吗?它面向的是用 Python 构建 MCP 集成的开发者;如果你的技术栈是 TypeScript,同一个团队也维护着 FastMCP 的 TypeScript 版本,核心功能完全相同(npm install @prefecthq/fastmcp-ts)。
它对操作系统或硬件有要求吗?没有:这是一个纯 Python 框架,用 uv 或 pip 就能安装,所以 Python 能跑的地方它就能跑;README 里没有提到任何操作系统或硬件要求。
MCP 应用(MCP App)和普通工具相比有什么不一样?普通工具只能返回文字;而 App 能直接在大语言模型的对话里渲染出交互式界面,用户可以在聊天中直接操作你的界面,而不用去碰终端。
既然有官方的 MCP Python SDK,FastMCP 和它是什么关系?FastMCP 1.0 在 2024 年被合并进了官方 SDK,但这个独立项目才是持续活跃维护的版本——每天下载量约一百万次,而且各语言的所有 MCP 服务器中,有 70% 用的是它的某个版本。
Prefect Horizon 是什么?用 FastMCP 必须要有它吗?不需要——Horizon 是同一个团队推出的可选企业级网关,用于在公司规模上治理 MCP:提供私有注册表、SSO、工具级 RBAC 和审计日志。你先用 FastMCP,等需要在多个团队间大规模推广时再考虑 Horizon。
文档在哪里?我的大语言模型也能读吗?完整的文档在 gofastmcp.com——包括指南、API 参考和高级用法——另外还有 llms.txt(所有文档页面的站点地图)和 llms-full.txt(全部文档内容,可能会超出你大语言模型的上下文窗口)。
Creator
PrefectHQ
Size
59.1 MB
Stars
28.1K
Age
1y
Commits · 90 Days