The dominant Python framework for building MCP servers and clients. FastMCP 1.0 was incorporated into the official mcp package in 2024, but the standalone project continued evolving independently. Now maintained by Prefect (PrefectHQ/fastmcp), v3.0 shipped February 2026 as a major breaking rewrite. ~1M daily downloads. Powers ~70% of MCP servers across all languages. Critical: minor versions may contain breaking changes — pin aggressively.
Install & Compatibility
Where this runs
tested against v3.4.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.9
✕ build_error
✕ build_error
132MB installed
● package 132MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Use 'from fastmcp import FastMCP' for standalone package. 'from mcp.server.fastmcp import FastMCP' is FastMCP 1.0 bundled in the official mcp package — a different, older version.
from fastmcp import FastMCP
mcp = FastMCP('My Server')
@mcp.tool
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
mcp.run()
Client class replaces any earlier transport-specific client patterns. Handles transport negotiation automatically.
from fastmcp import Client
async with Client('http://localhost:8000/mcp') as client:
tools = await client.list_tools()
result = await client.call_tool('add', {'a': 1, 'b': 2})
Decorators derive tool name, description, and JSON schema from function signature and docstring automatically. mcp.run() defaults to stdio for local use; pass transport='http' for remote deployments.
# Server
from fastmcp import FastMCP
mcp = FastMCP('Demo')
@mcp.tool
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
@mcp.resource('data://{name}')
def get_data(name: str) -> str:
"""Fetch named data"""
return f'Data for {name}'
@mcp.prompt
def review(code: str) -> str:
return f'Review this code:\n{code}'
if __name__ == '__main__':
mcp.run() # stdio by default
# mcp.run(transport='http', host='0.0.0.0', port=8000) # remote
# ---
# Client
import asyncio
from fastmcp import Client
async def main():
async with Client('http://localhost:8000/mcp') as client:
tools = await client.list_tools()
result = await client.call_tool('add', {'a': 1, 'b': 2})
print(result)
asyncio.run(main())
# ---
# CLI usage
# fastmcp list http://localhost:8000/mcp # list tools on any server
# fastmcp call http://localhost:8000/mcp add a=1 b=2 # call a tool
# fastmcp discover # find all locally configured servers
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.