# FastMCP (Python) — card for AI agents

Fast, Pythonic framework for building MCP servers and clients for AI tool integration.

Category: Agent, MCP and tool libraries · PyPI package `fastmcp` · latest version 4.1.4 (checked 2026-11-01)
Install: `pip install fastmcp`
License: Apache-2.0 (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## FastMCP
- Install with `uv add fastmcp` (or `pip install fastmcp`). Pin an exact version, because minor releases may contain breaking changes. Use the current release, for example `fastmcp==4.1.8`, rather than a range like `fastmcp>=4.0.0`.
- Register tools by decorating typed functions with `@mcp.tool`. FastMCP derives the schema from the function.
- Keep the `if __name__ == "__main__": mcp.run()` block. Note that `fastmcp run my_server.py:mcp` imports the server object and does not execute that block.
- Use `mcp.run(transport="http", port=8000)` for remote access. Use the default stdio transport for local clients.
- The client is async. Open it with `async with Client(...)`, then call `await client.call_tool(...)` inside the block. For in-memory tests, pass the server object as `Client(mcp)`.
- For `@mcp.tool(app=True)` UI tools, install the `fastmcp[apps]` extra. Preview them locally with `fastmcp dev apps my_server.py`.
- Read the docs through `https://gofastmcp.com/llms.txt`, or append `.md` to a docs URL. The docs follow the main branch, so confirm a feature exists in your pinned version.

## Agent Skills for it
- fastmcp from midudev/autoskills: `npx skills add midudev/autoskills --skill fastmcp`

## Docs written for agents
- [llms.txt (index of the docs)](https://gofastmcp.com/llms.txt)

## What it is
- FastMCP is a Python framework for the Model Context Protocol. It is made by Prefect and licensed Apache-2.0. The README describes it as "a full MCP application framework for servers, clients, and interactive apps." The maintainers write that FastMCP 1.0 "was incorporated into the official MCP Python SDK in 2024" and that the standalone project is still actively maintained. The GitHub repository was created on 2024-11-30.
- You write a plain Python function and decorate it with `@mcp.tool`. The docs say FastMCP "manages schema generation, validation, transport, authentication, and protocol compatibility" around that code. The same package has a client for local or remote servers. It also has "Apps": tools that return forms, tables or charts, which the host renders inside the conversation.
- It is for Python developers who want to expose functions, data or prompts to LLMs, or who want to call MCP servers from their own code. The maintainers say it is downloaded more than a million times a day. They also say some version of it "powers 70% of MCP servers across all languages".

## Caveats
- Minor versions can break things: The versioning policy allows breaking changes in minor releases when they are needed to keep up with the protocol. The docs tell you to pin exact versions in production.
- Docs track main, not the release: The documentation describes the main branch, so a feature you read about may not be in the version you installed. The docs point to the version badges on each page.
- pip upgrades across 3.3 can half-remove the package: FastMCP 3.3 moved its code into a `fastmcp-slim` distribution. During a single-command pip upgrade from 3.2 or earlier, pip can install the new files and then delete them. The docs give a `pip install --force-reinstall fastmcp` fix. They say fresh installs and uv upgrades are unaffected.
- Transitive licensing may need review: The CLI depends on Cyclopts. Cyclopts v4 pulls in docutils, which the docs say may trigger compliance reviews. As a workaround, the docs suggest the Cyclopts v5 alpha.
- Interactive UIs need the apps extra: The quickstart says tools that return UIs require the `fastmcp[apps]` extra.

## Numbers (AgentGid data)
- Gid Score: 75.3 (#197 of all tools, 5 of 192 in its category)
- Used in 173 public projects set up for AI coding agents (2.8%)
- Downloads last week: 20,601,120 (as of 2026-11-24), +14.5% over 4 weeks
- GitHub stars: 28,722 (as of 2026-11-24)
- Last push: 2026-11-24

## Often used with
python-dotenv 46.2%, Pydantic 45.7%, Model Context Protocol SDK (Python) 31.2%, httpx 29.5%, Uvicorn 30.1%, Requests 28.3%

## Checked alternatives (same job)
- Model Context Protocol SDK (Python): https://agentgid.com/tools/mcp/agent.md
- Pydantic AI: https://agentgid.com/tools/pydantic-ai/agent.md
- smolagents: https://agentgid.com/tools/smolagents/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/fastmcp-pypi/
- Homepage: https://gofastmcp.com
- Repository: https://github.com/PrefectHQ/fastmcp
- Source: https://github.com/PrefectHQ/fastmcp#readme
- Source: https://github.com/PrefectHQ/fastmcp
- Source: https://github.com/PrefectHQ/fastmcp/releases
- Source: https://gofastmcp.com
- Source: https://gofastmcp.com/docs/getting-started/welcome.md
- Source: https://gofastmcp.com/docs/getting-started/installation.md
- Source: https://gofastmcp.com/docs/getting-started/quickstart.md

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
