# 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. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use ```bash uv pip install fastmcp cat > server.py <<'PY' from fastmcp import FastMCP mcp = FastMCP("Demo") @mcp.tool def add(a: int, b: int) -> int: return a + b if __name__ == "__main__": mcp.run() PY python server.py ``` ## Intro FastMCP is a Python framework for building MCP servers/clients with generated schemas and lifecycle handling. Verified 25154★; pushed 2026-05-13. **Best for:** Python teams who want a structured way to ship MCP servers with fewer protocol edge cases **Works with:** Python 3.x; uv/pip installs; integrates with MCP clients (per docs/README links) **Setup time:** 5-12 minutes ### Key facts (verified) - GitHub: 25154 stars · 2010 forks · pushed 2026-05-13. - License: Apache-2.0 · owner avatar + repo URL verified via GitHub API. - README-backed entrypoint: `from fastmcp import FastMCP; mcp.run()`. ## Main - Start from the minimal server example, then move each tool into small, testable Python functions with clear docstrings. - Keep tool contracts stable: treat schemas and return types as an API, and version changes in your MCP server like any other service. - Add production concerns early (timeouts, rate limits, auth) and keep a staging server to validate client compatibility. - Use the project docs links for server/client/app patterns instead of inventing protocol glue by hand. ### README (excerpt)
FastMCP Logo **FastMCP 🚀** Move fast and make things. *Made with 💙 by [Prefect](https://www.prefect.io/)* [![Docs](https://img.shields.io/badge/docs-gofastmcp.com-blue)](https://gofastmcp.com) [![Discord](https://img.shields.io/badge/community-discord-5865F2?logo=discord&logoColor=white)](https://discord.gg/uu8dJCgttd) [![PyPI - Version](https://img.shields.io/pypi/v/fastmcp.svg)](https://pypi.org/project/fastmcp) [![Tests](https://github.com/PrefectHQ/fastmcp/actions/workflows/run-tests.yml/badge.svg)](https://github.com/PrefectHQ/fastmcp/actions/workflows/run-tests.yml) [![License](https://img.shields.io/github/license/PrefectHQ/fastmcp.svg)](https://github.com/PrefectHQ/fastmcp/blob/main/LICENSE) prefecthq%2Ffastmcp | Trendshift
--- The [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) connects LLMs to tools and data. FastMCP gives you everything you need to go from prototype to production: ```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.** ### Source-backed notes - README shows a minimal server using `FastMCP("Demo")`, a `@mcp.tool` function, and `mcp.run()`. - README recommends installing via `uv pip install fastmcp` and links to a dedicated docs site. - Project description frames FastMCP as a higher-level way to build MCP servers/clients without manual schema wiring. ### FAQ - **Is FastMCP a server or a client?**: README describes both server and client patterns; start by building a server first. - **Do I need uv?**: README recommends uv, but pip-based installs are also common for Python libraries. - **How do I keep tool behavior predictable?**: Treat tool schemas as an API contract, add tests, and version breaking changes. ## Source & Thanks > Created by [PrefectHQ](https://github.com/PrefectHQ). Licensed under Apache-2.0. > > [PrefectHQ/fastmcp](https://github.com/PrefectHQ/fastmcp) — ⭐ 25154 Thanks to the upstream maintainers and contributors for publishing this work under an open license. --- ## Quick Use ```bash uv pip install fastmcp cat > server.py <<'PY' from fastmcp import FastMCP mcp = FastMCP("Demo") @mcp.tool def add(a: int, b: int) -> int: return a + b if __name__ == "__main__": mcp.run() PY python server.py ``` ## Intro 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](https://www.prefect.io/)* [![Docs](https://img.shields.io/badge/docs-gofastmcp.com-blue)](https://gofastmcp.com) [![Discord](https://img.shields.io/badge/community-discord-5865F2?logo=discord&logoColor=white)](https://discord.gg/uu8dJCgttd) [![PyPI - Version](https://img.shields.io/pypi/v/fastmcp.svg)](https://pypi.org/project/fastmcp) [![Tests](https://github.com/PrefectHQ/fastmcp/actions/workflows/run-tests.yml/badge.svg)](https://github.com/PrefectHQ/fastmcp/actions/workflows/run-tests.yml) [![License](https://img.shields.io/github/license/PrefectHQ/fastmcp.svg)](https://github.com/PrefectHQ/fastmcp/blob/main/LICENSE) prefecthq%2Ffastmcp | Trendshift
--- The [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) connects LLMs to tools and data. FastMCP gives you everything you need to go from prototype to production: ```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.** ### 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 当作契约,加测试,并对破坏性改动做版本化发布。 ## Source & Thanks > Created by [PrefectHQ](https://github.com/PrefectHQ). Licensed under Apache-2.0. > > [PrefectHQ/fastmcp](https://github.com/PrefectHQ/fastmcp) — ⭐ 25154 --- Source: https://tokrepo.com/en/workflows/fastmcp-python-framework-for-mcp-servers Author: MCP Hub