How to monitor MCP agents with OpenTelemetry: tool call spans, attributes, latency and errors A developer has published a guide to tracing Model Context Protocol (MCP) agents with OpenTelemetry, recommending span names of the form '{MCP method} {target}' and attributes such as mcp.method.name, gen_ai.tool.name and error.type. The writeup notes that the official Python SDK version 2 already emits a SERVER span per MCP message using only the OpenTelemetry API, and that trace context is propagated through the params._meta field of each request since HTTP headers and stdio cannot carry it. It also warns that opt-in tool argument and result attributes may expose personal data or secrets. You need to monitor MCP agents with OpenTelemetry as soon as an AI assistant calls your tools in production. An agent that answers slowly, picks the wrong tool or chains ten calls where two would do raises no classic alert: the process is running, the port responds, and yet the experience degrades and the bill climbs. The good news is that an MCP tool call is nothing more than a distributed operation: a client sends a request, a server processes it, possibly by calling other services. Distributed traces, which SRE teams already know well, apply directly, provided you choose the right span names and the right attributes. This article shows how to trace an MCP server and agent, which attributes to track, and how to turn them into actionable latency and error indicators. In an MCP architecture described in our guide to the Model Context Protocol https://span.observer/en/model-context-protocol-explained/ , a single user question can trigger a cascade: a call to the model, the choice of a tool, a request to the MCP server, then calls from the server to a database, an API or an observability platform. Without traces, each link is a black box. OpenTelemetry brings three things: a standard, vendor-neutral format; shared semantic conventions for naming generative AI operations; and context propagation, which links the agent, the MCP server and downstream services in a single trace. It is the same logic as the one described for end-to-end OpenTelemetry https://span.observer/en/opentelemetry-end-to-end-dynatrace/ , applied to a new type of call. A span describes an operation: a name, a type kind , a start and an end, a status, attributes and possibly events. For MCP, the OpenTelemetry GenAI semantic conventions, still at « development » status, offer a precise vocabulary. The recommended name follows the form {MCP method} {target} , for example tools/call chercher runbooks . It contains the tool name, never its arguments or an identifier, so that calls group cleanly in analysis views. mcp.method.name : the JSON-RPC method tools/call , resources/read … ; gen ai.operation.name = execute tool and gen ai.tool.name : these let you treat an MCP call like any other agent tool call; mcp.protocol.version , mcp.session.id and jsonrpc.request.id for diagnosis; mcp.resource.uri for resource reads; error.type on failure. Tool arguments and results also exist as optional opt-in attributes. They are invaluable for debugging, but may contain personal data or secrets: only enable them knowingly. HTTP trace context is not enough: a single HTTP request can carry several MCP messages, and stdio has no headers. The conventions therefore inject traceparent and optionally baggage into the params. meta field of each MCP request. The server extracts it and attaches its span to the client’s span. Good news if your server uses the official Python SDK version 2: it already emits a SERVER span for each message received, with the attributes above. It depends only on the OpenTelemetry API; as long as no SDK is installed, these spans cost almost nothing. To collect them, simply add the SDK and an OTLP exporter: pip install opentelemetry-sdk opentelemetry-exporter-otlp For other SDKs and frameworks, check their documentation to see whether instrumentation exists or whether you need to create these spans yourself. Standard configuration uses environment variables. To send directly to Dynatrace, you need the environment’s OTLP endpoint and an API token allowed to ingest traces; check the exact URL and scope in the documentation: export OTEL SERVICE NAME=runbooks-mcp export OTEL EXPORTER OTLP PROTOCOL=http/protobuf export OTEL EXPORTER OTLP ENDPOINT=https://YOUR-ENV.live.dynatrace.com/api/v2/otlp export OTEL EXPORTER OTLP HEADERS="Authorization=Api-Token%20