Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-hairs-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modelcontextprotocol/server': patch
---

add application/json header for notifications
7 changes: 6 additions & 1 deletion packages/server/src/server/webStandardStreamableHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,12 @@ export class WebStandardStreamableHTTPServerTransport implements Transport {
for (const message of messages) {
this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo });
}
return new Response(null, { status: 202 });
return new Response(null, {
status: 202,
headers: {
'Content-Type': 'application/json'
}
});
}

// The default behavior is to use SSE streaming
Expand Down
1 change: 1 addition & 0 deletions packages/server/test/server/streamableHttp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ describe.each(zodTestMatrix)('$zodVersionLabel', (entry: ZodMatrixEntry) => {
const response = await sendPostRequest(baseUrl, batchNotifications, sessionId);

expect(response.status).toBe(202);
expect(response.headers.get('content-type')).toBe('application/json');
});

it('should handle batch request messages with SSE stream for responses', async () => {
Expand Down
Loading