fix(http-stream): default responseMode to batch to match docs#193
Open
crossi-dev wants to merge 1 commit into
Open
fix(http-stream): default responseMode to batch to match docs#193crossi-dev wants to merge 1 commit into
crossi-dev wants to merge 1 commit into
Conversation
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 QuantGeekDev#184
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DEFAULT_HTTP_STREAM_CONFIG.responseModewas set to'stream', but every place that documents the default says'batch':responseMode: "batch", // Optional (default: "batch")CLAUDE.md: "Response modes: "batch" (default) or "stream""responseModefield's own JSDoc commentSo any server built with the documented pattern:
silently ran in stream (SSE) mode instead of the documented batch (JSON) mode, because
MCPServer.createTransportFromConfigspreadsDEFAULT_HTTP_STREAM_CONFIGfirst and the constant itself had the wrong value.Fixes #184.
Changes
src/transports/http/types.ts:DEFAULT_HTTP_STREAM_CONFIG.responseMode'stream'→'batch', and updated the field's doc comment to match.tests/transports/host-binding.test.ts: added a regression test in the existing "Default config values" block (same pattern already used there forport/host) assertingDEFAULT_HTTP_STREAM_CONFIG.responseMode === 'batch'.Why this direction (and not updating the docs instead)
The issue's "Suggested fix" section offered either direction. A prior PR (#185) took the "fix the docs to say stream" direction and was closed. Since the docs are consistent and repeated in three independent places (README,
CLAUDE.md, and the field's own JSDoc) and none of them describestreamas the default, I fixed the runtime to match the documented contract instead.Verification
npm run build(tsc) — passes, no errors.npx jest tests/transports/host-binding.test.ts tests/transports/http/ tests/compat/— 10 suites, 180 tests, all passing (includes the new test, plus the existingticket-018-serverless-bc-*backward-compat suites that exerciseHttpStreamTransport/MCPServerconstruction).responseMode: 'stream') and passes with the fix, confirming it actually pins the bug.npx jestrun: 851 tests passing. 5 unrelated suites underpackages/docs/tests/fail to compile onmainas well (pre-existingTS2339: Property 'toolCall' does not existerrors, unrelated to this change) — confirmed by stashing this change and re-running.npx prettier --check src/transports/http/types.ts tests/transports/host-binding.test.ts— clean. (Repo-widenpm run lint/prettier-checkhas pre-existing failures onmainin unrelated files — confirmed also present without this change — left untouched per minimal-diff scope.)No other behavior changes. Happy to adjust if you'd prefer the opposite direction (docs-to-match-runtime) after all, or want the standalone
HttpStreamTransportconstructor's ownresponseMode === 'batch'check aligned the same way (I kept this change scoped to the exact path in the issue's repro).