What Is FastMCP? Writing an MCP Server in Python, Adding It to Claude Desktop and Claude Code, and Setup
You write a function in Python and put `@mcp.tool` above it; FastMCP turns it into a tool an assistant such as Claude can call. Once you register it with Claude Desktop using `fastmcp install claude-desktop server.py`, Claude can, for example, query your company's stock or booking system through that function. It's Prefect's open-source (Apache-2.0) framework, used for servers, clients and interfaces in the chat (Apps). The library is free; if you put the server on the internet, hosting and authentication are on you. It needs Python skills.
- What it does
- Turns Python functions into MCP tools
- Type
- Python library + command line (fastmcp)
- Maker
- Prefect
- Requirements
- Python 3.11+
- Watch out
- No authentication by default over HTTP
- Latest release
- 4.2.5 (November 23, 2026)
- Price
- Free (Apache-2.0)
What is FastMCP and what does it do?
MCP (Model Context Protocol) is a common format that connects an AI assistant to tools and data. If you want an assistant to use your company's stock system, booking software or customer table, you have to offer that system as an MCP server. FastMCP lets you write that server in Python in a few lines: you write a function, and the schema, validation and documentation are generated by FastMCP itself. The README describes FastMCP as a full MCP application framework for servers, clients and interfaces in the chat (Apps).
Who it's for: developers, and agencies that build internal tools, who want to connect an in-house system (for example hotel bookings, e-commerce stock, customer records) to Claude. Who it's not for: a business owner looking for a ready-made connection without writing code: this is a library. Services such as Zapier MCP are a separate route for connecting ready-made apps without code; and if using an existing MCP server is enough, you don't need FastMCP.
Zapier MCP guide: the no-code route for ready-made apps
Source: FastMCP README ("Why FastMCP"), docs "The FastMCP Server", November 23, 2026. First release November 30, 2024; the README says FastMCP 1.0 was incorporated into the official MCP Python SDK in 2024 and that the standalone project of today is developed separately.
How does FastMCP work?
FastMCP writes the MCP layer between Claude and your code; you decide how much access your system gets by the way you write the function.
Sources: README ("FastMCP has three pillars"), docs "Tools" and "Quickstart", November 23, 2026.
How do you install FastMCP?
No account needed. You need Python 3.11 or later (the PyPI classification lists 3.11–3.15). The docs recommend installing with uv; pip works too. For production the docs ask for a lockfile or an exact version pin, because even minor versions (for example 4.1.x to 4.2.0) can carry breaking changes. Below, the latest release as of November 23, 2026 (4.2.5) is pinned.
› pip install "fastmcp==4.2.5"The command in the docs has no version: pip install fastmcp. There are optional extras: for example pip install "fastmcp[tasks]" for background tasks and pip install "fastmcp[apps]" for interfaces in the chat.
› uv add fastmcpuv is also needed to register a server with Claude Desktop (see the "Claude Desktop and Claude Code" section below).
- Check that it's installed: The
fastmcp versioncommand prints the FastMCP, MCP and Python versions. - When upgrading with pip: If
import fastmcpfails after moving from 3.2 or earlier to 3.3+ with pip, runpip install --force-reinstall fastmcp; the docs say this happens only in that move.
Sources: docs "Installation" (Install, Versioning Policy, Troubleshooting), PyPI fastmcp 4.2.5 (November 23, 2026). Checked on November 23, 2026.
How do you use FastMCP? Write, run and call your first tool
The examples below are derived from patterns in the docs. The data in the hotel example is made up; you replace the function body so that it connects to your own booking system.
› from fastmcp import FastMCP
from mcp.types import ToolAnnotations
mcp = FastMCP("Hotel Desk")
@mcp.tool(annotations=ToolAnnotations(readOnlyHint=True))
def check_availability(date: str, guests: int) -> dict:
"""Return the room types available on a date for a number of guests."""
return {"date": date, "guests": guests, "rooms": ["standard", "deluxe"]}
if __name__ == "__main__":
mcp.run()What you get: FastMCP uses the function name (check_availability) as the tool name and the docstring as the description, builds the input schema from the parameter types (str, int), and handles validation and error reporting itself. readOnlyHint=True is a hint saying the tool only reads: clients such as Claude use it to understand tools' safety profiles. According to the docs, hints are advisory and don't draw a security boundary. Functions with *args or **kwargs can't be tools.
› fastmcp run server.py:mcpWhat you get: a stdio server; a client (such as Claude Desktop) usually starts it itself, so you don't see a running window in the terminal. For a server reachable over the network you type fastmcp run server.py:mcp --transport http --port 8000; the server sits at http://localhost:8000/mcp.
› import asyncio
from fastmcp import Client
client = Client("http://localhost:8000/mcp")
async def call_tool(date: str):
async with client:
result = await client.call_tool("check_availability", {"date": date, "guests": 2})
print(result)
asyncio.run(call_tool("2026-12-12"))What you get: the dictionary the check_availability tool returns (the date, the guest count and the standard and deluxe rooms from the sample data) is printed. The client is asynchronous (async with client: opens the connection); this is one way to test your server without Claude.
Sources: docs "Quickstart", "Tools" (Decorator Arguments, MCP Annotations), "Running Your Server", November 23, 2026.
How do you add a FastMCP server to Claude Desktop and Claude Code?
The fastmcp install command registers your server with an MCP client; because each client runs the server in its own isolated environment, you must declare dependencies explicitly (--with, --with-requirements or a fastmcp.json file). The clients the command supports: claude-code, claude-desktop, cursor, gemini-cli, goose, plus mcp-json and stdio outputs for manual use.
› fastmcp install claude-desktop server.pyThe command edits the configuration file itself. Then quit Claude Desktop completely and reopen it; the docs expect a hammer icon at the left of the input box. If you need a dependency, add --with pandas; for an environment variable, add --env API_KEY=... or --env-file .env.
› {
"mcpServers": {
"dice-roller": {
"command": "python",
"args": ["path/to/your/server.py"]
}
}
}The file is at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS and %APPDATA%\Claude\claude_desktop_config.json on Windows; you can also open it from within Claude.
!Claude Desktop runs the server in an isolated environment that has no access to your shell environment or installed applications: uv must be on the system PATH (on macOS the docs recommend brew install uv) and you must pass every environment variable the server needs explicitly.
› fastmcp install claude-code server.pyThe command calls Claude Code's own claude mcp add command; Claude Code must be installed and the claude command must be on the PATH or in a known install location. If you prefer to do it by hand:
› claude mcp add dice-roller -- uv run --with fastmcp fastmcp run server.pyAccording to Claude's help page, custom connectors using remote MCP are available on the Free (limited to one custom connector), Pro, Max, Ultra, Team and Enterprise plans. The path is Customize › Connectors; there you click + Add, then Add custom connector and enter the server's address. Claude connects to a remote connector from Anthropic's cloud: the server must be reachable from the internet on the standard HTTPS port 443, and a local address such as http://localhost:8000/mcp can't be added to Claude. If you don't have remote server support, the docs suggest a proxy server that runs locally over stdio and forwards to the remote server (create_proxy).
Source: Claude Help Center, "Get started with custom connectors using remote MCP", November 23, 2026.
check_availability tool with the date and guest-count parameters, reads the result the function returns and writes the answer in the chat. The tool name and docstring help Claude pick the right tool, so write the docstring clearly.Sources: docs "Claude Desktop 🤝 FastMCP", "Claude Code 🤝 FastMCP", "Install MCP Servers", November 23, 2026.
Putting a FastMCP server on the internet: HTTP, authentication, hosting
Stdio is only for a client running on that same computer. For several people or a cloud-based assistant to reach your server, you use HTTP (mcp.run(transport="http", ...); the address is /mcp by default). The docs give two routes: a direct HTTP server (the easiest way to start) and, for production, an ASGI application made with mcp.http_app() (served by something like Uvicorn, with multiple workers and middleware).
› # app.py
app = mcp.http_app()
# terminal
uvicorn app:app --host 0.0.0.0 --port 8000!A FastMCP server put on the network over HTTP has no authentication by default (auth=None): add a token or OAuth.
| Route | When |
|---|---|
| Token verification (Bearer, JWT) | If your identity setup already issues tokens; FastMCP only verifies them. |
| External identity provider (OAuth, OIDC) | If you want sign-in through corporate SSO or providers such as Auth0, Google or GitHub. |
| Full OAuth server | If you have to manage users and tokens yourself; the docs say this brings significant complexity. |
Hosting: a FastMCP HTTP server runs anywhere that can run a Python application; hosting, TLS and updates are on you. Prefect offers FastMCP Gateway (formerly Horizon), a separate product from the same team, for managed hosting, authentication and access control; the docs say there's a free tier for personal projects and enterprise features for teams. The pricing table is visible only after signing in.
Sources: docs "HTTP Deployment", "Authentication", "FastMCP Gateway", November 23, 2026.
What's in FastMCP?
Writing a server
- Turning a Python function into a tool Claude can call with @mcp.toolRequires separate setupAvailable on the free planAn MCP tool whose name, description and parameter schema are generated automatically · Free; Python 3.11 or later
- Making the server reachable over the network with HTTP and adding authenticationRequires separate setupAvailable on the free planAn MCP server reachable at an address (for example /mcp) · Free; hosting and security are on you
- Offering data as resources and ready-made instructions as promptsRequires separate setupAvailable on the free planResources the assistant can read, and template prompts · Free
- Turning an existing API into an MCP server from its OpenAPI definition (from_openapi)Requires separate setupAvailable on the free planTools generated from the API's endpoints · Free; the docs recommend a hand-designed server
Connecting to Claude
- Registering the server you wrote with Claude Desktop or Claude Code using fastmcp installRequires separate setupAvailable on the free planA tool Claude uses in the chat · Free; for Claude Desktop, uv must be on the PATH
- Calling an MCP server from Python (Client)Requires separate setupAvailable on the free planThe result of the tool call · Free
Interface in the conversation
- Showing a tool's result in the chat as a chart, table or form (the apps extra)Requires separate setupAvailable on the free planAn interface component drawn in the chat · Free; pip install "fastmcp[apps]"
Labels: "Requires a connection" means linking another account or app; "Requires separate setup" means installing a separate program. Pricing is listed per feature; a product having a free plan doesn't mean every feature is free. Compiled from official sources on November 23, 2026.
OpenAPI note: FastMCP.from_openapi() generates a server automatically from an existing API's definition. The docs themselves say that carefully designed servers perform significantly better than auto-converted ones, and recommend it for getting started, not for mirroring an API to AI.
What FastMCP 4 brings: according to the docs, tools can ask follow-up questions across requests, authenticated user state is preserved and long jobs can move into background tasks; most FastMCP 3 servers run unchanged on 4. Version 4.2 added serving skills from the server: one copy that every agent reads.
Sources: docs "What's New in FastMCP 4", "OpenAPI 🤝 FastMCP", "Tools", "Resources & Templates", November 23, 2026.
Is FastMCP free? Commercial use
Yes. FastMCP is Apache-2.0-licensed open-source software; it has no paid plan and no account. Money comes in only with separate products: the computer or cloud where you host the server, the own fees of the systems you connect (API, database), and the optional FastMCP Gateway. Using Claude is tied to a separate account and plan.
- Using, modifying and embedding it in your own product, including commercially (Apache-2.0)
- Reproducing and distributing it
- Removing the license text and copyright notice from distributions; changes to files you modified must be stated
- Using contributors' trade names and trademarks for promotion
Sources: LICENSE (Apache License 2.0), PyPI fastmcp (Apache-2.0), November 23, 2026. This is not legal advice.
Does FastMCP work in Turkish?
| Interface and docsNo | Commands and docs are in English. |
|---|---|
| Writing tool names and descriptions in TurkishUnclear | The docs have no language section. Claude reads the descriptions (docstrings); write them in Turkish and check on your first try that it picks the right tool. |
| Use from TurkeyYes | A publicly available Python package on PyPI and GitHub; the docs mention no account, payment or region restriction. |
Is FastMCP safe? Data and permissions
A stdio server runs on your computer with the permissions of the client that starts it; the docs say its security comes from the local execution environment. You decide where data goes as you write the function.
Tool results enter Claude's chat and are subject to that assistant's data terms. When writing a tool that returns personal data such as customer records, return only the fields that are needed.
Don't write API keys into the code; for Claude Desktop pass them with --env or --env-file, or with the env section in the configuration. The key then sits in the configuration file as plain text.
FastMCP has published security advisories on GitHub; stay on a current version and connect only to servers you trust.
Sources: docs "Authentication", "Claude Desktop 🤝 FastMCP", GitHub security advisories (PrefectHQ/fastmcp), November 23, 2026. This is not a security audit.
Common problems and fixes
| What happens | What to do |
|---|---|
| Claude Desktop can't start the server | uv must be on the system PATH; on macOS the docs recommend brew install uv. Register the server with fastmcp install. |
| The server can't see the API key | Claude Desktop doesn't see your shell environment: pass --env API_KEY=... or --env-file .env. |
| The tool doesn't show up after registering | Quit Claude Desktop completely and reopen it; look for the hammer icon. |
| A function isn't registered as a tool | *args and **kwargs aren't supported; write the parameters out one by one. |
import fastmcp fails after upgrading with pip | pip install --force-reinstall fastmcp; if that doesn't help, pip uninstall -y fastmcp fastmcp-slim and reinstall. |
| A minor version upgrade broke the code | The docs say minor versions can also carry breaking changes: pin the version and read the upgrade guide. |
How do you uninstall FastMCP?
› pip uninstall -y fastmcp fastmcp-slimIf you used a virtual environment, deleting the .venv folder also works; if you added it with uv add, use uv remove fastmcp. If you registered it with Claude Desktop, delete the server entry in claude_desktop_config.json and restart the app; if you registered it with Claude Code, the claude mcp remove <name> command deletes the entry.
FastMCP, a no-code route or another tool?
The FastMCP row comes from its official docs; the other rows summarize those tools' own guides. This is not a ranking.
Frequently asked questions
How do you add a FastMCP server to Claude Desktop?
With the fastmcp install claude-desktop server.py command; the command edits the configuration file itself. Then quit Claude Desktop completely and reopen it. uv must be on the system PATH and you must pass the environment variables the server needs explicitly with --env.
How do you install FastMCP with Python and write a first server?
With pip install fastmcp (or uv add fastmcp, which the docs recommend); Python 3.11 or later is required. Then you create a server object with FastMCP("Name"), put @mcp.tool above a function and run it with mcp.run().
FastMCP or the official MCP SDK?
The README says FastMCP 1.0 was incorporated into the official MCP Python SDK in 2024 and that the standalone project of today is developed separately. The docs have migration guides from SDK v1 and v2 to FastMCP; if you use SDK v1's high-level server, a single import change is enough for most servers.
What is FastMCP, and where is it on GitHub and PyPI?
Prefect's open-source (Apache-2.0) Python framework for writing MCP servers, clients and interfaces in the chat (Apps). The GitHub repository is PrefectHQ/fastmcp, the PyPI package is fastmcp; the latest release is 4.2.5 (November 23, 2026). For TypeScript, the same team has a separate @prefecthq/fastmcp-ts package.
What changed with FastMCP 4?
According to the docs, tools can ask follow-up questions across requests, authenticated user state is preserved and long jobs can move into background tasks. Most FastMCP 3 servers run unchanged on 4; for breaking changes, see the upgrade guide.
Is FastMCP Cloud (Gateway) free?
FastMCP Gateway (formerly Horizon) is a separate, managed service from Prefect. The docs say there's a free tier for personal projects and enterprise features for teams; the pricing table is visible only after signing in (horizon.prefect.io/pricing). You don't need this service to use the library itself.
Is FastMCP free, and can it be used commercially?
Yes, it's Apache-2.0-licensed and free; commercial use, modification and distribution are allowed, as long as the license and copyright notice are kept. No account needed.
Do I need authentication when putting my server on the internet?
Yes: FastMCP servers come without authentication by default; you can add token verification, an external OAuth or OIDC provider, or a full OAuth server.
Related guides
Sources
- FastMCP README
- Documentation
- Installation
- Quickstart
- Tools
- Claude Desktop integration
- Claude Code integration
- HTTP deployment
- Authentication
- FastMCP Gateway
- FastMCP Gateway pricing (visible after signing in)
- Claude: custom connectors using remote MCP
- License (Apache-2.0)
- GitHub security advisories
- PyPI: fastmcp
Not clear in the official sources: The pricing table of FastMCP Gateway (the docs only say there's a free tier for personal use) · how Claude picks tools when descriptions are in Turkish (the docs have no language section). Each is covered in the relevant section along with what you can do.



