Registry / observability / openinference-instrumentation-mcp

openinference-instrumentation-mcp

JSON →
library2.0.3pypypiunverified

OpenInference instrumentation for MCP (Model Context Protocol) clients, enabling OpenTelemetry-based tracing of MCP tool calls and server interactions. Current version 2.0.0, requires Python >=3.10 <3.15. Part of the Arize AI OpenInference ecosystem. Active development with frequent releases.

pip install openinference-instrumentation-mcp
INSTALL
IMPORT
SIG · OPENINFERENCE-INST
O
openinference-instrumentation-mcp
observabilitypythonv2.0.3
Install
2.6s avg
Import
Disk
22MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 2.9s
py 3.11
✓ —
✓ 2.7s
py 3.12
✓ —
✓ 2.5s
py 3.13
✓ —
✓ 2.4s
py 3.9
✕ build_error
✕ build_error
22MB installed
● package 22MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MCPClientInstrumentor
from openinference.instrumentation.mcp import MCPClientInstrumentor
from openinference_instrumentation_mcp import MCPClientInstrumentor

Instrument MCP client with OpenInference tracing.

import os from opentelemetry import trace from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import SimpleSpanProcessor from openinference_instrumentation_mcp import MCPClientInstrumentor # Set up OpenTelemetry tracer provider provider = TracerProvider() provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint=os.environ.get('OTEL_EXPORTER_OTLP_ENDPOINT', 'http://localhost:4318/v1/traces')))) trace.set_tracer_provider(provider) # Instrument MCP client MCPClientInstrumentor().instrument() # Now any MCP client sessions will be traced.
Debug
Known issues
breakingVersion 2.0.0 introduces a BREAKING CHANGE: support for streamable_http_client. Existing instrumentations using older MCP client versions may break. Update MCP library to compatible version.
fix
Upgrade MCP library to version that supports streamable_http_client (mcp>=1.6.0). Review your MCP server's streaming transport.
affects: <2.0.0
gotchaInstrumentation must be set up before creating any MCP client sessions. If MCP client is imported and used before calling MCPClientInstrumentor().instrument(), the instrumentation will not apply.
fix
Call MCPClientInstrumentor().instrument() immediately after setting up the tracer provider and before importing/using mcp.ClientSession or any MCP client.
affects: all
gotchaThe instrumentation only instruments the client side, not the server. Do not expect server-side spans unless you set up instrumentation on the server as well.
fix
Use a separate OpenInference instrumentation for your MCP server (e.g., openinference-instrumentation-mcp-server) if available.
affects: all
deprecatedWrapt 2.x is supported, but older instrumentations may require wrapt<2. If you encounter import errors related to wrapt, check compatibility.
fix
Ensure wrapt is installed. For wrapt 2.x compatibility, use openinference-instrumentation>=0.1.47.
affects: >=1.0.0
Upgrade
Version history
2.0.3latest on PyPI · released May 18, 2026
Audit
Dependencies
openinference-instrumentationrequiredCore instrumentation base classes and utilities
mcprequiredRequired to instrument MCP client sessions
openinference-semantic-conventionsrequiredSemantic convention constants for OpenInference spans
opentelemetry-apirequiredOpenTelemetry API for span creation and context propagation
wraptrequiredUsed for monkey-patching MCP client methods
Agent activity
34 hits · last 30 days
node
30
OpenAI (training)
2
Amazon
1
Resources