Skip to main content

MCP OpenTelemetry integration

Connect trace context across Python MCP client and server transports. traceAI-mcp propagates context; it does not create spans or configure a tracer provider.

Native MCP 2.x tracing

For MCP 2.3 and later in the 2.x series, prefer the SDK's native OpenTelemetry support. It creates client request and server operation spans, including tool names, and propagates W3C trace context. Do not enable MCPInstrumentor alongside this native route.

Follow the Python MCP tracing guide for standard OpenTelemetry configuration and a runnable calculator client/server. No OpenAI API key, agent framework, or copied instrumentation wrapper is required. Configure a provider/exporter in each process; a client cannot export a remote server's spans.

Native MCP error spans can contain exception text and stack traces. The FI_HIDE_* settings do not control native MCP telemetry. Use safe tool names and error messages, and apply your Collector's redaction policy when needed.

MCP 1.x context propagation

Use Python 3.11–3.13. Install the published package and the MCP 1.x SDK:

pip install "traceAI-mcp>=0.1.3" "mcp>=1.30.0,<2"

Keep your existing application, agent, or model instrumentation to create spans. Configure its provider/exporter in both client and server processes. Enable MCP propagation in each process before importing transport functions:

from traceai_mcp import MCPInstrumentor

MCPInstrumentor().instrument()

The instrumentor connects existing spans; installing it alone will not create a request or tool span tree. It requires mcp>=1.30.0; new MCP 2.x setups should use the native route instead.

Upgrading older MCP 1.x applications

Upgrade the MCP SDK to at least 1.30.0 in both client and server environments. MCP 1.8.1 can close the session when a request is cancelled, preventing subsequent requests from completing. Pinning Pydantic resolves an import incompatibility in that older SDK, but does not fix cancellation. SDK versions below 1.30.0 are no longer supported by this instrumentor.

Instrumentation lifecycle

uninstrument() disables this instrumentor's per-message propagation on already-instrumented open streams as well as on newly opened transports; it does not close sessions or remove wrappers installed by other libraries. Reinstalling re-enables the existing instrumented streams and instruments new transports exactly once. Sessions created while instrumentation is off are not retroactively wrapped; reopen them after reinstall to instrument them. Queued server messages remain intact across transitions; context captured while enabled is attached only if the reader is enabled when it consumes the item. An already-running request retains the context under which it started. Native MCP SDK tracing remains independent and can continue when this instrumentor is off, particularly with MCP 2.x.

Metadata

Release files for traceAI-mcp 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traceAI-mcp 0.1.4
File Size Uploaded Provenance Actions
traceai_mcp-0.1.4.tar.gz 6.2 kB With provenance Details for traceai_mcp-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for traceAI-mcp 0.1.4
File Interpreter ABI Platform Actions
traceai_mcp-0.1.4-py3-none-any.whl Python 3 none any Details for traceai_mcp-0.1.4-py3-none-any.whl

Total release size: 13.1 kB

Release files / traceai_mcp-0.1.4.tar.gz

Download URL traceai_mcp-0.1.4.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1e3f7d7317a5d7167271602187ec243d8b9ee53def18adfdc794e20c65242037
BLAKE2b-256 checksum
How to use checksums
cd4a484450eb12b8e7dcb1a5ac61dbf027306acb694255d47badd5b9bf8a258e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / traceai_mcp-0.1.4-py3-none-any.whl

Download URL traceai_mcp-0.1.4-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09f4da35a1d06c00a8c7dd1c7ab0f6249346e49f4d42a44a6587c6c9ba1d8b82
BLAKE2b-256 checksum
How to use checksums
11498234bf367d7b0ba6ec977c0d87e01fd300d5056d1ae7d019384e852d833d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for traceAI-mcp 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for traceai_mcp-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page