instrumentServer.
They cover the lifecycle of every tool call and the process itself.
mcp.server.operation.duration
Attributes
Use cases
- p50/p95/p99 latency per tool.
- Error-rate alerts.
- SLO budgets.
mcp.server.operation.count
Attributes
Use cases
- Traffic alerts (sudden drop, sudden spike).
- Per-tool usage breakdown.
- Heartbeat — if this stops incrementing, the server is stuck.
mcp.server.session.duration
Attributes
Use cases
- Track process lifetime distribution (cold starts vs long-running).
- Alert on unexpectedly short sessions (crashes).
What’s not (yet) automatic
These are common metrics you may want to record yourself today — see Custom instrumentation.- Per-tool input/output sizes.
- Upstream API latency for tools that call external services.
- Cache hit ratios.
- Token / context usage when tools wrap LLM calls.
See also
Automatic attributes
Span attributes the package writes for free.
Custom instrumentation
Add your own spans, histograms, and counters.