HeaderFactory
FinalYes
The HTTP headers a modern-era client puts on every POST (SEP-2243, SEP-2575).
These exist so an intermediary can route and authorize MCP traffic without parsing the body. That only works if the headers cannot disagree with what they mirror, so they are derived here from the very message that is about to be sent — never from what the caller believes it is sending.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- forMessage() : array<string, string>
- traceHeaders() : array<string, string>
- Mirrors W3C trace context from `_meta` onto its native HTTP headers, so an application that only knows how to set `_meta` — the transport-agnostic surface — still gets header-based propagation for free on HTTP.
Properties
$tools read-only
private
ToolCatalog
$tools
Methods
__construct()
public
__construct(ToolCatalog $tools) : mixed
Parameters
- $tools : ToolCatalog
forMessage()
public
forMessage(array<string, mixed> $payload, ProtocolVersion $protocolVersion) : array<string, string>
Parameters
- $payload : array<string, mixed>
-
a serialized JSON-RPC message
- $protocolVersion : ProtocolVersion
Return values
array<string, string>traceHeaders()
Mirrors W3C trace context from `_meta` onto its native HTTP headers, so an application that only knows how to set `_meta` — the transport-agnostic surface — still gets header-based propagation for free on HTTP.
private
traceHeaders(array<string, mixed>|null $params) : array<string, string>
Parameters
- $params : array<string, mixed>|null