From 7977c14b9b8ecbe50cc96d11a547f7c5161f7560 Mon Sep 17 00:00:00 2001 From: Felix Weinberger Date: Tue, 16 Dec 2025 18:16:11 +0100 Subject: [PATCH] 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. --- src/examples/server/jsonResponseStreamableHttp.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/examples/server/jsonResponseStreamableHttp.ts b/src/examples/server/jsonResponseStreamableHttp.ts index a066c9bf8..a75b9b85d 100644 --- a/src/examples/server/jsonResponseStreamableHttp.ts +++ b/src/examples/server/jsonResponseStreamableHttp.ts @@ -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'; @@ -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', {