You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of #1066 (checkbox: shared `injectMcpSessionId` helper).
## What we're solving
The mcpSessionId injection — `params._meta ??= {};
params._meta.mcpSessionId = <id>` — was duplicated in `src/stdio.ts` and
`src/dev_server.ts`. The "always create params" invariant, and the
comment explaining why (requests like `listTasks`/`getTasks` have no
params; skipping creation makes injection silently fail and breaks
multi-node session isolation), lived only in stdio.ts.
## How
Add `injectMcpSessionId(params, mcpSessionId)` to `src/utils/mcp.ts`,
carrying the invariant and its comment once. Both entry points call it.
A unit test locks the always-create invariant and the mutate-and-return
semantics.
- **stdio.ts**: behavior unchanged (it already always-created params).
- **dev_server.ts**: now *also* always-creates params via the helper.
Previously it injected only when `req.body.params` already existed (`if
(req.body?.params && sessionId)`); it now injects whenever there's a
session (`if (sessionId && req.body)`).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_016pXZvhEoE6Lz3DpBSL3n1Y
---
_Generated by [Claude
Code](https://claude.ai/code/session_016pXZvhEoE6Lz3DpBSL3n1Y)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments