Skip to content
Draft
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
12 changes: 11 additions & 1 deletion src/examples/server/jsonResponseStreamableHttp.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Example: Streamable HTTP server with JSON response mode
*
* This example demonstrates `enableJsonResponse: true`, which returns JSON responses
* instead of SSE streams. This is useful for simple request/response scenarios but
* has an important limitation: notifications (logging, progress, etc.) are NOT delivered
* to the client. Compare with simpleStreamableHttp.ts which uses SSE and delivers notifications.
*/
import { Request, Response } from 'express';
import { randomUUID } from 'node:crypto';
import { McpServer } from '../../server/mcp.js';
Expand Down Expand Up @@ -41,7 +49,9 @@ const getServer = () => {
}
);

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