# FastMCP — Build MCP Servers in Python, Fast > The fast, Pythonic way to build MCP servers and clients. Clean decorator API, automatic type validation, built-in testing, and OpenAPI integration. 24K+ GitHub stars. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use ```bash pip install fastmcp ``` ```python from fastmcp import FastMCP mcp = FastMCP("My Server") @mcp.tool() def add(a: int, b: int) -> int: """Add two numbers.""" return a + b mcp.run() ``` --- ## Intro FastMCP is the fastest way to build MCP (Model Context Protocol) servers and clients in Python. It provides a clean, decorator-based API that handles all the protocol complexity — type validation, error handling, serialization — so you can focus on building tools. 24,000+ GitHub stars, actively maintained. **Best for**: Python developers building MCP servers for AI coding tools **Works with**: Claude Code, Cursor, Gemini CLI, VS Code, any MCP client --- ## Key Features ### Simple Decorator API Define tools, resources, and prompts with Python decorators — no boilerplate: ```python @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 ```python from fastmcp.testing import MCPTestClient async with MCPTestClient(mcp) as client: result = await client.call_tool("add", {"a": 1, "b": 2}) assert result == 3 ``` ### MCP 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. --- ## Source & Thanks > Created by [PrefectHQ](https://github.com/PrefectHQ). Licensed under Apache 2.0. > [PrefectHQ/fastmcp](https://github.com/PrefectHQ/fastmcp) — 24,000+ GitHub stars --- Source: https://tokrepo.com/en/workflows/a17a107c-c77e-4c3f-ae09-d2fd985eba93 Author: MCP Hub