← Back to all projects

FastMCP

The Python framework most MCP servers are written in, well ahead of the copy inside the official SDK

OfficialApache-2.0
Stars
27.4k
Forks
2.3k
Open issues
291
Last commit
28 Aug 2026

What is FastMCP?

A decorator over a typed Python function is a complete tool: the schema is derived from the type hints and docstring, and both the arguments coming in and the value going out are validated for you. Beyond that it covers the parts a second week of work runs into — a typed client, OAuth and remote identity providers, mounting several servers as one, proxying an existing server, and middleware. The confusion to be aware of is the name: an earlier version of this API was absorbed into the official MCP Python SDK, so FastMCP refers to two different things depending on which import you read.

What can you do with FastMCP?

  • One decorator turns a function into a tool — Annotate a typed function and the framework derives the input schema from its signature and the description from its docstring, then validates arguments before your code runs and the return value before it goes back.
  • Expose data and prompts, not only actions — Resources and resource templates serve data the client can read, and prompts are reusable parameterised message templates — the two parts of MCP that servers built by hand usually skip.
  • Write the client side with the same library — A typed client calls tools, reads resources and fetches prompts against local or remote servers, which is also what makes a server testable without launching a separate process.
  • Put real authentication in front of it — OAuth 2.1 and token verification are supported with remote identity providers including Auth0, WorkOS, Descope, AWS Cognito and Azure, and authorisation rules can hide components a given caller should not see.
  • Compose or wrap servers you did not write — Several servers can be mounted into one namespace, an existing server can be fronted by a proxy, and middleware intercepts requests and responses across whatever is mounted.

Before you choose FastMCP

  • The high-level API this project created was absorbed into the official MCP Python SDK, so docs naming FastMCP may mean that older frozen copy, not this one — check the import before following a tutorial.
  • Maintenance now sits with Prefect, which also sells a hosted MCP platform the documentation points to; the framework is Apache-2.0, but its direction is set alongside a commercial product.

Star history

21 Aug to 28 Aug · +101

27.3k27.4k

Frequently asked questions

Is FastMCP free for commercial use?

FastMCP is released under the Apache-2.0 licence — OSI-approved open source, which permits commercial use.

How can FastMCP be deployed?

FastMCP is available as Self-hosted / Runs locally.

Documentation

Reproduced from the PrefectHQ/fastmcp README, published under Apache-2.0. Read the original ↗

FastMCP 🚀

Move fast and make things.

Made with 💙 by Prefect

Tests


The Model Context Protocol (MCP) connects LLMs to tools and data. FastMCP is a full MCP application framework for servers, clients, and interactive apps. A server starts with ordinary Python:

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()

Why FastMCP

Building an effective MCP application is harder than it looks. FastMCP handles all of it. Declare a tool with a Python function, and the schema, validation, and documentation are generated automatically. Connect to a server with a URL, and transport negotiation, authentication, and protocol lifecycle are managed for you. You focus on your logic, and the MCP part just works: with FastMCP, best practices are built in.

That’s why FastMCP is the standard framework for working with MCP. FastMCP 1.0 was incorporated into the official MCP Python SDK in 2024. Today, the actively maintained standalone project is downloaded a million times a day, and some version of FastMCP powers 70% of MCP servers across all languages.

FastMCP has three pillars:

Servers wrap your Python functions into MCP-compliant tools, resources, and prompts. Clients connect to any server with full protocol support. And Apps give your tools interactive UIs rendered directly in the conversation.

Building in TypeScript? FastMCP for TypeScript is the official counterpart, built and maintained by the same team. Same pillars, same ideas, npm install @prefecthq/fastmcp-ts.

Ready to build? Start with the installation guide or jump straight to the quickstart.

Scale MCP with Horizon

FastMCP handles the MCP application layer. Prefect Horizon is the enterprise MCP gateway for scaling servers and tools across teams, with centralized governance over how they are deployed, discovered, secured, and used.

FastMCP and Horizon are built by the same team at Prefect.

Deploy FastMCP servers from GitHub with branch previews and instant rollback. Create a private registry of every MCP your company uses. Secure access with SSO and tool-level RBAC. Get audit logs, observability, and governance across your MCP stack. Remix approved tools into purpose-built endpoints for teams and agents.

Start with FastMCP. Scale with Horizon →

Installation

We recommend adding FastMCP to your project with uv:

uv add fastmcp

For full installation instructions, including verification and upgrading, see the Installation Guide.

Upgrading? We have guides for:

📚 Documentation

FastMCP’s complete documentation is available at gofastmcp.com, including detailed guides, API references, and advanced patterns.

Documentation is also available in llms.txt format, which is a simple markdown standard that LLMs can consume easily:

  • llms.txt is essentially a sitemap, listing all the pages in the documentation.
  • llms-full.txt contains the entire documentation. Note this may exceed the context window of your LLM.

Community: Join our Discord server to connect with other FastMCP developers and share what you’re building.