Skip to content

Commit 7977c14

Browse files
docs: clarify that JSON response mode doesn't deliver notifications
Add comments explaining that enableJsonResponse mode does not deliver notifications to the client, and that the multi-greet tool is included to demonstrate the difference vs SSE mode.
1 parent 384311b commit 7977c14

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/examples/server/jsonResponseStreamableHttp.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* Example: Streamable HTTP server with JSON response mode
3+
*
4+
* This example demonstrates `enableJsonResponse: true`, which returns JSON responses
5+
* instead of SSE streams. This is useful for simple request/response scenarios but
6+
* has an important limitation: notifications (logging, progress, etc.) are NOT delivered
7+
* to the client. Compare with simpleStreamableHttp.ts which uses SSE and delivers notifications.
8+
*/
19
import { Request, Response } from 'express';
210
import { randomUUID } from 'node:crypto';
311
import { McpServer } from '../../server/mcp.js';
@@ -41,7 +49,9 @@ const getServer = () => {
4149
}
4250
);
4351

44-
// Register a tool that sends multiple greetings with notifications
52+
// Register a tool that sends notifications during execution.
53+
// NOTE: These notifications will NOT be delivered to the client in JSON response mode.
54+
// This tool is included to demonstrate the difference vs SSE mode (see simpleStreamableHttp.ts).
4555
server.registerTool(
4656
'multi-greet',
4757
{

0 commit comments

Comments
 (0)