Main
Start from the minimal server example, then move each tool into small, testable Python functions with clear docstrings.
Keep tool contracts stable: treat schemas and return types as an API, and version changes in your MCP server like any other service.
Add production concerns early (timeouts, rate limits, auth) and keep a staging server to validate client compatibility.
Use the project docs links for server/client/app patterns instead of inventing protocol glue by hand.
README (excerpt)
The Model Context Protocol (MCP) connects LLMs to tools and data. FastMCP gives you everything you need to go from prototype to production:
from fastmcp import FastMCP
mcp = FastMCP("Demo 🚀")
@mcp.tool
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
if __name__ == "__main__":
mcp.run()Why FastMCP
Building 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.
Source-backed notes
- README shows a minimal server using
FastMCP("Demo"), a@mcp.toolfunction, andmcp.run(). - README recommends installing via
uv pip install fastmcpand links to a dedicated docs site. - Project description frames FastMCP as a higher-level way to build MCP servers/clients without manual schema wiring.
FAQ
- Is FastMCP a server or a client?: README describes both server and client patterns; start by building a server first.
- Do I need uv?: README recommends uv, but pip-based installs are also common for Python libraries.
- How do I keep tool behavior predictable?: Treat tool schemas as an API contract, add tests, and version breaking changes.