How to Install FastMCP on Windows, macOS and Linux
Check your Python version, install the package with uv or pip, confirm it works and fix the problems people meet most often.
Read articleFastMCP is an open-source Python framework for building Model Context Protocol servers, clients and interactive apps. You write ordinary functions, and FastMCP turns them into tools, resources and prompts that language models can call, handling schemas, validation and transport for you.
The Model Context Protocol (MCP) is an open standard that lets AI applications reach external tools and data through one consistent interface. Rather than writing a separate integration for every model and every service, you expose capabilities once through an MCP server, and any compatible client can use them.
FastMCP is the Python framework for that work. It began as the high-level API that was incorporated into the official MCP Python SDK in 2024, and it continues as a standalone project maintained by the team at Prefect.
The framework reads your type hints and docstrings to generate the schemas that models need. Validation, error handling and protocol negotiation happen behind the scenes, so the code you maintain stays close to plain Python.
Because the protocol is shared, a server built once works with desktop assistants, IDE integrations and custom agents alike. The same library also includes a client for calling other MCP servers and an apps layer for returning interactive interfaces.
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()
Functions the model can call to take an action or compute a result.
Read-only data addressed by a URI, such as files, records or settings.
Reusable message templates that shape how a model approaches a task.
Each feature removes a piece of protocol work, so your effort goes into what the server actually does.
Add @mcp.tool, @mcp.resource or @mcp.prompt to a function and it becomes an MCP component, with no protocol boilerplate to write. Plain functions remain easy to read and to test.
Type hints and docstrings become the JSON schemas that models read. Incoming arguments are validated before your function runs, so bad input never reaches your logic.
Run locally over STDIO for desktop hosts, or over HTTP for remote clients. Switching between them takes one argument or a single CLI flag.
Connect to any MCP server from Python, including in-memory connections that make automated tests quick and dependable. It is equally useful in scripts and agents.
Protect remote servers with JWT verification, token introspection or OAuth providers such as GitHub, Google and Azure, all through one auth parameter.
Let tools return forms, tables and charts that render inside the conversation, using the optional apps extra. A local preview command shows them before release.
Installation takes a few minutes on Windows, macOS or Linux. The four steps below take you from a clean machine to a running server.
Run python --version and confirm it shows 3.11 or newer. Install a current release first if it does not.
Run uv add fastmcp in your project, or pip install fastmcp inside a virtual environment.
Run fastmcp version. The output lists the FastMCP, MCP and Python versions with your platform.
Define a tool in my_server.py, then launch it with fastmcp run my_server.py:mcp.
Copy the commands for your preferred package manager. Both install the same package from PyPI, together with the fastmcp command-line tool.
If the command is not found after installation, the virtual environment is probably not active. Activate it, or prefix the command with uv run.
# with uv (recommended)
uv add fastmcp
# with pip
pip install fastmcp
# confirm the installation
fastmcp version
FastMCP is a pure Python package, so it runs wherever a supported interpreter runs. There is no compiler to configure and no platform-specific build.
Check the points listed here before installing. They cover the interpreter, the operating system, the package manager and the extras that some features depend on.
If you plan to deploy to production, decide on version pinning at the outset; it saves surprises when a new release arrives. A lockfile created by uv records every dependency, so colleagues and CI servers install exactly the same versions.
tasks, apps, openai, anthropic, gemini and azure, installed only when needed.fastmcp==4.2.0, or a lockfile, because minor releases may contain breaking changes.The archive contains the complete FastMCP repository from its main branch, including the source code, examples, documentation sources and test suite. It is useful for reading the code, working offline or preparing a contribution.
After extracting the archive, the examples folder is a good place to begin, as each file there is a small, runnable server.
To build servers, pip install fastmcp or uv add fastmcp is quicker and keeps updates simple.
Most projects start with a single tool and grow from there. These are the patterns that appear most often, and each can begin as a small server of fewer than fifty lines.
Expose documentation, wikis and policy files as resources so an assistant can answer questions from your own material, with sources it can cite.
Offer narrow, parameterised query tools instead of raw database credentials, keeping full control over what a model can read and change.
Wrap CI pipelines, issue trackers and deployment scripts so routine engineering tasks can run from a conversation, with the same permissions as the script.
Return summaries, tables and charts from analytics code, with app tools rendering the results interactively for further exploration.
Put an MCP interface in front of a REST service, or proxy another MCP server, without rewriting the underlying system or its business rules.
Combine tools for reports, notifications and file processing that an agent can run in sequence, each step small enough to test on its own.
Practical, step-by-step articles that take you from installation to a server running in production. Each guide states the commands to run, explains what they do and shows the expected result.
Check your Python version, install the package with uv or pip, confirm it works and fix the problems people meet most often.
Read articleWrite a single-file server with a tool, a resource and a prompt, run it locally or over HTTP and call it from Python.
Read articleHow the STDIO and HTTP transports differ, when to use each and how to switch between them with a single argument.
Read articleFastMCP removes most of the effort involved in connecting language models to real systems. You describe capabilities as ordinary Python functions, and the framework produces the schemas, validation and transport that the Model Context Protocol requires.
A sensible path is to install the package, build a single tool, test it with the in-memory client and then decide whether it should run locally over STDIO or remotely over HTTP. Authentication and deployment can follow once the server does something useful.
Keep each tool narrow and give it a precise docstring, because that text is what a model reads when deciding whether to call it. Pin the FastMCP version once the server matters to other people, and add tests before you add features.
The guides on this site cover each of those stages in order, with working code at every step.
Short answers to the questions people ask most often about FastMCP.
FastMCP is used to build Model Context Protocol servers and clients in Python. Developers use it to give AI applications controlled access to functions, data and reusable prompts, without writing protocol code by hand. Typical projects include internal assistants, developer tools and data services.
Yes. FastMCP is open-source software released under the Apache-2.0 licence, which permits commercial and personal use. Managed hosting offered by Prefect is a separate service with its own terms.
The current release requires Python 3.11 or later. Run python --version before installing to confirm that your interpreter meets this requirement.
FastMCP 1.0 was incorporated into the official SDK in 2024. The standalone project has continued since then and adds clients, authentication, deployment tooling, apps and testing utilities. For new projects, the standalone package offers the broader feature set.
Both install the same package. The documentation recommends uv because it is fast and records a lockfile; pip works well inside a virtual environment if you already use it.
Yes. FastMCP is a pure Python package and runs on Windows, macOS and Linux. On Windows, activate your virtual environment in PowerShell before running the fastmcp command.
Desktop applications usually launch the server locally over STDIO using a command you configure. Remote clients connect over HTTP to the server's /mcp endpoint, for example http://localhost:8000/mcp during development.
Yes. Pass a verifier to the server's auth parameter. Options include JWT verification, token introspection and OAuth providers such as GitHub, Google and Azure.
Run pip install --upgrade fastmcp or uv add fastmcp --upgrade. Read the release notes first, because minor releases can include breaking changes, and pin the version in production.
The ZIP download contains the full source repository, which suits reading the code or contributing. For building servers, installing from PyPI is simpler and keeps updates straightforward.