MCP Configs2026年5月14日·1 分钟阅读

FastMCP — Python Framework for MCP Servers

FastMCP is a Python framework for building MCP servers/clients with generated schemas and lifecycle handling. Verified 25154★; pushed 2026-05-13.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 94/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Mcp
安装
Uv|Pip
信任
信任等级:Established
入口
from fastmcp import FastMCP; mcp.run()
通用 CLI 安装命令
npx tokrepo install 4c9dd8ef-7adc-5835-bb5a-2a2ccb2fda88
介绍

FastMCP 是用于构建 MCP server/client 的 Python 框架,包含工具封装、schema 生成与传输生命周期管理;已验证 25154★,更新于 2026-05-13。

Best for: 想用 Python 快速落地 MCP server,并降低协议细节踩坑的团队

Works with: Python 3.x;uv/pip 安装;面向 MCP client 的 server/client 侧开发(见 README)

Setup time: 5-12 minutes

Key facts (verified)

  • GitHub:25154 stars · 2010 forks;最近更新 2026-05-13。
  • 许可证:Apache-2.0;作者头像与仓库链接均已通过 GitHub API 复核。
  • README 中可对照的入口:from fastmcp import FastMCP; mcp.run()

Main

  • 先从 README 的最小 server 示例跑通,再把每个工具拆成可测试、带清晰 docstring 的 Python 函数。

  • 把工具的 schema/返回值当作 API:保持契约稳定,对破坏性变更做版本化管理。

  • 尽早补齐生产化要素(超时、限流、鉴权),并准备一个 staging 环境复核不同 MCP 客户端的兼容性。

  • 优先按文档里的 server/client/app 模式扩展,不要手写一堆协议胶水。

README (excerpt)

FastMCP Logo

FastMCP 🚀

Move fast and make things.

Made with 💙 by Prefect

Docs Discord PyPI - Version Tests License

prefecthq%2Ffastmcp | Trendshift


The Model Context Protocol (MCP) connects LLMs to tools and data. FastMCP gives you everything you need to go from prototype to production:

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.

Source-backed notes

  • README 给出最小 server 示例:FastMCP("Demo")@mcp.tool、以及 mcp.run() 启动。
  • README 推荐用 uv pip install fastmcp 安装,并链接到独立文档站点。
  • README 描述 FastMCP 用于抽象 MCP 的 schema/生命周期细节,减少手写协议逻辑。

FAQ

  • FastMCP 是 server 还是 client?:README 同时提到 server/client 模式;建议先从 server 落地开始。
  • 必须用 uv 吗?:README 推荐 uv;但作为 Python 依赖也可以按团队习惯使用 pip/虚拟环境。
  • 怎么保证工具行为可预测?:把 schema 当作契约,加测试,并对破坏性改动做版本化发布。
🙏

来源与感谢

Created by PrefectHQ. Licensed under Apache-2.0.

PrefectHQ/fastmcp — ⭐ 25154

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产