How prefecthq/fastmcp works
FastMCP is a Python framework for building MCP servers, clients, and interactive apps. A developer defines server components; the server exposes them over MCP, and a host or agent connects through a client and transport to discover and invoke them. Providers and transforms shape what the server exposes, while authentication, apps, and background tasks extend that workflow. The README documents the three main product pillars; the source index supports selected internal links. Other subsystem links are omitted where the supplied excerpts do not establish their runtime wiring.
Main entry points: server.py Server Runtime · client.py Client Runtime · tools Tools, Resources, Prompts · base.py Client Transports
Components 21
MCP Servers
- Server Runtime
fastmcp_slim/fastmcp/server/server.py - Tools, Resources, Prompts
fastmcp_slim/fastmcp/tools - Component Providers
fastmcp_slim/fastmcp/server/providers - Component Transforms
fastmcp_slim/fastmcp/server/transforms - Server Authentication
fastmcp_slim/fastmcp/server/auth - HTTP Server
fastmcp_slim/fastmcp/server/http.py
MCP Clients
- Client Runtime
fastmcp_slim/fastmcp/client/client.py - Client Transports
fastmcp_slim/fastmcp/client/transports/base.py - HTTP, SSE, stdio
fastmcp_slim/fastmcp/client/transports/http.py - OAuth Client
fastmcp_slim/fastmcp/client/auth/oauth.py
Product Extensions
- Interactive Apps
fastmcp_slim/fastmcp/apps/app.py - Skills
fastmcp_slim/fastmcp/skills - Event Subscriptions
fastmcp_slim/fastmcp/experimental/events/client.py - OpenAPI Provider
fastmcp_slim/fastmcp/server/providers/openapi/provider.py - Task Client
fastmcp_tasks/fastmcp_tasks/client.py - Task Handlers
fastmcp_tasks/fastmcp_tasks/handlers.py - Task Context
fastmcp_tasks/fastmcp_tasks/context.py
CLI Operations
- Client CLI
fastmcp_slim/fastmcp/cli/client.py - Remote CLI
fastmcp_remote/fastmcp_remote/cli.py
Other components
- Developer
- MCP Host
Connections 19
- Developer → Tools, Resources, Prompts: defines components
README.md - Tools, Resources, Prompts → Server Runtime: exposed by
fastmcp_slim/fastmcp/server/server.py - Server Runtime → Component Providers: resolves components
fastmcp_slim/fastmcp/server/server.py - Server Runtime → Component Transforms: applies transforms
fastmcp_slim/fastmcp/server/server.py - Server Runtime → Server Authentication: uses auth
fastmcp_slim/fastmcp/server/server.py - MCP Host → Client Runtime: connects
README.md - Client Runtime → Client Transports: opens session
fastmcp_slim/fastmcp/client/client.py - Client Transports → HTTP, SSE, stdio: implements transport
fastmcp_slim/fastmcp/client/transports/inference.py - Client Runtime → OAuth Client: configures auth
fastmcp_slim/fastmcp/client/client.py - Client Runtime → Server Runtime: sends MCP requests
fastmcp_slim/fastmcp/server/server.py - Interactive Apps → Component Providers: uses provider
fastmcp_slim/fastmcp/apps/app.py - Interactive Apps → Tools, Resources, Prompts: registers backend tools
fastmcp_slim/fastmcp/apps/app.py - OpenAPI Provider → Component Providers: provides components
- Task Client → Client Runtime: uses client
fastmcp_tasks/fastmcp_tasks/client.py - Task Handlers → Task Context: uses task context
fastmcp_tasks/fastmcp_tasks/handlers.py - Task Handlers → Server Runtime: looks up tools
fastmcp_tasks/fastmcp_tasks/handlers.py - Client CLI → Client Runtime: connects through
fastmcp_slim/fastmcp/cli/client.py - Client CLI → Client Transports: selects transport
fastmcp_slim/fastmcp/cli/client.py - Remote CLI → Server Runtime: configures proxy
fastmcp_remote/fastmcp_remote/cli.py