Remote OpenClaw Blog
FastMCP: The Python Framework for Building MCP Servers
7 min read ·
FastMCP is the Python framework for building MCP servers and clients, letting you turn any Python function into an AI-accessible tool with a single decorator. As of July 2026 the project sits at version 3.4.3 with 26,000 GitHub stars, its 1.0 API is what ships inside the official MCP Python SDK, and its maintainers report that it powers a large majority of MCP servers in the wild.
What Is FastMCP?
FastMCP is an open source Python framework, created by Jeremiah Lowin, that describes itself as "the fast, Pythonic way to build MCP servers and clients." The Model Context Protocol (MCP) is the open standard Anthropic released in November 2024 for connecting AI agents to tools and data; FastMCP removes the protocol boilerplate so you write plain Python functions and decorators instead of hand-rolling JSON schemas and transport code.
The project's history matters for anyone confused by version numbers. FastMCP 1.0 was donated into the official MCP Python SDK in 2024, which is why the official SDK exposes a FastMCP class. The standalone project at gofastmcp.com kept evolving through 2.x into today's 3.x line, and is licensed Apache-2.0.
If you want to see what people build with it, our MCP server directory tracks thousands of servers, and a large share of the Python ones are FastMCP under the hood.
How to Install FastMCP
FastMCP installs from PyPI with one command, and the docs recommend the uv package manager. As of July 2026 the current release is v3.4.3, published July 5, 2026.
uv pip install fastmcp
# or with plain pip
pip install fastmcp
Installing the package also gives you the fastmcp CLI, which you will use to run and inspect servers.
A Minimal FastMCP Server
A working FastMCP server is six lines of Python: create a FastMCP instance, decorate a function with @mcp.tool, and call run(). This example comes straight from the project README.
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 directly with python server.py, or through the CLI:
fastmcp run server.py
By default the server speaks the stdio transport, which is what local clients like Claude Code expect. Pass an HTTP transport when you want a network-accessible server. FastMCP generates the tool's JSON schema automatically from your type hints and docstring, which is the core trick: your function signature is the API contract.
To confirm the server actually works, point MCP Inspector at it or run it through our MCP Health Checker, which verifies a server responds correctly to protocol handshakes.
Key Features: Tools, Resources, Prompts, Auth
FastMCP covers all three MCP primitives plus the production concerns the raw protocol leaves to you. The main building blocks:
- Tools:
@mcp.toolturns any function, sync or async, into a callable tool with an auto-generated schema. - Resources:
@mcp.resourceexposes read-only data (files, database rows, API responses) at a URI the client can fetch. - Prompts:
@mcp.promptdefines reusable prompt templates the client can invoke. - Authentication: built-in auth providers for Google, GitHub, Azure, AWS Cognito, Auth0, and other enterprise identity systems, so a remote server can require OAuth without custom middleware.
- Clients: a full MCP client class for calling any MCP server from Python, useful for testing and for agent-to-agent setups.
- Providers: since 3.0, servers can source components dynamically, including an OpenAPIProvider that generates a whole MCP server from an OpenAPI spec and a ProxyProvider that wraps other MCP servers.
- Deployment:
fastmcp runfor local use, HTTP transport for self-hosting, and enterprise deployment through Prefect Horizon with SSO and audit logging.
FastMCP vs the Official MCP SDK
The official MCP Python SDK already contains FastMCP 1.0, so the real comparison is between that frozen 1.0 API and the standalone FastMCP 3.x project. The official SDK is the reference implementation of the protocol; standalone FastMCP is the batteries-included framework built on the same ideas.
| FastMCP (standalone) | Official MCP Python SDK | FastMCP (TypeScript) | |
|---|---|---|---|
| Version (July 2026) | 3.4.3 | Includes FastMCP 1.0 API | Separate project, 3,200 stars |
| GitHub stars | 26,000 | Reference implementation | 3,200 |
| Tools, resources, prompts | Yes | Yes | Yes |
| Auth providers (Google, GitHub, Auth0...) | Built in | Manual | Partial |
| OpenAPI-to-server generation | Yes (OpenAPIProvider) | No | No |
| Server proxying and composition | Yes | No | No |
| Interactive apps/UI | Yes (FastMCPApp, since 3.2.0) | No | No |
| Language | Python | Python | TypeScript |
| License | Apache-2.0 | MIT | MIT |
Rule of thumb: use the official SDK when you want zero extra dependencies and a spec-exact reference; use standalone FastMCP when you want auth, composition, OpenAPI generation, or anything beyond a basic local server. For the Node ecosystem, the TypeScript port at punkpeye/fastmcp follows the same philosophy on top of the official TypeScript SDK.
What Changed in FastMCP 3.0
FastMCP 3.0 shipped on February 18, 2026 and rebuilt the framework around three primitives: components, providers, and transforms. Providers let a server source its tools dynamically (FileSystemProvider, OpenAPIProvider, ProxyProvider, SkillsProvider), transforms act as middleware for renaming, namespacing, and filtering components, and sessions gained per-request state with dynamic tool visibility via ctx.enable_components().
Notable 3.x releases since, per the official changelog:
- 3.1.0: Code Mode, which lets LLMs search tools and chain calls inside a sandbox.
- 3.2.0: FastMCPApp for interactive UIs (charts, dashboards, forms) rendered in conversation.
- 3.4.0:
fastmcp-remotefor connecting stdio-only hosts to HTTP servers. - 3.4.3 (July 5, 2026): security hardening, including SSRF protections, DNS rebinding defenses, and stricter OAuth redirects.
When to Use FastMCP
Use FastMCP whenever you are exposing Python code to an AI agent and want to ship in minutes rather than days. It is the default choice for internal tools, API wrappers, database access layers, and any server you plan to protect with OAuth. If you are building for Claude Code specifically, pair this guide with our walkthrough on building your own MCP server and the roundup of the best MCP servers for Claude Code to see the patterns that already work.
Skip it when your server is not Python or Node (use the official SDK for your language), when you need a dependency-minimal reference implementation, or when an existing server from our best MCP servers list already does the job.
Limitations
FastMCP has real tradeoffs worth knowing before you commit. The 3.0 redesign was a major architectural change, so tutorials and Stack Overflow answers written against 2.x can be stale; check the version badges in the docs. The framework moves fast, with multiple minor releases per quarter, which means occasional churn in newer APIs like providers and apps. Advanced features (Code Mode, FastMCPApp, transforms) go beyond what every MCP client supports, so test against your actual client. And because FastMCP 1.0 inside the official SDK is frozen, code written for the standalone 3.x package is not drop-in compatible with mcp.server.fastmcp imports.
Related Guides
- MCP Inspector: Test and Debug Any MCP Server
- How to Build Your Own MCP Server
- Best MCP Servers in 2026: The Complete Ranked List
- Best MCP Servers for Claude Code
Go deeper
The operator playbooks
Production-ready PDF guides for OpenClaw and Hermes Agent — $19.99 each.
Skills for this topic
Browse all skills →Frequently Asked Questions
What is FastMCP used for?
FastMCP is used to build MCP servers and clients in Python, turning ordinary functions into tools, resources, and prompts that AI agents like Claude can call. It handles schemas, transports, auth, and the protocol lifecycle so developers only write business logic.
What is the difference between FastMCP and the official MCP SDK?
The official MCP Python SDK includes a frozen copy of FastMCP 1.0, while the standalone FastMCP project (now 3.x) adds clients, auth providers, OpenAPI generation, server composition, interactive apps, and deployment tooling on top. The SDK is the reference implementation; FastMCP is the production framework.
Does FastMCP work with Claude Code?
Yes. A FastMCP server running over stdio can be added to Claude Code with claude mcp add my-server -- fastmcp run server.py , and HTTP servers connect via claude mcp add --transport http . Verify the connection with MCP Inspector or our MCP Health Checker .





