OpenSource-Hub

fastmcp

Framework

PrefectHQ/fastmcp

Fast, Pythonic framework for building MCP servers and clients for LLMs.

Overview

FastMCP is a Python framework that simplifies building servers and clients for the Model Context Protocol (MCP). It provides automatic schema generation, validation, and documentation for tools, resources, and prompts. Designed for LLM integration, it powers the majority of MCP servers across languages.

README Preview

\n\n\n\n\n  \n  \n  \n\n\n# FastMCP 🚀\n\nMove fast and make things.\n\n*Made with 💙 by [Prefect](https://www.prefect.io/)*\n\n[](https://gofastmcp.com)\n[](https://discord.gg/uu8dJCgttd)\n[](https://pypi.org/project/fastmcp)\n[](https://github.com/PrefectHQ/fastmcp/actions/workflows/run-tests.yml)\n[](https://github.com/PrefectHQ/fastmcp/blob/main/LICENSE)\n\n\n\n\n---\n\nThe [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) connects LLMs to tools and data. FastMCP gives you everything you need to go from prototype to production:\n\n```python\nfrom fastmcp import FastMCP\n\nmcp = FastMCP("Demo 🚀")\n\n@mcp.tool\ndef add(a: int, b: int) -> int:\n    """Add two numbers"""\n    return a + b\n\nif __name__ == "__main__":\n    mcp.run()\n```\n\n## Why FastMCP\n\nBuilding an effective MCP application is harder than it looks. FastMCP handles all of it. Declare a tool with a Python function, and the schema, validation, and documentation are generated automatically. Connect to a server with a URL, and transport negotiation, authentication, and protocol lifecycle are managed for you. You focus on your logic, and the MCP part just works: **with FastMCP, best practices are built in.**\n\n**That's why FastMCP is the standard framework for working with MCP.** FastMCP 1.0 was incorporated into the official MCP Python SDK in 2024. Today, the actively maintained standalone project is downloaded a million times a day, and some version of FastMCP powers 70% of MCP servers across all languages.\n\nFastMCP has three pillars:\n\n\n\n\n\n\nServers\n\nExpose tools, resources, and prompts to LLMs.\n\n\n\n\nApps\n\nGive your tools interactive UIs rendered directly in the conversation.\n\n\n\n\nClients\n\nConnect to any MCP server — local or remote, programmatic or CLI.\n\n\n\n\n**[Servers](https://gofastmcp.com/servers/server)** wrap your Python functions into MCP-compliant tools, resources, and prompts. **[Clients](https://gofastmcp.com/clients/client)** connect to any serv