Objective
Move all MCP connection creation, reuse, execution, notification attribution, and cancellation adaptation behind the MCP Runtime session pool.
Scope
- Resolve server declarations and credentials inside the Runtime; the CLI no longer sends server config or headers.
- Execute one active MCP request per server key through the Call signal.
- Pass
RequestOptions.signal alongside timeout and progress options.
- Preserve stdio child and Streamable HTTP session reuse after Call cancellation.
- Treat cancelled-request late responses as diagnostics rather than session corruption.
- Preserve retained-session rejection, 401 eviction, notification buffering, and idle cleanup behavior where compatible with the accepted spec.
Non-goals
- Concurrent upstream requests on one session.
- Authentication initiation.
- Real remote MCP acceptance tests.
TDD acceptance
- Start with failing session-pool tests using deterministic local fixtures.
- Cover cancellation respected, ignored, racing, late, and completion-before-disconnect for stdio and Streamable HTTP.
- A second Call succeeds on the same connection/session before and after a late response.
- Cancellation never evicts a healthy session.
- A 401 follows credential-invalid/session-eviction policy and returns
reauth-required; it does not start authentication.
- Existing notification buffering and retained-session cases remain green.
Verification
- Focused session/cancellation integration tests.
- Existing daemon and notification suites.
- Full test suite, typecheck, formatter check, and
git diff --check.
Objective
Move all MCP connection creation, reuse, execution, notification attribution, and cancellation adaptation behind the MCP Runtime session pool.
Scope
RequestOptions.signalalongside timeout and progress options.Non-goals
TDD acceptance
reauth-required; it does not start authentication.Verification
git diff --check.