Skip to content

Commit 7a6f8cc

Browse files
its-mashclaude
andcommitted
fix: add Accept header for MCP Streamable HTTP protocol compliance
The gateway returns 406 Not Acceptable when the Accept header doesn't include both application/json and text/event-stream, as required by the MCP Streamable HTTP transport spec (2025-03-26). Add 'Accept: application/json, text/event-stream' to all fetch calls in TC-SH-014 and TC-SH-015 E2E tests. Signed-off-by: Myko <myko@mcpmux.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent b416c3e commit 7a6f8cc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/e2e/specs/streamable-http.wdio.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,12 @@ describe('Streamable HTTP: OAuth MCP Client Flow', function () {
348348
console.log('[test] Token obtained, length:', token.length);
349349

350350
// Send MCP initialize request
351+
// Streamable HTTP requires Accept: application/json, text/event-stream
351352
const res = await fetch(`http://localhost:${gatewayPort}/mcp`, {
352353
method: 'POST',
353354
headers: {
354355
'Content-Type': 'application/json',
356+
'Accept': 'application/json, text/event-stream',
355357
'Authorization': `Bearer ${token}`,
356358
},
357359
body: JSON.stringify({
@@ -429,6 +431,7 @@ describe('Streamable HTTP: OAuth MCP Client Flow', function () {
429431
method: 'POST',
430432
headers: {
431433
'Content-Type': 'application/json',
434+
'Accept': 'application/json, text/event-stream',
432435
'Authorization': `Bearer ${token}`,
433436
},
434437
body: JSON.stringify({
@@ -461,6 +464,7 @@ describe('Streamable HTTP: OAuth MCP Client Flow', function () {
461464
method: 'POST',
462465
headers: {
463466
'Content-Type': 'application/json',
467+
'Accept': 'application/json, text/event-stream',
464468
'Authorization': `Bearer ${token}`,
465469
'Mcp-Session-Id': sessionId!,
466470
},
@@ -479,6 +483,7 @@ describe('Streamable HTTP: OAuth MCP Client Flow', function () {
479483
method: 'POST',
480484
headers: {
481485
'Content-Type': 'application/json',
486+
'Accept': 'application/json, text/event-stream',
482487
'Authorization': `Bearer ${token}`,
483488
'Mcp-Session-Id': sessionId!,
484489
},

0 commit comments

Comments
 (0)