fastmcp.experimental.events.extension
FastMCP server implementation of the MCP Events extension (poll and push).
Experimental: this API may change in any release without a deprecation period.
Classes
Event
An event a check function reports.
Set event_id to the upstreamβs stable identifier whenever it has one:
clients deduplicate on it, and a generated ID differs on every poll.
EventBatch
What a check function returns for one poll.
cursor is the position after events, returned to the client and passed
back on its next poll. Leave it None for an event type with no replay.
EventPoll
One events/poll request, as a check function receives it.
A cursor of None means βstart from nowβ: return no events and the
current position.
EventsExtension
Serve event types over SEP-3415 poll and push delivery.
Experimental: this API may change in any release without a deprecation
period.
Each event type is one check function that reports what happened since a
cursor. events/poll calls it once per request, so the server keeps no
subscription state. events/stream calls it on a loop for as long as the
client holds the request open; pass push=False on a host that cannot
keep a response stream open.
event
name: Event type name clients subscribe to.description: What the event means and when it fires.input_schema: JSON Schema for subscription arguments. Polls whose arguments do not match are rejected before the check runs.payload_schema: JSON Schema for each eventβsdata.meta: Optional_metafor the listing.