Skip to content

[Server][Client][Protocol] SEP-414: W3C Trace Context propagation via _meta #355

@chr-hertel

Description

@chr-hertel

Implements SEP-414 for the MCP Spec 2026-07-28 release.

Tracked by umbrella #336. Additive, non-breaking.

Spec summary

Standardizes how W3C Trace Context (traceparent, tracestate, baggage) is conveyed in JSON-RPC _meta for non-HTTP transports, and how it interplays with HTTP headers. Lets servers and clients propagate spans across MCP boundaries.

PHP SDK changes

  • src/JsonRpc/MessageFactory.php and request DTOs — recognize/preserve _meta.traceparent and _meta.tracestate round-trip.
  • src/Server/Transport/StdioTransport.php — propagate trace context through _meta (no HTTP headers available).
  • src/Server/Transport/StreamableHttpTransport.php and src/Client/Transport/HttpTransport.php — bridge HTTP traceparent/tracestate headers ↔ JSON-RPC _meta per the spec rules.
  • src/Server/Protocol.php — make trace context available on RequestContext so tool handlers can use it (PSR-3 logger correlation, OTel instrumentation packages).
  • Optional helper src/Server/Tracing/TraceContext.php for parsing/serializing traceparent.
  • No new dependencies required — keep OTel integration opt-in via consumer code.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    2026-07-28All issues and PRs related to the spec release 2026-07-28ClientIssues & PRs related to the Client componentSchemaIssues & PRs related to the Schema componentServerIssues & PRs related to the Server componentenhancementRequest for a new feature that's not currently supportedimproves spec complianceImproves consistency with other SDKs such as TyepScript

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions