Conversation
The shared in-memory session store (self-host) created its transport with enableJsonResponse, which buffers a POST's answer into one JSON body. An elicitation/create issued during a tools/call had no stream to ride, so native-mode approvals never reached the client and the call died on the SDK's 60s request timeout. The local app fixed the same bug in UsefulSoftwareCo#1556. Use SSE streaming (the spec default). Streaming answers a POST as soon as its stream opens, so the idle sweep's in-flight claim now lasts until the POST's SSE body ends rather than when handleRequest resolves; the standalone GET stream still does not count. Native elicitations also get PAUSED_APPROVAL_TIMEOUT_MS (4 min) instead of the SDK's 60s default, since a human answers them. Fixes UsefulSoftwareCo#2140
This branch has not been deployed
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
Self-hosted MCP now delivers
elicitation_mode=nativeapprovals to the client. The shared in-memory session store created its transport withenableJsonResponse: true. That buffers eachtools/callanswer into a single JSON body, so anelicitation/createsent during the call had no stream to travel on. The call then failed after 60s with-32001 Request timed out. The local app fixed the same bug in #1556 (#1555); this applies that fix to the store self-host uses.handleRequestresolves as soon as the stream opens, while the tool call is still running. The sweep's in-flight claim on a session now lasts until the POST's SSE body ends. The standaloneGETstream still doesn't count, so idle sessions are still evicted.PAUSED_APPROVAL_TIMEOUT_MS(4 min) instead of the SDK's 60s default, since a person has to answer them.Linked issue
Fixes #2140
Verification
bun run format:check: whole repo cleanbun run lint: whole repo, 0 warnings and 0 errorsbun run typecheck: all 45 turbo tasks passbun run test: not run in full.packages/hosts/mcp(252 tests) andapps/host-selfhost(158 tests) passe2e/selfhost/mcp-native-elicitation.test.ts. It passes, in 65s, on--project selfhost. No browser is involved, so there is no recording.main, it fails withMcpError: MCP error -32001: Request timed out, the error from the issue.Other test changes:
in-memory-session-store.test.tshas a regression test that sends a real SDK client throughstore.dispatch. It hangs in JSON mode and passes with this change.Responseis returned but before the call finishes.data:line, through a small helper (apps/host-selfhost/src/testing/mcp-sse.ts).Checklist
bun run changeset), or this change needs none.