opentelemetry-instrumentation-mcp
OpenTelemetry mcp instrumentation
What it is and what it does
This package integrates the MCP Python SDK with OpenTelemetry to emit distributed traces from agentic workflows. When you call `McpInstrumentor().instrument()`, it hooks into MCP framework calls to generate spans that track tool invocations, prompts sent to LLMs, and completions received—giving you visibility into how your agent is using tools and interacting with language models.
By default, the instrumentation logs the actual content of prompts, completions, and embeddings to span attributes, which helps with debugging and evaluation but may expose sensitive user data. You can disable this by setting `TRACELOOP_TRACE_CONTENT=false` to reduce trace size and protect privacy. The package depends on the OpenTelemetry API and instrumentation base libraries, plus semantic convention definitions for AI workloads.
Use it for:
- Debug agentic workflows by viewing the full trace of tool calls, prompts, and LLM responses in your observability backend.
- Monitor production MCP applications to detect tool call failures, latency spikes, or unexpected LLM behavior.
- Evaluate agent performance by analyzing spans to understand which tools are called most frequently and how long each step takes.
- Reduce trace volume in privacy-sensitive environments by disabling content logging while keeping structural tracing intact.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds distributed tracing to MCP (Model Context Protocol) agentic workflows by instrumenting the MCP Python SDK to emit OpenTelemetry spans tracking tool calls, prompts, and completions.
Yes, if you are building or running MCP-based agentic workflows and need observability. The package is actively maintained, has no known vulnerabilities, and integrates cleanly into the OpenTelemetry ecosystem. Install it when you want to trace tool calls and LLM interactions; skip it if you have no observability infrastructure or are not using the MCP framework.
Install
opentelemetry-instrumentation-mcp on PyPI
pip
pip install opentelemetry-instrumentation-mcpuv
uv add opentelemetry-instrumentation-mcppoetry
poetry add opentelemetry-instrumentation-mcpInstalling opentelemetry-instrumentation-mcp
Before you install
Low friction install with four runtime dependencies on the OpenTelemetry ecosystem. Active maintenance with a recent release (4 days old) and an established repository.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and note material changes.
Quickstart
pip install opentelemetry-instrumentation-mcp
from opentelemetry.instrumentation.mcp import McpInstrumentor
McpInstrumentor().instrument()
Requires Python 3.10 or later; requires an OpenTelemetry SDK and exporter already configured in your application.
Verify before relying
- Whether this instrumentation works with all MCP framework versions or has specific version constraints beyond what the fact sheet shows.
- What span attributes are captured beyond prompts, completions, and embeddings.
- Performance overhead of instrumentation on typical agentic workflows.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<4,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions-ai, opentelemetry-semantic-conventions |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,716,888/month — #1,865 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: opentelemetry_instrumentation_mcp-0.62.3-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-openai-agentsAdds distributed tracing to OpenAI Agents…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-bedrockAdds distributed tracing to AWS Bedrock API…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-haystackAdds distributed tracing to Haystack LLM…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-crewaiAdds OpenTelemetry tracing to crewAI agentic…
permissive · top 5,000 on PyPI
openinference-instrumentation-mcpAuto-instruments MCP tool calls to propagate…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-djangoAdds distributed tracing to Django applications…
permissive · top 1,000 on PyPI
opentelemetry-instrumentation-groqAutomatically captures traces of Groq SDK API…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-ollamaAdds distributed tracing to Ollama Python…
permissive · top 5,000 on PyPI
opencensus-ext-loggingEnriches Python log records with OpenCensus…
permissive · top 15,000 on PyPI
oneagent-sdkExtends Dynatrace monitoring into Python…
permissive · top 15,000 on PyPI