From 2cb2fb3ec27ebcb68a021544b5617655f14721de Mon Sep 17 00:00:00 2001 From: Charles Rossi <265534264+crossi-dev@users.noreply.github.com> Date: Fri, 17 Jul 2026 22:06:24 -0300 Subject: [PATCH] fix(http-stream): default responseMode to batch to match docs DEFAULT_HTTP_STREAM_CONFIG.responseMode was 'stream', but the README, the repo's own CLAUDE.md architecture notes, and the type's own JSDoc all document batch as the default response mode for the HTTP Stream transport. Any MCPServer using type: 'http-stream' without an explicit responseMode silently ran in stream (SSE) mode instead of the documented batch (JSON) mode. Fixes #184 --- src/transports/http/types.ts | 4 ++-- tests/transports/host-binding.test.ts | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/transports/http/types.ts b/src/transports/http/types.ts index b1db39d..ca49840 100644 --- a/src/transports/http/types.ts +++ b/src/transports/http/types.ts @@ -71,7 +71,7 @@ export interface HttpStreamTransportConfig { /** * Response mode: stream (Server-Sent Events) or batch (JSON) - * Defaults to 'stream' + * Defaults to 'batch' */ responseMode?: ResponseMode; @@ -119,7 +119,7 @@ export const DEFAULT_SESSION_CONFIG: SessionConfig = { export const DEFAULT_HTTP_STREAM_CONFIG: HttpStreamTransportConfig = { port: 8080, endpoint: '/mcp', - responseMode: 'stream', + responseMode: 'batch', batchTimeout: 30000, maxMessageSize: 4 * 1024 * 1024, session: DEFAULT_SESSION_CONFIG, diff --git a/tests/transports/host-binding.test.ts b/tests/transports/host-binding.test.ts index 56ed3e9..a38f9e1 100644 --- a/tests/transports/host-binding.test.ts +++ b/tests/transports/host-binding.test.ts @@ -80,5 +80,11 @@ describe('Host binding defaults', () => { expect(DEFAULT_HTTP_STREAM_CONFIG.port).toBe(8080); expect((DEFAULT_HTTP_STREAM_CONFIG as any).host).toBeUndefined(); }); + + it('should default responseMode to "batch" in DEFAULT_HTTP_STREAM_CONFIG', () => { + // README and the type doc comment both document "batch" as the default + // response mode for the HTTP Stream transport; the runtime default must match. + expect(DEFAULT_HTTP_STREAM_CONFIG.responseMode).toBe('batch'); + }); }); });