FASTMCP SF · GITHUB HQ · DEC 2

MCP events

servers can send events to clients.

bufo watching the clock

poll

bufo on the phone

push

bufo offering a webhook

webhook

a client needs to know when data changes.

🐔 upstream

something happens out in the world

MCP server

event log

every change, in order

bufo watching the clock

client

wants to know

bufo on the phone

push

stays connected

bufo offering a webhook

webhook

gets a POST

without events, it asks the server over and over.

🐔 upstream

something happens out in the world

MCP server

event log

every change, in order

anything new?

bufo watching the clock

client

wants to know

bufo on the phone

push

stays connected

bufo offering a webhook

webhook

gets a POST

so it asks again. and again. and again.

🐔 upstream

something happens out in the world

MCP server

event log

every change, in order

anything new?

bufo watching the clock

client

wants to know

bufo on the phone

push

stays connected

bufo offering a webhook

webhook

gets a POST

client: anything new?

server: nope.

client: anything new?

server: nope.

client: anything new?

server: nope.

client: anything new?

server: yes, 3 things changed.

most answers are “nope,” and news waits for the next ask.

🐔 upstream

something happens out in the world

MCP server

event log

every change, in order

anything new?

bufo watching the clock

client

wants to know

bufo on the phone

push

stays connected

bufo offering a webhook

webhook

gets a POST

client: anything new?

server: nope.

client: anything new?

server: nope.

client: anything new?

server: nope.

client: anything new?

server: yes, 3 things changed.

ask more often: more nopes. ask less often: you hear later.

with events, the server writes each change to a log.

🐔 upstream

something happens out in the world

MCP server

event log

every change, in order

bufo watching the clock

client

wants to know

bufo on the phone

push

stays connected

bufo offering a webhook

webhook

gets a POST

with poll, the client asks for what’s new in the log.

🐔 upstream

something happens out in the world

MCP server

event log

every change, in order

bufo watching the clock

poll

asks every few seconds

bufo on the phone

push

stays connected

bufo offering a webhook

webhook

gets a POST

with push, the server sends events over an open connection.

🐔 upstream

something happens out in the world

MCP server

event log

every change, in order

bufo watching the clock

poll

asks every few seconds

bufo on the phone

push

stays connected

bufo offering a webhook

webhook

gets a POST

with a webhook, the server sends each event to a URL.

🐔 upstream

something happens out in the world

MCP server

event log

every change, in order

bufo watching the clock

poll

asks every few seconds

bufo on the phone

push

stays connected

bufo offering a webhook

webhook

gets a POST

one cursor works in every mode

poll

…f65b-4

push

…f65b-4

webhook

…f65b-4

drop, come back, or switch modes: you pick up right where you left off.

how events get into the server

a stream you listen to

@events.source

async def top_chicken(feed: EventFeed):

    async for board in race(after=feed.position):

        await events.emit(overtake, event_id=board.id)

        await feed.save_position(board.ts)

a service that POSTs to you

@mcp.custom_route("/hooks/alerts", methods=["POST"])

async def alert_hook(request):

    data = await request.json()

    await events.emit(Alert(**data), event_id=data["id"])

a store with its own history

@events.reader(EmailReceived)

def read_inbox(poll: EventPoll) -> EventBatch:

    new = INBOX[int(poll.cursor):]

    return EventBatch(events=..., cursor=str(len(INBOX)))

a tool call that starts something

@mcp.tool

async def deploy(service: str) -> str:

    run = await ci.trigger(service)

    await events.emit(Deploying(service=service, run=run.id))

    return run.id

poll, push and webhook read the same events, however they got in.

declare the event, then listen for it

the event

@events.event("chicken.overtake")

class Overtake(BaseModel):

    passer: str

    passed: str

    rank: int

 

    def for_subscription(

        self, top: int = 10

    ):

        if self.rank <= top:

            return self

the source

@events.source

