Repository navigation
sep(SEP-3415): Events Extension - #3415
Conversation
Adds an Extensions Track SEP for Events, an extension that lets a client subscribe to things that happen in an upstream system and have an agent react to them without the user being present. The SEP is the Triggers & Events Working Group's design sketch written in SEP format and aligned with the 2026-07-28 protocol. A server lists event types with events/list, and delivers occurrences by poll, push or webhook, with opaque cursors for resuming after a disconnect.
The verification challenge is answered by the webhook endpoint in its HTTP response, so the client has nothing to do with it. Only gap and terminated envelopes must be forwarded to the client. Also say how a receiver picks the secret for a challenge on a first subscribe. The subscription id in the header has not been given to the receiver yet, so it tries its registered secrets that have no id. The 503/425 retry guidance does not apply to the challenge.
MCP Events now has a SEP: modelcontextprotocol/modelcontextprotocol#3415, opened 2026-10-05, the design sketch written up in SEP format. SEP numbers are PR numbers, so the yaml and every check ID move from the 9999 placeholder to 3415. The ID set is unchanged apart from the prefix (160 IDs), and the scenarios, negative controls and runner behaviour are untouched. The rows still quote the sketch. The SEP restates it rather than quoting it, so only 11 of 165 row texts appear in the SEP verbatim, and spec_url keeps naming the text the rows actually quote until they are re-extracted. The header now says so, and records that sketch PR 7 closed unmerged and SEP-3415's Capability Negotiation section carries the rule its six rows quote.
|
Strong +1. @pja-ant, I'm glad you kept going with this after the Transports WG ruled webhooks out of scope, along with my WebSockets SEP. I'd like to take on Open Question 2 with a working prototype: resource watching through events, over a store that keeps every version of a resource. It will be an MIT-licensed package. One question before I build. A resource subscription is state, not a stream of events, so the server can coalesce: if three updates land while an endpoint is down, sending only the newest is correct for anyone watching the resource. Should an event type be able to declare that it coalesces, and should coalescing set The cursor also tells the server which version the subscriber already holds, so a delivery can be a single JSON Merge Patch (RFC 7396) from that version to the newest, not the full value. That's the design for my own resources layer today. |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QK1G3u8qsmZMk2jtcFhyCV
…ontextprotocol into pja/sep-events-extension
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QK1G3u8qsmZMk2jtcFhyCV
<!-- claude-projects-attribution: {"github_login":"poita"} -->
_Requested by **Peter** · [project
thread](https://claude.ai/code/project/chan_013VZyPu2nt8YAcwA65s6UqV?thread=cmsg_013VZyPu2nt8YAcwA65s6UqVJyt1MeecHy1rTFjH8sxiG5)_
## Summary
Registers the Events extension (`io.modelcontextprotocol/events`) now
that
[SEP-3415](#3415)
is Final. The specification itself lives in
[ext-events](https://github.com/modelcontextprotocol/ext-events) and is
not duplicated here.
- `docs/extensions/overview.mdx`: new **MCP Events** section with the
ext-events card and a table listing Events as *Beta, destination not yet
stated* (the SEP does not state Stable or Core).
- `docs/extensions/events/overview.mdx`: new overview page at the same
depth as the Tasks and Apps pages: motivation, how it works (with a
sequence diagram), delivery modes, when to use it, cursors and
guarantees, security model, and a client and server implementation
guide. Normative detail stays in ext-events.
- `docs/docs.json`: adds an **Events** group to the Extensions tab.
- `docs/extensions/client-matrix.mdx`: adds Events to the extension
overview table and an Events column to the support matrix (evidence
below).
- `docs/community/working-groups/tasks-events.mdx`: links ext-events and
SEP-3415 under Resources, and marks the Events SEP work item Final.
- `seps/3415-events-extension.md` (and the generated MDX): names the
Tasks and Events Working Group and lists all four leads (@clareliguori,
@poita, @LucaButBoring, @CaitieM20) as Extension Maintainers, and says
the spec is published in ext-events under `specification/beta/events/`
([ext-events#24](modelcontextprotocol/ext-events#24)).
## Events client support evidence
Checked 2026-11-19. "Partial" means webhook delivery only. Most
implementations target the pre-Final draft.
| Client | Marked | Evidence |
| --- | --- | --- |
| ChatGPT | Partial | [OpenAI MCP Events
guide](https://developers.openai.com/plugins/build/mcp-events): "ChatGPT
supports webhook delivery and callback verification from the draft MCP
Events specification." Polling and streaming are not supported. Work
chats and dots only. |
| MCPJam | ✓ | Source on `main`
([`sdk/src/mcp-client-manager/events-ext.ts`](https://github.com/MCPJam/inspector/blob/main/sdk/src/mcp-client-manager/events-ext.ts),
[CLI
docs](https://github.com/MCPJam/inspector/blob/main/docs/cli/events.mdx)):
poll, push and webhook. |
| Mastra | Not listed (no existing row; supports poll, push, webhook) |
`@mastra/mcp` 2.10.0 on npm ships client poll, push and webhook drivers
(`dist/client/events/`). |
| Hermes Agent | Not listed (no existing row; supports webhook only) |
[`tools/mcp_tool_events.py`](https://github.com/NousResearch/hermes-agent/blob/main/tools/mcp_tool_events.py):
`events/subscribe` only. |
| Vercel AI SDK | Not listed (no existing row; supports webhook only) |
`@ai-sdk/mcp` 2.0.101 on npm (`src/tool/mcp-events.ts`):
`events/subscribe` only. |
| TanStack AI | Not listed (no existing row; supports webhook only) |
`@tanstack/ai-mcp` 1.3.0 on npm (`src/events/wire.ts`):
`events/subscribe` only. |
Cross-checked against the [field report in
experimental-ext-triggers-events#17](modelcontextprotocol/ext-events#17)
and [Hookdeck's support
table](https://hookdeck.com/webhooks/guides/what-are-mcp-events). No
support found in the source of fast-agent, Goose, mcpc or MCP Inspector.
Claude Code has an [open feature
request](anthropics/claude-code#101434).
## Checks
- `npm run check:docs` passes (format, MDX comments, no broken links).
https://claude.ai/code/session_01QK1G3sQVer24zRNwffmicu
---
_Generated by [Claude Code](https://claude.ai/code)_
---------
Co-authored-by: Claude <[email protected]>
## Background `@ai-sdk/mcp` implements the earlier MCP Events draft and fails against servers that follow the accepted [SEP-3415](modelcontextprotocol/modelcontextprotocol#3415): it ignores `capabilities.extensions["io.modelcontextprotocol/events"]`, omits `Mcp-Name` on `events/*` requests, and the webhook receiver rejects deliveries whose `webhook-id` isn't the `eventId`. ## Summary - Accept Events support from `capabilities.extensions["io.modelcontextprotocol/events"]`, keeping the legacy top-level `events` key as a fallback. - Send `Mcp-Name` (from `params.name`) on `events/subscribe`, `events/unsubscribe`, `events/poll` and `events/stream`. `events/list` still sends none. - Stop requiring `webhook-id` to equal `eventId` in `createMCPEventWebhook`. The signature still covers `webhook-id`. ## Contributor Credit @leggetter for the report and reproduction. ## End-to-End Verification Ran the reproduction from the issue against the published package and against this checkout's local build (`pnpm build` in `packages/mcp`, then `node_modules/@ai-sdk/mcp` symlinked to `packages/mcp`). <details> <summary><code>repro.mjs</code></summary> ```js // Minimal reproduction: @ai-sdk/mcp against an MCP server that follows SEP-3415 // (Events extension). No dependencies besides @ai-sdk/mcp. Run: node repro.mjs import http from 'node:http'; import { createHmac, randomBytes } from 'node:crypto'; import { createMCPClient, experimental_createMCPEventWebhook as createMCPEventWebhook, } from '@ai-sdk/mcp'; const EVENTS = 'io.modelcontextprotocol/events'; // A stateless Streamable HTTP server that records the Mcp-Name header it receives. async function startServer(capabilities) { const received = []; const server = http.createServer(async (req, res) => { let body = ''; for await (const chunk of req) body += chunk; const message = JSON.parse(body); if (message.id === undefined) return res.writeHead(202).end(); received.push({ method: message.method, mcpName: req.headers['mcp-name'] ?? null }); const results = { 'server/discover': { supportedVersions: ['2026-07-28'], capabilities }, 'events/list': { events: [ { name: 'incident.created', delivery: ['webhook'], inputSchema: { type: 'object' }, payloadSchema: { type: 'object' }, }, ], }, 'events/subscribe': { id: 'sub_a3f1c8e2b0d49f7e', refreshBefore: new Date(Date.now() + 3_600_000).toISOString(), cursor: null, truncated: false, }, 'events/unsubscribe': {}, }; const result = results[message.method]; res.writeHead(200, { 'content-type': 'application/json' }).end( JSON.stringify( result ? { jsonrpc: '2.0', id: message.id, result: { resultType: 'complete', ...result } } : { jsonrpc: '2.0', id: message.id, error: { code: -32601, message: 'Method not found' } }, ), ); }); await new Promise(resolve => server.listen(0, '127.0.0.1', resolve)); return { server, received, url: `http://127.0.0.1:${server.address().port}/mcp` }; } function memoryStore() { const records = new Map(); return { records, async get(key) { return records.get(key); }, async getById(id) { return [...records.values()].find(r => r.id === id); }, async set(s) { records.set(s.key, structuredClone(s)); }, async update(key, patch) { records.set(key, { ...records.get(key), ...patch }); }, async delete(key) { records.delete(key); }, }; } // 1. The server advertises Events the way SEP-3415 says: under capabilities.extensions. { const { server, url } = await startServer({ extensions: { [EVENTS]: {} } }); const client = await createMCPClient({ transport: { type: 'http', url }, experimental_events: { store: memoryStore() }, }); try { await client.experimental_events.list(); console.log('1. events/list with extensions capability: OK'); } catch (error) { console.log(`1. events/list with extensions capability: FAILED (${error.message})`); } await client.close(); server.close(); } // 2 and 3. Also advertise the legacy top-level `events` key so the requests get through. const store = memoryStore(); const { server, received, url } = await startServer({ events: {}, extensions: { [EVENTS]: {} }, }); const client = await createMCPClient({ transport: { type: 'http', url }, experimental_events: { store }, }); await client.experimental_events.subscribe({ name: 'incident.created', delivery: { mode: 'webhook', url: 'https://receiver.example/hooks' }, }); const [subscription] = store.records.values(); await client.experimental_events.unsubscribe({ key: subscription.key }); for (const { method, mcpName } of received.filter(r => /^events\/(un)?subscribe$/.test(r.method))) { console.log(`2. ${method}: Mcp-Name header = ${JSON.stringify(mcpName)}`); } await client.close(); server.close(); // 3. A signed delivery whose webhook-id is a per-message ID, not the eventId. await store.set({ ...subscription, id: 'sub_a3f1c8e2b0d49f7e', status: 'active' }); const webhook = createMCPEventWebhook({ store, onEvent: async () => {} }); const secret = Buffer.from(subscription.delivery.secret.slice('whsec_'.length), 'base64'); async function deliver(webhookId) { const body = JSON.stringify({ eventId: 'evt_1', name: 'incident.created', timestamp: new Date().toISOString(), data: {}, cursor: null, }); const timestamp = String(Math.floor(Date.now() / 1000)); const signature = createHmac('sha256', secret) .update(`${webhookId}.${timestamp}.${body}`) .digest('base64'); const response = await webhook( new Request(subscription.delivery.url, { method: 'POST', headers: { 'content-type': 'application/json', 'webhook-id': webhookId, 'webhook-timestamp': timestamp, 'webhook-signature': `v1,${signature}`, 'X-MCP-Subscription-Id': 'sub_a3f1c8e2b0d49f7e', }, body, }), ); return response.status; } const perMessageId = `msg_${randomBytes(12).toString('base64url')}`; console.log(`3. webhook-id ${perMessageId} (per message, as SEP-3415 requires): HTTP ${await deliver(perMessageId)}`); console.log(`3. webhook-id evt_1 (equal to eventId): HTTP ${await deliver('evt_1')}`); ``` </details> Before (`@ai-sdk/[email protected]` from npm): ``` 1. events/list with extensions capability: FAILED (Server does not support events) 2. events/subscribe: Mcp-Name header = null 2. events/unsubscribe: Mcp-Name header = null 3. webhook-id msg_ljOGg9WOs4Xvr5U8 (per message, as SEP-3415 requires): HTTP 400 3. webhook-id evt_1 (equal to eventId): HTTP 204 ``` After (local build): ``` 1. events/list with extensions capability: OK 2. events/subscribe: Mcp-Name header = "incident.created" 2. events/unsubscribe: Mcp-Name header = "incident.created" 3. webhook-id msg_aPHH-c5aL63phGw6 (per message, as SEP-3415 requires): HTTP 204 3. webhook-id evt_1 (equal to eventId): HTTP 204 ``` ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [x] Tests have been added / updated (for bug fixes / features) - [x] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [ ] I have reviewed this pull request (self-review) ## Related Issues Fixes #25097 Co-authored-by: vercel-v[bot] <353008837+vercel-v[bot]@users.noreply.github.com>
Defines Events, an extension (
io.modelcontextprotocol/events) that lets an MCP client subscribe to things that happen in an upstream system, such as a Slack message, a repository push or a PagerDuty incident, and have an agent react without the user being present.events/list: a name, aninputSchemafor subscription arguments, apayloadSchema, and the delivery modes it supports.events/poll), push (a long-livedevents/stream), and webhook (events/subscribe, signed per Standard Webhooks, with a refreshed TTL).truncated: truesignals skipped events.This is the design sketch from the Triggers & Events Working Group, discussed in its weekly meetings, written in SEP format. To fit the
2026-07-28protocol, the capability moves underextensions,list_changedrides on asubscriptions/listenfilter field, and results carryresultType.For reviewers:
-32023to-32027) are provisional.InvalidParams.Verified with
prettier --check, and every in-page link resolves to a heading. The file keeps its0000-name, sorender-sepsskips it.AI assistance: an AI coding assistant restructured the design sketch into SEP format and aligned it with the current protocol. The design, design decisions and review are by @pja-ant.