Skip to main content

ForgeSight MCP instrumentation — client + server spans, mcp.* conventions, W3C propagation.

Project description

forgesight-mcp

MCP instrumentation for ForgeSight. Turns every Model Context Protocol tools/call / tools/list / prompts/get / resources/read into a correctly-mapped span — with W3C trace propagation across the transport, so a pr-reviewer → github-mcp → internal-api-mcp chain is one trace.

pip install forgesight-mcp
# client side — an agent calling an MCP server
import forgesight
from forgesight_mcp import instrument_mcp_client
from mcp import ClientSession

forgesight.configure()

async with ClientSession(read, write) as session:
    instrument_mcp_client(session)          # one line; wraps the transport
    await session.initialize()
    result = await session.call_tool("get_diff", {"pr": 42})   # execute_tool get_diff
# server side — a tool/resource server
import forgesight
from forgesight_mcp import instrument_mcp_server
from mcp.server import Server

forgesight.configure()
server = Server("github-mcp")
instrument_mcp_server(server)               # extracts traceparent, opens child spans

What you get

  • One span per request, mapped per the OTel MCP conventions. A tools/call is the single span carrying both mcp.method.name = tools/call and gen_ai.operation.name = execute_tool / gen_ai.tool.name — never double-instrumented.
  • Uniform tool telemetry. A tool reached via MCP and the same tool reached natively both land under gen_ai.tool.name, so "failure rate of get_diff" is one query across both.
  • Traces stitch automatically. The client injects traceparent into the request _meta; the server extracts it and opens its span as a child of the caller's — same trace_id.
  • Metrics for free. Each call feeds mcp.client.operation.duration and the derived agentforge.mcp.invocations_total (server / method / tool / status).
  • Secure by default (P7). tools/call arguments and results are captured only when capture_content resolves true; the redaction interceptor still runs.

Idempotent + reversible

instrument_mcp_client / instrument_mcp_server are idempotent (re-instrumenting is a no-op) and reversible (uninstrument_mcp_client / uninstrument_mcp_server restore the originals). Auto-instrument new sessions/servers at configure() via the install() entry point:

# forgesight.yaml
integrations:
  mcp:
    enabled: true
    auto_instrument: true
    capture_content: false    # P7 default

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forgesight_mcp-0.1.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forgesight_mcp-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file forgesight_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: forgesight_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for forgesight_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4cd8e9182db7051a9916ea0d18f8de3c51b1c150519500ff76db7cccbb4762b7
MD5 5d5e65d74493cb90d5364fc527d46fb1
BLAKE2b-256 f9dcf7989f060edaf975dc1784c3ad2f2d27638b51b26cec412844b0a49ab050

See more details on using hashes here.

File details

Details for the file forgesight_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: forgesight_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for forgesight_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee31b420c4277113060676cf1aea5d9804c1c9178d63cca74d46a22cac918101
MD5 4a925d2e434b05597a4083c0bc6d3845
BLAKE2b-256 dc040202049047e0248115acc2e0146b9650602867d4773a78537f473d93d2a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page