Skip to main content

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

Metadata

Release files for forgesight-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 forgesight-mcp 0.1.1
File Size Uploaded
forgesight_mcp-0.1.1.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for forgesight-mcp 0.1.1
File Interpreter ABI Platform
forgesight_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / forgesight_mcp-0.1.1.tar.gz

Download URL forgesight_mcp-0.1.1.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f342673f084db20edae656cf4cebd66b2f2d7bf5e60b9eb810e7de3c65b33725
BLAKE2b-256 checksum
How to use checksums
6f8a9a3365c3441968c135089c7a6ca71a828b2a26e9e45c8f2cabd1c95ca88a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

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

Download URL forgesight_mcp-0.1.1-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4e914cbd7e180a4118ada7954cac53531bc7efbfed6ca6e8bee88818dbdee1f
BLAKE2b-256 checksum
How to use checksums
f0b38f72b5846a55a05bfc7d86cc8b046caec0c36d249f2e8271a5ead05fc11f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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