Skip to main content

MCP OpenTelemetry Integration

Overview

This integration provides support for using OpenTelemetry with the MCP framework. It enables tracing and monitoring of applications built with MCP.

Installation

  1. Install traceAI MCP
pip install traceAI-mcp traceAI-openai

Set Environment Variables

Set up your environment variables to authenticate with FutureAGI

import os

os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY

Quickstart

Register Tracer Provider

Set up the trace provider to establish the observability pipeline. The trace provider:

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

trace_provider = register(
    project_type=ProjectType.OBSERVE,
    project_name="my-mcp-project"
)

Configure MCP Instrumentation

Set up your MCP Instrumentation with built-in observability.

from traceai_openai import OpenAIInstrumentor
from traceai_mcp import MCPInstrumentor

OpenAIInstrumentor().instrument(tracer_provider=trace_provider)
MCPInstrumentor().instrument(tracer_provider=tracer_provider)

Start your MCP server as usual. TraceAI will automatically trace all MCP requests which will be visible in the FutureAGI platform.

MCP 1.8.1 dependency compatibility

MCP 1.8.1 uses a private Pydantic API that is absent in Pydantic 2.14.2. If you must stay on MCP 1.8.1, pin its compatible Pydantic dependency:

pip install "traceAI-mcp" "mcp==1.8.1" "pydantic==2.11.10"

This pin applies only to MCP 1.8.1; do not impose it on newer SDK versions.

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.3

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.3
File Size Uploaded Provenance Actions
traceai_mcp-0.1.3.tar.gz 5.1 kB With provenance Details for traceai_mcp-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 11.0 kB

Release files / traceai_mcp-0.1.3.tar.gz

Download URL traceai_mcp-0.1.3.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a8cc166a5fc1ab6810518e093da5b3a41cfe530a7693fba12138a6419309ba16
BLAKE2b-256 checksum
How to use checksums
6cbe245f6951f3622467d9f94bf79447bfe99f421fe03a7c85b5c3afe11f39d5
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 Oct 31, 2026.

Transparency log

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

Download URL traceai_mcp-0.1.3-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ecaa5af6b24c8da5250b96d75b13d0772cd038f8eabae15b8be7c2cc49d46704
BLAKE2b-256 checksum
How to use checksums
cc29dbdef8894413f7c84e2899eaa015d0cb294cc6c1465a6e8cbaf24cc446f0
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 Oct 31, 2026.

Transparency log

Security for traceAI-mcp 0.1.3

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.3.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 Oct 31, 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