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

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.1.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.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: forgesight_mcp-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f342673f084db20edae656cf4cebd66b2f2d7bf5e60b9eb810e7de3c65b33725
MD5 2975a9622c4c1def427dd4ce3e979c04
BLAKE2b-256 6f8a9a3365c3441968c135089c7a6ca71a828b2a26e9e45c8f2cabd1c95ca88a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: forgesight_mcp-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4e914cbd7e180a4118ada7954cac53531bc7efbfed6ca6e8bee88818dbdee1f
MD5 a4c5f40c4bf1439f8745eca34966345c
BLAKE2b-256 f0b38f72b5846a55a05bfc7d86cc8b046caec0c36d249f2e8271a5ead05fc11f

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