Skip to main content

respan-instrumentation-mcp

Respan instrumentation plugin for Model Context Protocol Python applications.

The package enables upstream OpenInference MCP transport context propagation and adds Respan spans for common mcp.ClientSession operations such as tool listing, tool calls, resource reads, and prompt fetches.

Configuration

1. Install

pip install respan-ai respan-instrumentation-mcp "mcp>=1.27,<2"

2. Set Environment Variables

Variable Required Description
RESPAN_API_KEY Yes Your Respan API key. Authenticates tracing export.
RESPAN_BASE_URL No Defaults to https://api.respan.ai/api.

Quickstart

import asyncio
import sys

from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
from respan import Respan, workflow
from respan_instrumentation_mcp import MCPInstrumentor

respan = Respan(instrumentations=[MCPInstrumentor()])


@workflow(name="mcp_tool_call_workflow")
async def run_mcp_client() -> None:
    server_params = StdioServerParameters(
        command=sys.executable,
        args=["server.py"],
    )

    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            tools = await session.list_tools()
            print([tool.name for tool in tools.tools])
            result = await session.call_tool(
                "summarize_city",
                arguments={"city": "Paris"},
            )
            print(result)


asyncio.run(run_mcp_client())
respan.flush()
respan.shutdown()

This release supports MCP Python SDK 1.27 or newer on the 1.x line. MCP 2.x removed the mcp.server.fastmcp API used by the current examples and is not yet supported.

Further Reading

See the Respan example projects for runnable MCP scripts.

Metadata

Release files for respan-instrumentation-mcp 0.1.1

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

Source distribution (sdist)

Source distribution for respan-instrumentation-mcp 0.1.1
File Size Uploaded Provenance Actions
respan_instrumentation_mcp-0.1.1.tar.gz 5.6 kB Without provenance Details for respan_instrumentation_mcp-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for respan-instrumentation-mcp 0.1.1
File Interpreter ABI Platform Actions
respan_instrumentation_mcp-0.1.1-py3-none-any.whl Python 3 none any Details for respan_instrumentation_mcp-0.1.1-py3-none-any.whl

Total release size: 12.3 kB

Release files / respan_instrumentation_mcp-0.1.1.tar.gz

Download URL respan_instrumentation_mcp-0.1.1.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
127fb17e16c694f21e8432a46de5c5e7cd247428e91f9818903b51b67f83b2a9
BLAKE2b-256 checksum
How to use checksums
8461e34fc296d258d18adf1c325e8312d274be249aa718766357cfd1c3cdff55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / respan_instrumentation_mcp-0.1.1-py3-none-any.whl

Download URL respan_instrumentation_mcp-0.1.1-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ae0a5c45621008b64e135c5e1f5120b94d2c1b9181f33be8c3485f03de67f47
BLAKE2b-256 checksum
How to use checksums
4b3c9193bf59b6d0771db6dddcddaef9d239eb9cf195086079803d84e7d0595b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for respan-instrumentation-mcp 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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