The framework for MCP
Build MCP servers, clients and interactive apps.
You write the application logic.
FastMCP handles the protocol.
uv add fastmcpfrom fastmcp import FastMCP
mcp = FastMCP("Bookshop")
BOOKS = ["Dune", "Neuromancer", "Hyperion"]
@mcp.tool
def search_books(query: str) -> list[str]:
"""Find books by title."""
q = query.lower()
return [b for b in BOOKS if q in b.lower()]$ uv add fastmcp
$ fastmcp run server.py --transport httpTeams at these companies build MCP servers with FastMCP
- AWS
- NVIDIA
- Snowflake
- SAP
- MLflow
- ClickHouse
- Neo4j
- Couchbase
- Apache Superset
- Kagi
Everything you need to build on MCP
Build tools, connect systems and add interactive interfaces.
Authentication and testing ship in the same package.
Share your team's skills over MCP
Copying skill folders onto every laptop leaves everyone with a slightly different version. Serve them from a FastMCP server instead and the whole team works from one copy. Claude Code and the Claude apps read them straight off the server.
Distribute once
Publish a skill to the server and every teammate whose agent connects reads it there. Nobody copies folders between machines.
Keep every copy current
Edit a SKILL.md and redeploy. Anyone reading from the server gets the new version, with no pull or reinstall.
Decide who sees which skills
Discovery lists only the skills a caller can read, so the server's auth rules decide which teams get which skills.
Stop broken skills at the door
Each skill is checked against the Agent Skills spec when the server loads it, so a bad edit fails fast instead of reaching an agent.
import hashlib
import json
from pathlib import Path
from mcp.server import MCPServer
mcp = MCPServer("Team Skills")
SKILLS = Path("skills")
@mcp.resource(
"skill://release-notes/SKILL.md",
mime_type="text/markdown",
description="Write release notes from merged pull requests.",
)
def release_notes() -> str:
return read("release-notes/SKILL.md")
@mcp.resource("skill://release-notes/template.md", mime_type="text/markdown")
def release_notes_template() -> str:
return read("release-notes/template.md")
@mcp.resource("skill://release-notes/_manifest", mime_type="application/json")
def release_notes_manifest() -> str:
return manifest("release-notes", ["SKILL.md", "template.md"])
@mcp.resource(
"skill://triage/SKILL.md",
mime_type="text/markdown",
description="Label and assign new issues.",
)
def triage() -> str:
return read("triage/SKILL.md")
@mcp.resource("skill://triage/labels.md", mime_type="text/markdown")
def triage_labels() -> str:
return read("triage/labels.md")
@mcp.resource("skill://triage/_manifest", mime_type="application/json")
def triage_manifest() -> str:
return manifest("triage", ["SKILL.md", "labels.md"])
@mcp.resource(
"skill://incident-review/SKILL.md",
mime_type="text/markdown",
description="Run a blameless incident review.",
)
def incident_review() -> str:
return read("incident-review/SKILL.md")
@mcp.resource("skill://incident-review/checklist.md", mime_type="text/markdown")
def incident_review_checklist() -> str:
return read("incident-review/checklist.md")
@mcp.resource("skill://incident-review/_manifest", mime_type="application/json")
def incident_review_manifest() -> str:
return manifest("incident-review", ["SKILL.md", "checklist.md"])
def read(path: str) -> str:
return (SKILLS / path).read_text(encoding="utf-8")
def manifest(skill: str, files: list[str]) -> str:
entries = []
for file in files:
data = (SKILLS / skill / file).read_bytes()
digest = hashlib.sha256(data).hexdigest()
entries.append({"path": file, "size": len(data), "hash": f"sha256:{digest}"})
return json.dumps({"skill": skill, "files": entries})
if __name__ == "__main__":
mcp.run()from fastmcp import FastMCP, Skill
from fastmcp.skills.provider import SkillCatalogProvider
team_skills = [
Skill.from_directory("skills/release-notes"),
Skill.from_directory("skills/triage"),
Skill.from_directory("skills/incident-review"),
]
mcp = FastMCP("Team Skills", providers=[SkillCatalogProvider(team_skills)])
if __name__ == "__main__":
mcp.run()From the FastMCP team at Prefect
FastMCP Gateway, the best way to deploy and govern MCP servers
Ready to share your server? FastMCP Gateway gives it a live URL. People and agents connect through OAuth. Enterprise plans add SSO, tool-level permissions and audit logs.
Hosting
Connect a GitHub repo and get a live URL for your server in about a minute. Every push redeploys it.
Learn morePrivate registry
One list of every server your teams build, import or compose. Each one shows its owner, version and approval status.
Learn moreAccess control
Set tool-level permissions from the identity provider you already run. Every call is logged.
Learn moreVirtual servers
Build one endpoint per team or agent from the servers you already run. Each one sees only the tools it should.
Learn more
Enterprise features for your MCP servers
Talk to our teamSelf-host or serverless
Run your FastMCP servers on your own infrastructure, or deploy them to FastMCP Gateway. It scales to zero when idle.
Use your existing identity provider
Sign in through SAML SSO and provision users with SCIM. MCP clients connect through managed OAuth.
Control access to your servers
Grant roles per server and per tool. Discovering, using and managing a server are separate permissions.
Reach your systems from static IPs
Gateway calls your upstream services from known IP addresses you can add to an allowlist.
Full observability
Every access attempt is logged with who called what, when, and whether it was allowed.
For coding agents
Build it with your coding agent
Give your agent the FastMCP docs and a starting point for your project.
- Claude Code
- Codex
- T3 Code
- OpenCode
Build servers. Connect clients. Add interfaces.
The three examples below share one catalog search. FastMCP handles the protocol so you can focus on your application.
Built in the open, with a lot of help
FastMCP's high-level API went into the official MCP Python SDK in 2024. The standalone project has grown with its contributors ever since. It is Apache 2.0 licensed and developed on GitHub.
What’s new
FastMCP 4 is built for the new MCP protocolProtocol negotiation, interactive tools, session state, background work, server extensions and enterprise identity.From the blog
- How to tell if your MCP server is actually goodSep 2026
- FastMCP 4 is GAAug 2026
- What the “C” in MCP actually meansJul 2026
Get started
Pick a route. Each one is a short page in the docs, with code you can paste.
- Build a serverWrite a tool, run the server and call it from a client.
- Connect a clientCall any MCP server from Python, in memory, over stdio or over HTTP.
- Run and deployRun it locally, serve it over HTTP or deploy it to FastMCP Gateway.
- Build an interactive appReturn a chart and a searchable table from one tool.
Build with FastMCP.
Deploy with FastMCP Gateway.
Deploy your FastMCP server and make it available to the people and agents that need it. Connect a GitHub repo and get a live URL in about a minute.