Skip to content

Commit 0a278d2

Browse files
author
polaon
committed
Mcp-Session-Id header fix.
1 parent 0797ad5 commit 0a278d2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/server/streamable_http_server.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ bool StreamableHttpServerWrapper::start()
135135
// propagated to the catch handlers below.
136136
apply_additional_response_headers(res);
137137

138+
// Expose response headers that cross-origin JS clients legitimately need to
139+
// read. Without this, browsers hide Mcp-Session-Id from response.headers.get()
140+
// even though it is sent on the wire, because browsers only expose a small
141+
// whitelist of "safe" response headers by default.
142+
res.set_header("Access-Control-Expose-Headers", "Mcp-Session-Id");
143+
138144
try
139145
{
140146
// Security: Check authentication if configured

0 commit comments

Comments
 (0)