mm.tech
factory stable TypeScript

MCP OTel

W3C Trace Context bridge for the Model Context Protocol

Implements MCP spec SEP-414: propagates traceparent / tracestate / baggage from _meta as OpenTelemetry spans, so host → server → tool → downstream renders as one trace tree. Drop-in for any MCP server, no vendor lock-in. 41 tests, MIT, TypeScript.

What it solves

A request that flows from a host through an MCP server into a tool and out to a downstream HTTP call should show up as one connected trace. Instead it shows up as four unrelated ones, because nothing was carrying the trace context across the MCP hop.

How it works

The release candidate of 2026-07-28 settled where that context lives: SEP-414 reserves the unprefixed meta keys traceparent, tracestate and baggage for W3C Trace Context and W3C Baggage, and transports must pass them through untouched. SEP-2577 deprecated the MCP logging capability and pointed at OpenTelemetry instead. This library does the plumbing that follows from those two: it reads the caller context out of the meta field, starts a correctly parented OpenTelemetry span for the tool call, and lets your downstream calls hang off it.

When to use it

Take it when you already run OpenTelemetry and the MCP hop is the gap in your traces. It shows up as one connected trace in Jaeger, Tempo, Honeycomb or Datadog without you changing how you already export, because it touches the context and nothing else.

When not to use it

It is deliberately thin, and that cuts both ways. It does not configure OpenTelemetry for you, it ships no exporter and it does not hide your tracer, so if you were hoping for observability in one install, this is not it. You keep control of sampling, resources and exporters, and this only bridges the meta field to spans.

Stars

★ 0

installs

↓ 385

Clones (14d)

⊟ 30

Language

TypeScript

Updated

2026-08-15

Install

npx -y mcp-otel

Related repos