Key Features
Simple Decorator API
Define tools, resources, and prompts with Python decorators — no boilerplate:
@mcp.tool()
def search_files(query: str, max_results: int = 10) -> list[str]:
"""Search files matching query."""
...Automatic Type Validation
Uses Pydantic for automatic request/response validation from type hints.
Built-in Testing
from fastmcp.testing import MCPTestClient
async with MCPTestClient(mcp) as client:
result = await client.call_tool("add", {"a": 1, "b": 2})
assert result == 3MCP Client
Also includes a Python MCP client for connecting to any MCP server.
OpenAPI Integration
Import existing OpenAPI/Swagger specs to auto-generate MCP tools from REST APIs.
FAQ
Q: What is FastMCP? A: FastMCP is a Python framework for building MCP servers and clients with a clean decorator API. It handles protocol complexity, type validation, and serialization automatically. 24K+ stars on GitHub.
Q: How is FastMCP different from the official MCP SDK? A: FastMCP provides a higher-level, more Pythonic API with decorators, automatic type validation, built-in testing, and OpenAPI integration — reducing boilerplate significantly.