Part of #3026, which has the spec summary and the overall plan. Depends on #3028. ## Scope A UI-agnostic subscription engine in core. - **Registry.** The spec makes the client the owner of all subscription state. The registry is: - keyed by `(name, canonical-JSON arguments, mode)` - a `TypedEventTarget` store - read through a `useStoreSnapshot` hook in `core/react/` - **Poll runner:** - persists the cursor; `null` or absent means don't persist - waits `nextPollMs`, with a configurable floor (default 1000 ms) - drains immediately on `hasMore` - supports `maxEvents` and `maxAgeMs` - surfaces `truncated` as a gap marker - **Push runner:** - `events/stream` with **no request timeout** - routes `active`/`event`/`heartbeat`/`error`/`terminated` by `subscriptionId` - advances the cursor on heartbeat - treats the stream as dead after 3× the granted `heartbeatMs` with no message, then reconnects with the last cursor after jitter - cancels by abort on HTTP, or `notifications/cancelled` on stdio - holds concurrent streams - **Web relay.** Support for an unbounded `events/stream` with cancellation. The hardcoded relay waits must not cut it off (see #2028). - Per-subscription `eventId` dedup, and an occurrence log capped like the message log. - Optional validation of `data` against `payloadSchema`, flagged the way `core/mcp/toolOutputValidation.ts` flags tool output. - **Termination:** - `NotFound` or `Unsupported`/`schema_changed`: re-list, then offer to resubscribe - `Forbidden`: end the subscription - the outcome is always visible ## Acceptance - Tests run against the fixture presets: backlog, gap, error, both kinds of termination, heartbeat timeout and reconnect, and cancellation. - No floating promises on any teardown path. - Coverage ≥ 90.
Activity
cliffhall commentedon Nov 23, 2026
Triage: Priority Medium (total 8)
Board: #28, Status
Todo, milestone v2.18.0 (filed through the create flow).fix(events): keep __proto__ in the key, and honor an explicit null cu…
fix(events): liveness from the grant only, and guard reports against …
fix(events): checkpoint the cursor after delivery, and clamp oversize…
Merge pull request #3037 from modelcontextprotocol/v2/feat/3029-event…
cliffhall commentedon Nov 24, 2026
Shipped in #3037.
feat(events): subscription engine — poll and push runners, registry, …