FastMCP: Python framework for MCP servers and clients
Build Model Context Protocol servers with decorators.
Learn more about FastMCP
FastMCP is a Python framework that simplifies development of Model Context Protocol applications. It uses Python decorators to expose functions as MCP tools and provides built-in support for resources, prompts, and context management. The framework includes authentication integrations, deployment utilities, and client libraries for connecting to MCP servers. Common use cases include building AI agent backends, integrating data sources with LLM applications, and creating composable tool ecosystems.
Decorator-Based Tool Definition
Python decorators expose functions as MCP tools and resources without manual protocol implementation. Reduces boilerplate while maintaining compatibility with the standard Python SDK.
Enterprise Authentication Integrations
Pre-built support for Google, GitHub, WorkOS, Azure, and Auth0 authentication providers. Eliminates custom OAuth implementation for production deployments requiring user authentication.
Server Composition and Proxying
Combine multiple MCP servers, proxy requests between instances, and generate OpenAPI/FastAPI interfaces from MCP definitions. Enables modular architectures and integration with existing web frameworks.
from fastmcp import FastMCP
mcp = FastMCP("My AI Agent")
@mcp.tool()
def calculate_sum(a: int, b: int) -> int:
"""Add two numbers together."""
return a + b
if __name__ == "__main__":
mcp.run()Beta release with MCP Apps Phase 1 SDK compatibility and new CLI commands.
- –Add MCP Apps Phase 1 — SDK compatibility
- –Add fastmcp list and fastmcp call CLI commands
- –Add fastmcp generate-cli command
- –Add CIMD (Client ID Metadata Document) support for OAuth
- –Make duplicate bot less aggressive
Fixed memory leak in memory:// docket broker where cancelled tasks were accumulating.
- –Bump pydocket to 0.17.2 (memory leak fix)
Fixed fresh install bug and backported tool schema compatibility fixes.
- –Dereference $ref in tool schemas for MCP client compatibility
- –Fix task capabilities location
- –Add missing packaging dependency
See how people are using FastMCP
Top in AI & ML
Related Repositories
Discover similar tools and frameworks used by developers
Stable Diffusion WebUI
Web UI for Stable Diffusion enabling AI image generation and editing in browser.
Continue
Multi-LLM coding agent with interactive and automated modes.
Prompt Engineering Guide
Guides, papers, and resources for prompt engineering, RAG, and AI agents.
Ray
Unified framework for scaling AI and Python applications from laptops to clusters with distributed runtime.
PyTorch
Python framework for differentiable tensor computation and deep learning.