FastMCP (standalone)
raw JSON → 3.0.2 verified Mon May 11 auth: no python install: verified quickstart: stale
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.
pip install fastmcp Common errors
error ModuleNotFoundError: No module named 'fastmcp' ↓
cause The fastmcp package is not installed in the current Python environment, or there is a conflict/confusion with the older 'mcp' package or its bundled FastMCP 1.0.
fix
Ensure fastmcp is installed in your active virtual environment using
pip install fastmcp or uv add fastmcp. If using a specific version, pin it aggressively, e.g., pip install "fastmcp>=3.0.0,<4". error TypeError: FastMCP() got an unexpected keyword argument 'ui' ↓
cause FastMCP v3.0 introduced breaking changes, removing several constructor arguments like 'ui' and 'host', 'port', or 'log_level' for the `FastMCP()` constructor.
fix
Update your code to use the new
app= parameter instead of ui=, and pass transport-related settings (like host, port, log_level) directly to the mcp.run() method or set them via environment variables. error AttributeError: 'FastMCP' object has no attribute 'settings' ↓
cause In FastMCP v3, the way to access or configure server settings changed; direct access to `mcp.settings` on the `FastMCP` instance is deprecated or no longer supported, and transport-related methods like `http_app` might have moved or been refactored.
fix
Access settings through the global
fastmcp.settings module directly (if applicable for the setting) or configure transport-related behavior via the mcp.run() method's arguments or explicit transport configurations. Ensure you are importing FastMCP directly from fastmcp and not an older SDK version. Warnings
breaking v3.0 (February 2026) is a major breaking rewrite from v2.x. Anyone not pinning fastmcp was auto-upgraded to v3.0 on pip install. Major changes: provider architecture replaces direct component registration, ctx.set_state()/ctx.get_state() are now async, StreamableHttpTransport replaces older HTTP transport classes, auth providers no longer auto-load config. ↓
fix Pin to fastmcp<3 for v2 stability while migrating. See gofastmcp.com/development/upgrade-guide for the v2→v3 upgrade guide and copyable LLM migration prompt.
breaking In v3, @mcp.tool decorator returns the original function unchanged (so decorated functions remain directly callable). In v2.x, @mcp.tool returned a FunctionTool object. Code accessing .name, .description, or other FunctionTool attributes on the decorated result will break. ↓
fix Remove any attribute access on decorated functions. Set FASTMCP_DECORATOR_MODE=object temporarily for compatibility (deprecated).
breaking Transport config (host, port) must be passed to mcp.run(), not the FastMCP() constructor. Passing them to the constructor raises TypeError. ↓
fix Replace FastMCP('server', host='0.0.0.0', port=8080) with FastMCP('server') and mcp.run(transport='http', host='0.0.0.0', port=8080).
breaking fastmcp.server.auth module (introduced v2.12.0) is explicitly exempt from semantic versioning stability guarantees and has breaking changes on minor versions. Auth API changed significantly in v3. ↓
fix Pin to an exact fastmcp version if using auth in production. Do not rely on auth API stability across minor versions.
breaking GitHub repository moved from jlowin/fastmcp to PrefectHQ/fastmcp with v3.0. Old GitHub links forward automatically. PyPI package name, import paths, and CLI commands are unchanged. ↓
fix Update bookmarks and CI checkout references from jlowin/fastmcp to PrefectHQ/fastmcp.
gotcha fastmcp includes the mcp package as a dependency — installing both separately can cause version conflicts if mcp is pinned independently. fastmcp pins its compatible mcp version internally. ↓
fix If using fastmcp, do not independently pin mcp in requirements. Let fastmcp manage the mcp dependency version.
gotcha Minor versions may contain breaking changes (explicitly documented in release policy). 'Semantic versioning is pragmatic' — do not assume minor bumps are safe without checking release notes. ↓
fix Pin to exact version in production: fastmcp==3.0.2. For development use ~=3.0 to get patches only.
gotcha fastmcp and the mcp SDK's bundled FastMCP 1.0 (from mcp.server.fastmcp) have the same class name but different behavior. Mixing imports in one project causes silent behavioral differences. ↓
fix Use only one: either 'from fastmcp import FastMCP' (standalone) or 'from mcp.server.fastmcp import FastMCP' (bundled v1). Never mix both in one project.
gotcha CVE-2026-24486 (python-multipart) and CVE-2026-0994 (protobuf) were patched in fastmcp 3.0.2. Earlier 3.x and 2.x versions are vulnerable. ↓
fix Upgrade to fastmcp>=3.0.2.
breaking fastmcp requires Python 3.10 or newer. Attempting to install fastmcp in an environment with an older Python version (e.g., Python 3.9) will result in pip being unable to find a compatible distribution. ↓
fix Upgrade your Python environment to version 3.10 or newer to install fastmcp.
breaking fastmcp v2.x (e.g., 2.14.6) depends on pydocket (e.g., 0.18.2). pydocket 0.18.2 requires `fakeredis>=2.32.1` but its internal code attempts to import `FakeConnection` from `fakeredis.aioredis`, which was removed in `fakeredis 2.32.1` and renamed to `FakeRedisConnection`. This leads to an ImportError, making fastmcp v2.x unusable with `fakeredis>=2.32.1`. ↓
fix Explicitly pin `fakeredis<2.32.1` in your requirements to ensure compatibility with pydocket in fastmcp v2.x. Alternatively, upgrade to fastmcp v3.x, which has a different dependency structure and is not affected by this issue.
Install
pip install 'fastmcp<3' pip install 'fastmcp[openai]' pip install 'fastmcp[anthropic]' Install compatibility verified last tested: 2026-05-11
python os / libc variant status wheel install import disk
3.10 alpine (musl) 'fastmcp<3' - - 7.99s 117.2M
3.10 alpine (musl) anthropic - - 10.63s 115.6M
3.10 alpine (musl) openai - - 7.35s 123.1M
3.10 alpine (musl) fastmcp - - 7.83s 107.8M
3.10 slim (glibc) 'fastmcp<3' - - 9.37s 117M
3.10 slim (glibc) anthropic - - 8.91s 115M
3.10 slim (glibc) openai - - 8.64s 122M
3.10 slim (glibc) fastmcp - - 8.29s 107M
3.11 alpine (musl) 'fastmcp<3' - - 14.26s 129.0M
3.11 alpine (musl) anthropic - - 12.08s 126.9M
3.11 alpine (musl) openai - - 11.42s 134.9M
3.11 alpine (musl) fastmcp - - 11.74s 118.7M
3.11 slim (glibc) 'fastmcp<3' - - 12.88s 129M
3.11 slim (glibc) anthropic - - 11.01s 126M
3.11 slim (glibc) openai - - 11.94s 134M
3.11 slim (glibc) fastmcp - - 11.05s 118M
3.12 alpine (musl) 'fastmcp<3' - - 11.51s 118.2M
3.12 alpine (musl) anthropic - - 10.73s 116.3M
3.12 alpine (musl) openai - - 11.13s 124.2M
3.12 alpine (musl) fastmcp - - 10.82s 108.3M
3.12 slim (glibc) 'fastmcp<3' - - 14.65s 118M
3.12 slim (glibc) anthropic - - 10.04s 116M
3.12 slim (glibc) openai - - 11.26s 123M
3.12 slim (glibc) fastmcp - - 11.73s 108M
3.13 alpine (musl) 'fastmcp<3' - - 11.85s 117.9M
3.13 alpine (musl) anthropic - - 10.66s 116.0M
3.13 alpine (musl) openai - - 9.97s 123.9M
3.13 alpine (musl) fastmcp - - 10.48s 107.9M
3.13 slim (glibc) 'fastmcp<3' - - 14.54s 118M
3.13 slim (glibc) anthropic - - 9.42s 115M
3.13 slim (glibc) openai - - 10.12s 123M
3.13 slim (glibc) fastmcp - - 11.41s 108M
3.9 alpine (musl) 'fastmcp<3' - - - -
3.9 alpine (musl) anthropic - - - -
3.9 alpine (musl) openai - - - -
3.9 alpine (musl) fastmcp - - - -
3.9 slim (glibc) 'fastmcp<3' - - - -
3.9 slim (glibc) anthropic - - - -
3.9 slim (glibc) openai - - - -
3.9 slim (glibc) fastmcp - - - -
Imports
- FastMCP (v2 and v3 — same import path) wrong
from mcp.server.fastmcp import FastMCPcorrectfrom 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 wrong
from fastmcp import FastMCPClientcorrectfrom 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})
Quickstart stale last tested: 2026-05-11
# 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