MCP Events, explained: three ways a server can wake your agent

How the MCP Events extension lets an agent react to a merged PR without you typing: poll, push, webhook, cursors, and what is standard, beta or ours.

· Jeremy

A signal crosses from a distant tower to three receivers representing polling, streaming and webhooks.

Your agent's pull request is merged, and the agent has no idea. You type "it's merged, carry on", and you are the messenger. I wrote about wiring that up by hand in October. The MCP project has since published the Beta Events extension, which defines how a client discovers event types and receives occurrences.

The extension builds on the core MCP protocol. Each server advertises the event types and delivery modes it implements.

LevelWhat it isStatus I checked
StandardThe core protocol, MCP revision 2026-07-28Has notifications and subscriptions/listen. No events/* methods.
Extensionio.modelcontextprotocol/events, defined by SEP-3415The proposal (SEP) is Final; the extension's text is Beta.
ImplementationWhat a given server or chat app actually doesVaries, see the end.

The gap in the core protocol

MCP already has notifications. A server can tell a connected client that its list of tools changed, or that a resource it watches was updated. In the 2026-07-28 revision a client asks for these by opening a stream with subscriptions/listen and ticking boxes: tools changed, prompts changed, resources changed, or specific resource addresses.

An application event such as “pull request 482 was merged” needs a typed payload and, depending on the client, replay or a webhook.

The mechanism

The server publishes event types, each with a name, a schema for the arguments you subscribe with (inputSchema), a schema for what an occurrence looks like (payloadSchema) and the delivery modes it supports. A client checks that server/discover advertises io.modelcontextprotocol/events before calling events/list.

An occurrence, one thing that happened, always has the same envelope: eventId, name, timestamp, data and may include a cursor on push and webhook delivery. Poll puts the cursor on the response that contains the batch.

There are then three ways to receive occurrences. The server advertises the subset it supports for each event type, and the spec says none is mandatory.

1. Poll: events/poll. The client asks "anything since my cursor?" at the interval the server recommends (nextPollMs). There is no subscribe step: the first poll, with cursor: null, means "start from now". Polling is a client protocol operation. The host decides whether to route any returned occurrence to an agent.

2. Push: events/stream. The client opens one long request per subscription and the server writes occurrences onto it, with heartbeats so a dead connection is noticed (30 seconds is the recommended default). On a drop, the client reconnects with its last cursor.

3. Webhook: events/subscribe. The client gives the server an https callback URL and a secret it chose. The server POSTs each occurrence there. The subscription has a lifetime (a TTL), and the client renews it by subscribing again before it runs out. events/unsubscribe ends it at once. This is the mode for a client that cannot keep a connection open.

The client discovers event types, then receives events by polling, via notifications on a stream, or at a signed webhook endpoint.

Three lanes, one envelope. The client picks one per subscription.

One concrete case: a merged pull request

Take the server I run, agentproto, which offers GitHub events. One of its event types is github.pull_request.closed. Its subscription arguments are the repository and the pull request number, and its payload says whether the PR was merged or only closed.

A client that wants to know about PR 482 in acme/shop polls like this:

{
  "name": "github.pull_request.closed",
  "arguments": { "repo": "acme/shop", "number": 482 },
  "cursor": null
}

The first answer is empty and carries a fresh cursor. Later answers carry the occurrence when it exists. This is the shape the spec defines, with invented values:

{
  "resultType": "complete",
  "events": [{
    "eventId": "evt_001",
    "name": "github.pull_request.closed",
    "timestamp": "2026-12-02T10:14:09Z",
    "data": { "action": "closed", "merged": true, "repo": "acme/shop", "number": 482 }
  }],
  "cursor": "opaque-position-after-this-event",
  "truncated": false,
  "hasMore": false,
  "nextPollMs": 30000
}

The client saves the cursor and sends it back on the next poll. It can run the poll loop outside the model and forward a matching occurrence to wake the agent. The Events extension handles delivery to the client. Waking a session is a host decision.

The cursor is the point

Most of the design work is in the cursor, so it is worth a minute.

  • It is an opaque string. The client never reads it; it stores it and hands it back.
  • null means "from now". A non-null cursor asks the server to replay from that position.
  • Replay is optional per event type. A server that cannot replay returns cursor: null and the client accepts that events during a gap are gone.
  • maxAgeMs bounds the replay. A laptop that was closed for a week can resume with its old cursor and maxAgeMs: 300000, and get at most the last five minutes.
  • truncated: true is the single warning that the server started from a later position than the client asked for, so events may have been skipped. The client should treat it as a possible gap, for example by re-reading the PR's state with a normal tool. It is never an error.

Delivery guarantees, in plain words

The spec is careful here, and so should we be:

  • At-least-once, in all three modes, when the cursor is backed by a durable source and the client replays from its last cursor after a restart. The same occurrence can arrive twice. Use eventId to drop duplicates; "exactly-once requires application-level deduplication".
  • At-most-once for event types that exist only in memory and have no replay: after a server restart, they are gone.
  • Order is kept inside one subscription for poll and push. For webhook, the spec says delivery order is "best-effort", because each event is retried on its own. Nothing is ordered across subscriptions.
  • The spec says to design clients and agents to tolerate duplicate and out-of-order events, and to read authoritative state with tools rather than rely on the payload alone.

Who is trusted

A payload comes from outside, so the spec calls it what it is: "untrusted data", to be handled with the same care as a tool result. An email subject can say "ignore all previous instructions". Servers should keep payloads small, only what is needed to decide, and let the agent fetch the rest. And "receipt of an event does NOT constitute authorization to act": whatever the agent does next goes through normal authorization.

Webhooks add their own protections. The secret must be one the client picked, in the Standard Webhooks format (whsec_ followed by base64 of 24 to 64 random bytes). Each delivery carries webhook-id, webhook-timestamp and webhook-signature headers, plus X-MCP-Subscription-Id. The signature is an HMAC-SHA256 over the id, the timestamp and the exact body; receivers should reject anything older than five minutes. The server confirms the endpoint intends to receive requests before delivery. The extension requires callback validation again at delivery time and forbids redirects.

What to expect from a real server

The spec describes the contract. These are my notes from the code of the one server I know well, agentproto's runtime (@agentproto/runtime 6.10.0, @agentproto/mcp-server 0.9.2) as of December 2.

  • It offers poll, push and webhook for four GitHub event types: a PR closed or merged, new commits pushed to a PR, a review submitted, and a check suite completed.
  • Poll and push read from a journal kept on disk, with a default retention of 24 hours and 5,000 entries. A cursor older than that comes back as truncated: true, as the spec asks.
  • A webhook subscription does not replay past events: if you pass a cursor on subscribe, the answer is truncated: true. Use poll or reconnect a stream for replay.
  • Push is capped at 32 concurrent streams, and is offered only on the 2026-07-28 era of the endpoint.
  • Webhook subscriptions get a lifetime between one minute and 30 days (default seven), and deliveries are retried a bounded number of times.
  • The wire contract for webhooks is written as an agentproto spec, AIP-76. AIP-76 is a draft agentproto specification.

In an earlier test of the webhook path, the time from a PR closing to the event being stamped was about a minute, because the daemon asks GitHub whether something changed. It behaves like a clock, not like a live feed. I have not measured the poll or push paths against any other server.

Limits you will hit

  1. It is Beta. The proposal is Final, the text is Beta, and the spec says breaking changes are expected to be rare but possible. SEP Final does not mean the extension is generally available.
  2. Client support varies. Some clients implement only one delivery mode. Check the MCP client support matrix and the client’s documentation before picking a mode.
  3. A webhook needs a reachable https address. A laptop behind a home router needs a tunnel, which adds a moving part. Poll and push need none.
  4. Replay is only as good as the source. If the thing you watch has no history, you get at-most-once and a gap on every outage.
  5. The core subscriptions/listen still cannot resume. Events does not change that; it sits beside it.
  6. A 200 only means "accepted". I learned that in October: a webhook can be accepted and still never wake anything on the other side. Put a visible step at each stage.

Start here

  1. Decide whether you need push at all. If a one-minute lag is fine, poll is the simplest mode and needs no public address.
  2. Treat every payload as untrusted, and fetch details with a tool.
  3. Store the cursor after each response, including empty ones, and deduplicate on eventId.
  4. On truncated: true, re-read the real state.
  5. Check your client's support before you pick a mode. A webhook-only client cannot use poll.

The aim is the same as in October: stop being the messenger.

MCP Events specification · SEP-3415 · Core MCP schema · AIP-76 · Runtime source