You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Streamable HTTP: client sets Mcp-Name raw and does not Base64-encode a non-header-safe name #1243
The Streamable HTTP client sets the Mcp-Name header from the raw name without Base64-wrapping a value that is not header-safe. The 2026-07-28 transport spec requires the client to encode such a value with the =?base64?...?= sentinel, the same rule it applies to Mcp-Param-*.
mcp/streamable_headers.go, setStandardHeaders (main line 210):
ifname, ok:=extractName(msg.Method, msg.Params); ok {
header.Set(nameHeader, name)
}
The value is set directly, unlike the Mcp-Param-* path, which runs each value through encodeHeaderValue (line ~250) and Base64-wraps it when requiresBase64Encoding is true.
Transport page, "Value encoding":
The same encoding rule applies to the Mcp-Name header value. Tool and prompt names are only SHOULD-constrained to header-safe characters, so a name (or resource URI) outside the safe set is carried as: Mcp-Name: =?base64?{Base64EncodedValue}?=
Impact
A tool name or resource URI containing non-ASCII, control, or whitespace characters is sent as a raw header value. Depending on the HTTP stack it is either mangled or produces an invalid header, and a spec-compliant server that expects the sentinel encoding will not match it.
Suggested fix
Run the Mcp-Name value through encodeHeaderValue (or the same requiresBase64Encoding plus Base64 wrap) before setting the header, mirroring Mcp-Param-*.
This is the client-side counterpart to #1234 (server-side decode), fixed in #1242.
I'd like to work on this if the proposed scope matches the maintainers' intent.
For negotiated protocol versions >= 2026-07-28, I propose encoding unsafe Mcp-Name values in Streamable HTTP client requests using the existing encodeHeaderValue helper. Safe ASCII values and behavior for older protocol versions would remain unchanged. I would add coverage for Unicode, leading/trailing whitespace, control characters, and sentinel-shaped literals.
I used AI assistance to inspect the relevant code and specification and to help draft this proposal. I have reviewed the analysis and will personally verify the implementation and tests.
Activity
remote-controlled-man commentedon Sep 6, 2026
I'd like to work on this if the proposed scope matches the maintainers' intent.
For negotiated protocol versions
>= 2026-07-28, I propose encoding unsafeMcp-Namevalues in Streamable HTTP client requests using the existingencodeHeaderValuehelper. Safe ASCII values and behavior for older protocol versions would remain unchanged. I would add coverage for Unicode, leading/trailing whitespace, control characters, and sentinel-shaped literals.I used AI assistance to inspect the relevant code and specification and to help draft this proposal. I have reviewed the analysis and will personally verify the implementation and tests.
Would this scope be welcome?
mcp: base64-encode a non-header-safe Mcp-Name (modelcontextprotocol#1246