async def top_chicken(feed: EventFeed):

    async for board in race():

        for change in diff(board):

            await events.emit(change, event_id=change.id)

        await feed.save_position(str(board.ts))

the server runs it once for everyone, restarts it if it fails, and resumes from feed.position.

fastmcp delivers events to clients by poll, push or webhook. you only write the event and the source.

a map of top chicken: grace's gm top chickens post, dave's coop, the rules, today's winner, apenwarr's bio, and comparisons to fantasy sports and the stock market
a map of top chicken: grace's gm top chickens post, dave's coop, the rules, today's winner, apenwarr's bio, and comparisons to fantasy sports and the stock market
a map of top chicken: grace's gm top chickens post, dave's coop, the rules, today's winner, apenwarr's bio, and comparisons to fantasy sports and the stock market
a map of top chicken: grace's gm top chickens post, dave's coop, the rules, today's winner, apenwarr's bio, and comparisons to fantasy sports and the stock market
a map of top chicken: grace's gm top chickens post, dave's coop, the rules, today's winner, apenwarr's bio, and comparisons to fantasy sports and the stock market
a map of top chicken: grace's gm top chickens post, dave's coop, the rules, today's winner, apenwarr's bio, and comparisons to fantasy sports and the stock market
a map of top chicken: grace's gm top chickens post, dave's coop, the rules, today's winner, apenwarr's bio, and comparisons to fantasy sports and the stock market
a map of top chicken: grace's gm top chickens post, dave's coop, the rules, today's winner, apenwarr's bio, and comparisons to fantasy sports and the stock market
a map of top chicken: grace's gm top chickens post, dave's coop, the rules, today's winner, apenwarr's bio, and comparisons to fantasy sports and the stock market

the demo: the top chicken race

🐔 top chicken

most-liked bluesky post of the day wins

board

server.py

@events.source
overtake · new leader · crowned

events

bufo watching the clock

poll

asks every 10s · its own announcer

bufo on the phone

push

stream held open · its own announcer

bufo offering a webhook

webhook

signed POSTs · its own announcer

each announcer is a small model that only knows what its client received.

what each client saw

bufo watching the clock

poll

every overtake, in batches, up to 10 seconds late.

bufo on the phone

push

each overtake as it happened, over a stream it kept open.

bufo offering a webhook

webhook

each overtake as it happened, POSTed to its URL by the server.

bufo on the phone

hang up

everything it missed, in order, all at once when it came back with its cursor.

push and webhook tie on speed. the difference is who pays for the delivery.

what happens when something breaks

bufo watching the clock

poll stops

picks up from its cursor

bufo on the phone

push drops

reconnects from its cursor

bufo offering a webhook

webhook URL is down

the server retries with the same event id

MCP server

restarts

with a shared store, subscriptions and positions are kept

what the server needs to deliver events

bufo watching the clockbufo on the phonebufo offering a webhook

an ordered log

every mode reads it from the client’s cursor. in memory on one replica; Redis to survive restarts and share across replicas.

bufo watching the clock (not needed)bufo on the phonebufo offering a webhook (not needed)

a doorbell for open streams

when the log grows, open streams on every replica wake up. in-process on one replica; Redis pub/sub across replicas.

bufo watching the clock (not needed)bufo on the phone (not needed)bufo offering a webhook

a sender that POSTs

one delivery line per webhook, with its own cursor, retrying with backoff. receivers drop duplicates by event id.

poll needs nothing past the log.

sources: your code that puts events on the log. fastmcp runs each one once.

EventsExtension(log=RedisEventLog("redis://…")) # fastmcp-events[redis]

where things are today

the spec

SEP-3415 is final. events is an official MCP extension; its spec is published as beta.

fastmcp

fastmcp-events is experimental. poll, push, webhooks and sources are all in 4.2.7a3.

clients

ChatGPT takes events by webhook, in Work chats. Claude and Cursor don’t support events yet.

bufo wearing a paper crown

thanks!

uv add --prerelease=allow "fastmcp[events]==4.2.7a3"