What it is
MCP observability is the practice of seeing what an agent asked for, what each MCP server did, and what it cost, across every hop of a request. Because a model chooses its own tools and arguments, you need the path recorded as well as the result: a trace of the run, metrics for health, structured audit events for governance, and evaluations for quality.
OpenTelemetry now defines semantic conventions for MCP: span names such as tools/call get-weather, standard attributes and metrics, and a way to carry W3C trace context inside the request's _meta so one trace follows a call from agent through gateway to server. Together with the protocol's own logging and progress features, they make agent systems debuggable and auditable.
How it works
Identify
Agree names for agents, servers, tools, users and teams, and put a trace ID on everything.
Instrument the edges
Add spans and the standard metrics at the gateway and in each MCP server.
Propagate context
Inject trace context into params._meta so client, gateway and server share one trace.
Record and redact
Emit structured audit events and strip secrets and personal data before storage.
Watch and alert
Dashboards per tool and per agent, plus alerts on errors, latency, cost and policy changes.
Evaluate and improve
Score tool selection and task success on traced runs, then refine tools and prompts.
Why MCP needs its own observability
Observability tells you what a system did and why. With MCP, the system includes a model that chooses its own actions, so the usual dashboards of request counts and error codes are not enough.
Non-deterministic callers
The model decides which tool to call and with what arguments. The same request can take different paths, so you need the path recorded, not just the result.
Many hops, many owners
One user request may cross an agent, a model, a gateway, several MCP servers and downstream APIs, each owned by a different team.
Failures that look like success
A tool can return a valid response that is wrong, truncated or poisoned. HTTP 200 tells you nothing about whether the agent did the right thing.
Protocol-level traffic
MCP runs over JSON-RPC inside long-lived sessions and streams, so one HTTP request can carry many MCP calls. HTTP metrics alone do not describe what happened.
Cost hides in the loop
Agents repeat steps. Latency and token spend come from how many times they loop and how much each tool returns.
Security and audit need evidence
Investigating a misuse or an injection attempt requires a trustworthy record of who called which tool with what.
The signals
Traces
The causal story of one request: agent step, model call, tool call, server work, downstream calls, with timing and errors.
Metrics
Aggregates for dashboards and alerts: call rates, error rates, latency distributions, session counts, token and cost totals.
Logs
Detailed events with context: server diagnostics, warnings, validation failures, redacted arguments.
Audit events
A tamper-resistant, structured record of identity, tool, decision and outcome for governance.
Evaluations
Scores for tool selection, argument correctness and task success, linked to the traces they came from.
What the protocol already gives you
The MCP specification includes several features that double as telemetry sources.
Logging utility
Servers that declare the logging capability send notifications/message with a level (the syslog levels from debug to emergency), an optional logger name and JSON data. Clients can raise or lower verbosity with logging/setLevel. The spec says log messages must not contain credentials, personal information or internal details that could aid attacks.
Progress notifications
A request can carry a progressToken in its _meta. The receiver may then send notifications/progress with a growing progress value, an optional total and a message, which is useful for long-running tools and for showing users that work continues.
Cancellation and ping
Either side can cancel an in-flight request and check that the other is alive. Count cancellations and failed pings as health signals.
JSON-RPC errors
Protocol failures use standard error codes, such as -32602 for invalid params. Tool-level failures come back inside the result. Track both kinds, because they mean different things.
The _meta property bag
Requests and notifications can carry metadata in params._meta. It is the standard place to propagate trace context between client and server.
OpenTelemetry conventions for MCP
OpenTelemetry defines semantic conventions for MCP spans and metrics, so traces and dashboards look the same across servers, gateways and vendors. They are still in Development status, so confirm names against the current version before hard-coding them.
Use the MCP conventions
OpenTelemetry recommends its MCP semantic conventions over the generic RPC or HTTP ones, because they capture MCP-specific context such as message exchanges inside streaming calls. The conventions are marked Development, so names may still change.
Span names
{mcp.method.name} {target}, where the target is the tool or prompt name when there is one, for example tools/call get-weather. If no low-cardinality target exists, just the method name. Resource URIs are not put in span names by default to avoid high cardinality.
Span kind
CLIENT on the side that sends the request, SERVER on the side that handles it.
Core attributes
mcp.method.name is required. gen_ai.tool.name or gen_ai.prompt.name apply when the call involves a specific tool or prompt. mcp.resource.uri, jsonrpc.request.id, rpc.status_code and error.type are recorded when relevant, and gen_ai.operation.name can be execute_tool for tool calls.
Context propagation
Inject W3C trace context (traceparent, tracestate) and optionally baggage into params._meta of each request, unprefixed as SEP-414 describes. The server extracts it and uses it as the parent of its span, so one trace spans client, gateway and server over any transport.
Avoid double spans
MCP tool-call spans are compatible with the GenAI execute_tool span. If an outer GenAI instrumentation already traces the tool, add MCP attributes to that span instead of creating a second one.
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "find_overdue_invoices",
"arguments": { "minDays": 14 },
"_meta": {
"traceparent": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"
}
},
"id": 7
}Anatomy of an agent trace
One user request becomes a tree of spans: the agent run, each model call, and each tool call seen from both the client and the server, with the downstream API beneath. This is what lets you answer "why was it slow" or "which step failed" in seconds.
agent.run invoice-followup 6.8 s
├─ chat claude-model (plan) 1.9 s tokens in 4.1k / out 220
├─ tools/call find_overdue_invoices [CLIENT] 0.9 s
│ └─ tools/call find_overdue_invoices [SERVER, billing] 0.8 s
│ └─ GET billing-api /v2/invoices [CLIENT] 0.7 s
├─ chat claude-model (decide) 1.6 s tokens in 6.3k / out 180
├─ tools/call send_reminder_email [CLIENT] 1.2 s
│ └─ tools/call send_reminder_email [SERVER, comms] 1.1 s error.type=timeout
└─ chat claude-model (final) 1.2 sMetrics and SLOs
The OpenTelemetry MCP conventions define four metrics.
| Metric | What it measures | Why it matters |
|---|---|---|
| mcp.client.operation.duration | Histogram of how long client-side MCP operations take, by method, tool and outcome. | Latency the agent actually experiences, including network and queuing. |
| mcp.server.operation.duration | Histogram of how long the server takes to handle each operation. | Server-side latency. Compare with the client number to find transport or gateway delay. |
| mcp.client.session.duration | How long client sessions last. | Spot sessions that drop early or never close. |
| mcp.server.session.duration | How long server-side sessions last. | Capacity planning and leak detection. |
Objectives worth setting
| Objective | How to measure it | Break down by |
|---|---|---|
| Availability | Share of tool calls that complete without a protocol or server error | Per server and per tool |
| Latency | p50 and p95 duration of tools/call | Per tool, because tools differ widely |
| Correctness | Share of calls where the agent picked the right tool with valid arguments | From evaluations, not from HTTP |
| Task success | Share of agent runs that reach the goal within step and cost limits | Per agent and workflow |
| Cost | Tokens and spend per successful task | Per agent, team and model |
| Safety | Rate of blocked, flagged or approval-required calls | Per policy and per tool |
Logs and audit events
Metrics say something is wrong, traces show where, and structured events show who did what. A good audit event ties identity, tool, decision and outcome to a trace.
{
"time": "2026-12-03T14:02:11Z",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"caller": { "user": "a.lee@example.com", "agent": "invoice-followup", "client": "https://app.example.com/oauth/client-metadata.json" },
"server": "billing",
"method": "tools/call", "tool": "find_overdue_invoices",
"arguments_hash": "sha256:9c1f…", "arguments_redacted": { "minDays": 14 },
"decision": "allow", "policy": "finance-read-only",
"status": "ok", "latency_ms": 212, "result_bytes": 2310
}- Correlate everything. Put the trace ID and span ID on every log line so a log entry leads to its trace and back.
- Log decisions, not just outcomes. Record why a call was allowed, blocked or sent for approval, and which policy decided.
- Redact before you write. Strip secrets, tokens and personal data from arguments and results. The MCP spec forbids credentials and personal information in log messages.
- Hash or sample payloads. Store a hash of arguments and results for integrity, and keep full redacted payloads only for a short time or for sampled and failed calls.
- Use structured fields. Fixed field names make queries, alerts and audits reliable across servers.
- Separate audit from debug. Audit records are immutable, access-controlled and retained for compliance. Debug logs are noisy and short-lived.
Cost and token attribution
Tokens by step
Record input and output tokens on every model call, tied to the trace, so you see which step costs most.
Tool output size
Large tool results inflate the next model call. Track result size per tool and cap or summarize it.
Tool-definition overhead
Every connected tool adds definitions to the context. Count tools in context and trim the list with a gateway.
Loops and retries
Count steps per run and retries per tool. A rising step count is an early sign of confusion or a bad tool.
Attribution
Tag spend with user, team, agent and server so budgets and chargeback are possible.
Budgets
Enforce per-run and per-user limits and emit a metric when one is hit.
Quality and evaluation
Healthy infrastructure does not mean a good agent. Score behavior on sampled and failed runs, and link every score to its trace.
Tool selection
Did the agent choose the right tool for the request?
Argument correctness
Were the arguments valid, complete and within policy?
Result handling
Did the agent use the result correctly, or ignore, misread or over-trust it?
Task success
Did the whole run achieve the goal within step and cost limits?
Safety behavior
Did it resist injected instructions and ask for approval when required?
Debugging playbook
| Symptom | Where to look | Typical fix |
|---|---|---|
| Agent called the wrong tool | Tool descriptions, number of tools in context, tool-selection evals | Rewrite descriptions, trim tools, split servers |
| Tool calls are slow | Client vs. server duration, downstream spans, queueing at the gateway | Fix the slow hop, add caching, raise limits |
| Intermittent failures | Error type and status by tool, retries, session durations, cancellations | Add timeouts and idempotency, fix the unreliable dependency |
| Agent loops or never finishes | Step count per run, repeated identical calls, token growth | Add step budgets, improve error messages, fix the tool result |
| Costs spike | Tokens per step, tool result size, tools in context | Summarize or cap results, trim tools, cache |
| Wrong answer, no error | Full trace with tool results and the model's use of them | Check data quality, truncation and injected content |
| Suspected misuse or injection | Audit events, unusual tools or destinations, description changes | Contain, revoke tokens, follow the incident playbook |
Alerting
- Error rate or timeout rate for a tool above its threshold.
- p95 tools/call latency above its objective for several minutes.
- Runs hitting the step or cost budget more often than usual.
- A server or tool appearing that is not in the registry.
- A tool description or schema changing after approval.
- Calls to a sensitive tool outside normal hours, volume or caller groups.
- Policy denials or approval requests spiking for one agent.
- Telemetry gaps, such as a server that stops emitting traces or logs.
Privacy and security of telemetry
- Tool arguments and results often contain sensitive data. Redact, hash or drop them before they reach logs, traces or third-party tools.
- Telemetry is a data store. Apply access control, retention limits and encryption to it like any other store of sensitive data.
- Keep prompts and responses opt-in. Capture full content only where needed, with consent and short retention.
- Protect the audit trail. Write audit events to append-only storage so an attacker cannot erase their tracks.
- Mind cardinality as well as privacy. User IDs or URIs as metric labels can overload the backend and leak identities. Put them in traces and logs instead.
Where to instrument
Agent or client
Spans for the agent run, model calls and client-side tool calls. Sets the trace context and injects it into _meta.
Gateway
The best single place for identity, policy decisions, rate limits and audit events across all servers.
MCP server
Server spans, tool-level timing, downstream API calls, validation errors and business context only the server knows.
Downstream systems
Their own traces and logs, joined to the same trace through propagated context.
Common mistakes
- Only watching HTTP. MCP calls multiplex over one connection, so status codes miss what matters.
- High-cardinality labels. Tool arguments, URIs and user IDs as metric dimensions can break dashboards and budgets.
- Logging raw payloads. It creates a second copy of sensitive data and a new breach surface.
- Broken traces. Without propagating context in _meta, each hop starts a new trace and nobody can follow a request.
- Sampling away the failures. Use tail-based sampling so errors, slow runs and policy denials are always kept.
- No link between traces and evals. Scores that cannot be traced back to a run cannot be debugged.
- Treating it as a one-off. Tool sets, models and prompts change, so dashboards and alerts need owners.
Rolling it out
Pick the identifiers
Agree names for agent, server, tool, user and team, and put the trace ID on everything.
Instrument the edges
Add traces and the standard metrics at the gateway and in each MCP server.
Propagate context
Inject and extract trace context in params._meta so traces connect end to end.
Add audit and redaction
Emit structured audit events and apply redaction before anything is stored.
Build the first dashboards
Per-tool rate, errors and latency, per-agent cost and steps, and policy decisions.
Add evaluations and alerts
Score tool selection and task success, then alert on the signals above.
Review regularly
Use traces to improve tool descriptions, prune tools and set budgets.
Span and metric names follow the OpenTelemetry MCP conventions (Development status) and the 2025-11-25 MCP specification, and may change. Traces and events shown are illustrative.
Sources
- Semantic conventions for Model Context Protocol (OpenTelemetry)OpenTelemetry
- MCP specification: LoggingModel Context Protocol
- MCP specification: ProgressModel Context Protocol
- W3C Trace ContextW3C
- OpenTelemetry: Generative AI semantic conventionsOpenTelemetry
Key concepts
- MCP semantic conventions
- OpenTelemetry's standard span, attribute and metric definitions for MCP.
- Context propagation via _meta
- Carrying traceparent and baggage inside MCP requests so traces connect across hops and transports.
- Span naming
- {mcp.method.name} {target}, such as tools/call get-weather, with low-cardinality targets.
- Audit event
- A structured, tamper-resistant record of caller, tool, decision and outcome.
- Cardinality
- The number of distinct label values. High-cardinality labels like user IDs or URIs belong in traces and logs, not metrics.
- Tail-based sampling
- Deciding to keep a trace after it finishes, so errors and slow runs are always retained.
- Token attribution
- Tying model token use to the user, agent, tool and trace that caused it.
- Evaluation linked to traces
- Quality scores that point back to the exact run that earned them.
Tools & platforms
Standards
Backends and platforms
LLM observability
Skills employers look for
- Instrumenting MCP clients, gateways and servers with OpenTelemetry.
- Propagating trace context through params._meta across transports.
- Designing metrics, objectives and alerts for tool calls and agent runs.
- Building audit events with redaction, hashing and retention.
- Attributing token and tool cost, and enforcing budgets.
- Using traces and evaluations to debug and improve agent behavior.
Enterprise use cases
Production agent platform
Per-tool and per-agent dashboards, with traces from user request through every MCP server.
Security investigation
Reconstruct which agent called which tool for which user after a suspected injection or misuse.
Cost control
Find the tools and steps that drive token spend, and cap them.
Server owner support
A tool owner sees exactly how agents call their server, where it fails and which descriptions confuse the model.
Common pitfalls
- Relying on HTTP metrics — MCP calls multiplex over one connection, so status codes miss what matters.
- Logging raw arguments and results — it duplicates sensitive data into a new store.
- Breaking trace context at the gateway or server — each hop starts a fresh trace and nobody can follow a request.
- High-cardinality metric labels — URIs, arguments or user IDs can overwhelm the backend.
- Sampling away the failures — keep errors, slow runs and policy denials with tail-based sampling.
How MrAI.dev helps
We instrument your agents, gateway and MCP servers with OpenTelemetry, design the dashboards, objectives and alerts that matter, build redacted audit trails, and connect traces to evaluations so you can see, debug and govern agent behavior in production.
Book a discovery call