TLDR for reviewers. Full RFC: 2026-04-30-rfc-minimal-additive-approach.md.
Decomposes Protocol internally into a private Dispatcher (stateless: handler registry + dispatch) and a private StreamDriver (per-connection: id correlation, timeouts, abort), then adds a per-request HTTP entry point (handleHttp) that calls Dispatcher directly without ever touching StreamDriver. McpServer/Client/Server class hierarchy unchanged; they keep extending Protocol and inherit the new dispatch() method.
Two doors after this lands:
mcp.connect(transport)— pipe transports (stdio, ws, in-memory). Unchanged behavior.handleHttp(mcp, {session?, backchannel?})— per-request HTTP. New.
The 2025-11 experimental tasks API is woven into Protocol._onrequest/request via processInbound*/processOutbound* interception. Preserving that through the decomposition required ~100 LOC of _tasksMiddleware glue, an onrequestsend tap on StreamDriver, and microtask-timing hacks — all to keep an experimental API that SEP-2663 is replacing with a simpler server-directed model anyway.
R0 deletes the interception (no BC owed; it was always experimental). Integration tests that exercise task behavior are describe.skipped with // TODO(F3) markers. Storage interfaces (InMemoryTaskStore etc.) stay. F3 brings tasksPlugin() back via the use() middleware seam — ~150 LOC, no Protocol coupling.
This makes R2 a clean ~800-line shrink instead of "shrink plus tasks-BC mess."
main → R0 → R1 → R2 → R3 → R4
| PR | What | Review focus | Gate |
|---|---|---|---|
| R0 | Delete experimental tasks interception; skip integration tests | What got deleted vs skipped; any orphaned references | tests pass (−121 deleted, +101 skipped) |
| R1 | Dispatcher + StreamDriver new files + own unit tests |
Do these two classes do what they claim, in isolation | own tests pass; existing tests unchanged |
| R2 | Protocol composes them; dispatch() public; types move to context.ts |
The heavy review. Each public method delegates correctly. protocol.ts 1011→393 | protocol.test.ts passes unchanged; conformance 40/40 |
| R3 | handleHttp (+ internal shttpHandler) + SessionCompat + toNodeHttpHandler + dual-conformance harness + Last-Event-ID session-binding fix |
New files; the IDOR fix; both conformance targets | dual-conformance both 40/40 |
| R4 | BackchannelCompat (legacy server→client over SSE for handleHttp); Server.buildContext uses ctx.mcpReq.send |
Writer lifecycle; the buildContext change drops a capability check (restored in F1) | dual-conformance both 40/40; client conformance 289/289 |
- No SEP feature implementations (those are S/F-group, follow-ups)
- McpServer/Client don't
extends Dispatcher(that's optional, deferred) streamableHttp.ts(the existing transport class) is untouched — both entry points coexistDispatcher/StreamDriverare NOT exported publicly (internal tocore)
R3 adds a second conformance target so CI runs the suite against both mcp.connect(transport) (existing path) and handleHttp(mcp, {session}) (new path). Both must hit 40/40 server scenarios. This is the behavior-equivalence proof for R2's delegation.
After filtering false positives (mastra's InMemoryTaskStore is Google A2A; cf-agents' hit is CF-generated types), real usage is:
- mcp-framework (third-party): rolled their own task manager, never imported the SDK interception. R0 doesn't break compile. ~10 LOC adapt (drop
params.taskbranch, emit{resultType:'task'}). - inspector / mcp-servers (first-party): the long-running-tool half maps cleanly to F3's
tasksPlugin(). The "server polls client'stasks/*for async sampling" half has no SEP-2663 equivalent — that pattern becomes MRTR (S3/F2/F4), not tasks. Those files are rewrites either way.
No old-way compat shim — the parts that would need it are MRTR rewrites, not tasks migrations.
main'sstreamableHttp.ts:534has the same Last-Event-ID cross-session replay issue R3 fixes inshttpHandler— separate security PR.- 101 skipped tests are the F3 checklist.
- R4's
Server.buildContextchange drops the_clientCapabilities.elicitationcheck fromelicitInput(); F1 (per-request_metacaps) restores it correctly.