How It Works
FastMCP uses the OpenTelemetry API for instrumentation. This means:- Zero configuration required - Instrumentation is always active
- No overhead when unused - Without an SDK, all operations are no-ops
- Bring your own SDK - You control collection, export, and sampling
- Works with any OTEL backend - Jaeger, Zipkin, Datadog, New Relic, etc.
Enabling Telemetry
The easiest way to export traces is usingopentelemetry-instrument, which configures the SDK automatically:
OpenTelemetry Python Documentation
Learn more about the OpenTelemetry Python SDK, auto-instrumentation, and available exporters.
Tracing
FastMCP creates spans for all MCP operations, providing end-to-end visibility into request handling.Server Spans
The server creates spans for each operation using MCP semantic conventions:
For mounted servers, an additional
delegate {name} span shows the delegation to the child server.
Client Spans
The FastMCP client creates spans for outgoing requests with the same naming pattern (tools/call {name}, resources/read {uri}, prompts/get {name}).
Span Hierarchy
Spans form a hierarchy showing the request flow. For mounted servers:Programmatic Configuration
For more control, configure the SDK in your Python code before importing FastMCP:Local Development
For quick local trace visualization, otel-desktop-viewer is a lightweight single-binary tool:Custom Spans
You can add your own spans using the FastMCP tracer:Error Handling
When errors occur, spans are automatically marked with error status and the exception is recorded:Attributes Reference
RPC Semantic Conventions
Standard RPC semantic conventions:MCP Semantic Conventions
FastMCP implements the OpenTelemetry MCP semantic conventions:Auth Attributes
Standard identity attributes:FastMCP Custom Attributes
All custom attributes use thefastmcp. prefix for features unique to FastMCP:
Provider-specific attributes for delegation context: