Uh oh!
There was an error while loading. Please reload this page.
fix: reinitialize expired streamable sessions - #2150
Conversation
🦋 Changeset detectedLatest commit: 7dac000 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client@modelcontextprotocol/codemod@modelcontextprotocol/core@modelcontextprotocol/server@modelcontextprotocol/server-legacy@modelcontextprotocol/express@modelcontextprotocol/fastify@modelcontextprotocol/hono@modelcontextprotocol/nodecommit: |
he-yufeng
commented
May 27, 2026
Added a patch changeset for @modelcontextprotocol/client. Local validation: pnpm exec changeset status --since upstream/main shows the client patch bump, git diff --check passed, and the pre-push hook completed typecheck, build, and lint successfully. |
80b3f60 to
b2a0df1Comparehe-yufeng
commented
Jun 6, 2026
Rebased on current Validated locally:
The pre-push hook also completed the repo-wide build, typecheck, and lint steps successfully. |
b2a0df1 to
0c15f0cComparehe-yufeng
commented
Jun 6, 2026
Updated the branch to include the e2e expectation changes for session-expiry recovery. The red e2e job was from two stale expectations:
Validation: The pre-push hook also completed full repo typecheck, build, and lint before the force-push. |
he-yufeng
commented
Jun 12, 2026
Rebased onto current Focused validation after the rebase: Result: client I also tried the touched e2e file: That is blocked locally before collecting tests because the current workspace install cannot resolve |
d2cf398 to
7abec0bCompare7abec0b to
116b048Compare116b048 to
040ced6Comparehe-yufeng
commented
Aug 16, 2026
Still mergeable and green after another rebase check on current main: an expired streamable session still dies instead of being reinitialized, and the e2e expectation changes cover the recovery path. First real nudge on this one; would love a maintainer read. |
Summary
Fixes#1476.
When a Streamable HTTP server restarts, a client can keep sending POST requests with a stale
MCP-Session-Id. The SDK currently reports the server's 404 response asClientHttpNotImplementedand leaves the expired session in place.This change handles a 404 from a request that used a session ID as an expired-session signal:
Clientrun a fresh initialize handshake on the same transportThe retry is limited to one attempt so repeated 404s still surface as errors instead of looping.
To verify
pnpm --filter @modelcontextprotocol/client exec vitest run test/client/streamableHttp.test.ts -t "reinitializes and retries once"pnpm --filter @modelcontextprotocol/client exec vitest run test/client/streamableHttp.test.tspnpm --filter @modelcontextprotocol/client typecheckpnpm --filter @modelcontextprotocol/client lintgit diff --checktypecheck,build, andlint