{"id":20,"library":"fastmcp","title":"FastMCP (standalone)","description":"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.","status":"active","version":"3.0.2","language":"python","source_language":"en","source_url":"https://github.com/PrefectHQ/fastmcp","tags":["mcp","model-context-protocol","tools","agents","servers","python","protocol"],"install":[{"cmd":"pip install fastmcp","lang":"bash","label":"Python (latest — v3.x)"},{"cmd":"pip install 'fastmcp<3'","lang":"bash","label":"Python (pin to v2.x — use if upgrading from v2 not yet complete)"},{"cmd":"pip install 'fastmcp[openai]'","lang":"bash","label":"Python with OpenAI client integration"},{"cmd":"pip install 'fastmcp[anthropic]'","lang":"bash","label":"Python with Anthropic client integration"}],"dependencies":[{"reason":"Official MCP SDK bundled as a dependency. fastmcp includes mcp — no need to install separately.","package":"mcp","optional":false},{"reason":"HTTP client for streamable-http transport. Pinned <1.0 in fastmcp.","package":"httpx","optional":false},{"reason":"Schema generation from type hints for tool input/output validation.","package":"pydantic","optional":false}],"imports":[{"note":"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.","wrong":"from mcp.server.fastmcp import FastMCP","symbol":"FastMCP (v2 and v3 — same import path)","correct":"from fastmcp import FastMCP\n\nmcp = FastMCP('My Server')\n\n@mcp.tool\ndef add(a: int, b: int) -> int:\n    \"\"\"Add two numbers\"\"\"\n    return a + b\n\nmcp.run()"},{"note":"Client class replaces any earlier transport-specific client patterns. Handles transport negotiation automatically.","wrong":"from fastmcp import FastMCPClient","symbol":"Client","correct":"from fastmcp import Client\n\nasync with Client('http://localhost:8000/mcp') as client:\n    tools = await client.list_tools()\n    result = await client.call_tool('add', {'a': 1, 'b': 2})"}],"quickstart":{"code":"# Server\nfrom fastmcp import FastMCP\n\nmcp = FastMCP('Demo')\n\n@mcp.tool\ndef add(a: int, b: int) -> int:\n    \"\"\"Add two numbers\"\"\"\n    return a + b\n\n@mcp.resource('data://{name}')\ndef get_data(name: str) -> str:\n    \"\"\"Fetch named data\"\"\"\n    return f'Data for {name}'\n\n@mcp.prompt\ndef review(code: str) -> str:\n    return f'Review this code:\\n{code}'\n\nif __name__ == '__main__':\n    mcp.run()  # stdio by default\n    # mcp.run(transport='http', host='0.0.0.0', port=8000)  # remote\n\n# ---\n\n# Client\nimport asyncio\nfrom fastmcp import Client\n\nasync def main():\n    async with Client('http://localhost:8000/mcp') as client:\n        tools = await client.list_tools()\n        result = await client.call_tool('add', {'a': 1, 'b': 2})\n        print(result)\n\nasyncio.run(main())\n\n# ---\n\n# CLI usage\n# fastmcp list http://localhost:8000/mcp     # list tools on any server\n# fastmcp call http://localhost:8000/mcp add a=1 b=2  # call a tool\n# fastmcp discover                            # find all locally configured servers","lang":"python","description":"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."},"warnings":[{"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.","message":"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.","severity":"breaking","affected_versions":"v2.x code migrating to v3"},{"fix":"Remove any attribute access on decorated functions. Set FASTMCP_DECORATOR_MODE=object temporarily for compatibility (deprecated).","message":"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.","severity":"breaking","affected_versions":"v2.x → v3 migration"},{"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).","message":"Transport config (host, port) must be passed to mcp.run(), not the FastMCP() constructor. Passing them to the constructor raises TypeError.","severity":"breaking","affected_versions":"v2+ (enforced strictly in v3)"},{"fix":"Pin to an exact fastmcp version if using auth in production. Do not rely on auth API stability across minor versions.","message":"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.","severity":"breaking","affected_versions":"v2.12+ auth users"},{"fix":"Update bookmarks and CI checkout references from jlowin/fastmcp to PrefectHQ/fastmcp.","message":"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.","severity":"breaking","affected_versions":"v3.0+"},{"fix":"If using fastmcp, do not independently pin mcp in requirements. Let fastmcp manage the mcp dependency version.","message":"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.","severity":"gotcha","affected_versions":"all"},{"fix":"Pin to exact version in production: fastmcp==3.0.2. For development use ~=3.0 to get patches only.","message":"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.","severity":"gotcha","affected_versions":"all"},{"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.","message":"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.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to fastmcp>=3.0.2.","message":"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.","severity":"gotcha","affected_versions":"<3.0.2"},{"fix":"Upgrade your Python environment to version 3.10 or newer to install fastmcp.","message":"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.","severity":"breaking","affected_versions":"all"},{"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.","message":"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`.","severity":"breaking","affected_versions":"fastmcp v2.x (specifically when using pydocket versions incompatible with fakeredis>=2.32.1, like pydocket-0.18.2)"}],"env_vars":{"optional":[{"name":"FASTMCP_DECORATOR_MODE","note":"Set to 'object' to restore v2.x decorator behavior where @mcp.tool returns a FunctionTool object instead of the original function. Compatibility shim — deprecated, will be removed."}],"required":[]},"last_verified":"2026-05-11T19:14:03.467Z","next_check":"2026-04-01T00:00:00.000Z","problems":[{"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\"`.","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.","error":"ModuleNotFoundError: No module named 'fastmcp'"},{"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.","cause":"FastMCP v3.0 introduced breaking changes, removing several constructor arguments like 'ui' and 'host', 'port', or 'log_level' for the `FastMCP()` constructor.","error":"TypeError: FastMCP() got an unexpected keyword argument 'ui'"},{"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.","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.","error":"AttributeError: 'FastMCP' object has no attribute 'settings'"}],"ecosystem":"pypi","meta_description":null,"install_score":85,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"install_checks":{"last_tested":"2026-05-11","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":7.99,"mem_mb":48.8,"disk_size":"117.2M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"anthropic","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":10.63,"mem_mb":41.8,"disk_size":"115.6M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"openai","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":7.35,"mem_mb":41.8,"disk_size":"123.1M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":7.83,"mem_mb":41.8,"disk_size":"107.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":9.37,"mem_mb":49.3,"disk_size":"117M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"anthropic","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":8.91,"mem_mb":41.8,"disk_size":"115M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"openai","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":8.64,"mem_mb":41.8,"disk_size":"122M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":8.29,"mem_mb":41.8,"disk_size":"107M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":14.26,"mem_mb":52.9,"disk_size":"129.0M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"anthropic","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":12.08,"mem_mb":44.1,"disk_size":"126.9M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"openai","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.42,"mem_mb":44.1,"disk_size":"134.9M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.74,"mem_mb":44,"disk_size":"118.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":12.88,"mem_mb":52.9,"disk_size":"129M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"anthropic","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.01,"mem_mb":44.1,"disk_size":"126M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"openai","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.94,"mem_mb":44.1,"disk_size":"134M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.05,"mem_mb":44,"disk_size":"118M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.51,"mem_mb":51.5,"disk_size":"118.2M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"anthropic","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":10.73,"mem_mb":43.8,"disk_size":"116.3M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"openai","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.13,"mem_mb":43.8,"disk_size":"124.2M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":10.82,"mem_mb":43.8,"disk_size":"108.3M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":14.65,"mem_mb":51.5,"disk_size":"118M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"anthropic","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":10.04,"mem_mb":43.8,"disk_size":"116M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"openai","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.26,"mem_mb":43.8,"disk_size":"123M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.73,"mem_mb":43.8,"disk_size":"108M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.85,"mem_mb":53,"disk_size":"117.9M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"anthropic","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":10.66,"mem_mb":45.3,"disk_size":"116.0M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"openai","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":9.97,"mem_mb":45.3,"disk_size":"123.9M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":10.48,"mem_mb":45.3,"disk_size":"107.9M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":14.54,"mem_mb":53,"disk_size":"118M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"anthropic","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":9.42,"mem_mb":45.3,"disk_size":"115M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"openai","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":10.12,"mem_mb":45.3,"disk_size":"123M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":11.41,"mem_mb":45.3,"disk_size":"108M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"anthropic","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"openai","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"anthropic","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"openai","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null}]},"quickstart_checks":{"last_tested":"2026-05-11","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}