Python framework for MCP servers, clients, and in-conversation apps, now incorporated into the official MCP Python SDK.
You want Claude to call a tool that doesn't have an MCP server yet, your internal API, a local script, a database query. FastMCP covers three use cases: Servers (expose Python functions as MCP tools with auto-generated schemas), Clients (connect to any MCP server with full protocol support), and Apps (interactive UIs within conversations). FastMCP 1.0 was incorporated into the official MCP Python SDK. It handles validation, documentation, transport negotiation, and authentication automatically.
Steps
FastMCP uses decorators. Annotate a Python function with @mcp.tool() and it becomes a callable MCP tool. The function signature becomes the schema, type hints are automatically converted.
Run the server with `fastmcp run server.py` and add it to your Claude Code MCP config. Ask Claude to call the tool by name and verify the return value.
FastMCP supports three primitives: Tools (functions Claude calls), Resources (URI-addressable data Claude reads), and Prompts (reusable templates Claude invokes by name). Add a @mcp.resource() for any reference data and a @mcp.prompt() for any workflow you repeat across sessions.
How do you know it worked?
If something looks off
Skills & Commands Reference
FastMCP's three primitives, Tools, Resources, and Prompts, and the commands to run and install servers.
| Command / Skill | What it does | When to use it |
|---|---|---|
@mcp.tool() | Expose a Python function as an MCP tool, docstring becomes the description, type hints become the schema | Wrapping any function or API you want Claude to call, the primary FastMCP building block |
fastmcp run server.py | Start the FastMCP server locally for testing before adding to Claude Code MCP config | Every dev iteration, verify the tool appears in the session before declaring it working |
fastmcp install server.py --name X | Install the server into Claude Desktop or Claude Code config automatically | One-command install instead of manually editing settings.json, faster for iteration |
@mcp.resource(uri=...)advanced | Expose URI-addressable data (files, API responses, live metrics) that agents read as context | Data the agent should read for context, not call as a function, config, docs, dashboards |
@mcp.prompt()advanced | Register a reusable prompt template callable by name from any MCP client | Workflows you run the same way more than twice, make it a named prompt instead of re-pasting |
Context objectadvanced | Injected into tools for structured logging and progress reporting during long-running calls | Tools that take >1s to complete, clients can show progress instead of a blank wait |