PrefectHQ/fastmcp
AI EngineeringA Python framework for building MCP servers, clients, and interactive apps that connect LLMs to tools and data.
What It Is
FastMCP is a Python framework for the Model Context Protocol, the standard that lets LLMs call tools and read data. It covers three areas: servers that expose Python functions as MCP tools, resources, and prompts; clients that connect to any local or remote MCP server; and apps that render interactive UIs inside a conversation see the pillars.
You declare a tool as a plain Python function. FastMCP generates the schema, argument validation, and docstring-based documentation, and handles transport negotiation, authentication, and protocol lifecycle when connecting to servers. That means you write business logic and let the framework manage MCP plumbing. It suits Python developers building agent-facing tools, wrapping internal APIs for LLMs, or writing MCP clients.
The project states that FastMCP 1.0 was incorporated into the official MCP Python SDK in 2024 and that the maintained standalone project is widely used across MCP servers per the README. A TypeScript counterpart, @prefecthq/fastmcp-ts, follows the same design FastMCP for TypeScript.
Quick Start
Prerequisites: Python and uv installed.
- Add the package to your project:
uv add fastmcp
- Create a server file, for example
server.py:
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()
- Run it and connect an MCP-capable client to the tool. The
addfunction is exposed with an auto-generated schema; the client sees it as anaddtool accepting two integers.
For verification, upgrades, and connecting real clients, use the installation guide and quickstart.
Usage Constraints
- Python runtime: the server and client code are Python; the TypeScript version is a separate package with its own repository.
- Version migrations: the project maintains upgrade paths from FastMCP 3, FastMCP 2, and MCP SDK v1/v2 upgrade guides. Check these before moving an existing server.
- License: Apache-2.0 LICENSE.
- Docs for agents: full documentation is published in
llms.txtformat;llms-full.txtmay exceed an LLM's context window, so it is intended as a reference rather than a default prompt input documentation. - Gateway is separate: scaling across teams, SSO, RBAC, and audit logs are provided by the commercial FastMCP Gateway from Prefect, not by this repository.
HotRepo's Take
In the recorded daily snapshots, the repository added 77 stars on 2026-07-20 and 96 on 2026-07-21, and on 2026-11-15 it reached 10th place on the Python daily list with 76 stars added that day. Those figures span different periods and languages, so they describe individual days rather than a trend. The more telling signal is structural: FastMCP supplies the server, client, and app layers of MCP rather than a single utility, and its upgrade guides cover several prior SDK generations. That breadth is what makes it a candidate foundation for tool-facing agent projects. A HN thread about Supabase Auth with FastMCP shows the practical friction is in the OAuth 2.1 handshake; one commenter spent hours getting authentication working and said the attempt improved their understanding of the flow comment. Expect auth integration, not tool declaration, to be the part that needs attention.
Written by AI from the project's README, updated . The project's own docs are the source of truth.
Hacker News
You might also like
- Shubhamsaboo/awesome-llm-appsA collection of runnable AI agent, RAG and agent-skill examples for developers learning to build LLM applications.
- mcpjungle/MCPJungleSelf-hosted gateway that registers MCP servers once and exposes their tools through a single endpoint to AI clients and agents.
- patchy631/ai-engineering-hubHands-on tutorials and runnable projects for building with LLMs, RAG pipelines, agents, and MCP integrations.
- JosssphZhou/pokiLet Claude Code, Codex, or other MCP clients drive a real iPhone from a Mac, without jailbreak or extra hardware.
- crewAIInc/crewAIA Python framework for coordinating role-based LLM agents and wrapping them in controlled, event-driven workflows.