mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-12-02 07:51:26 +01:00
| .. | ||
| fastmcp_events | ||
| pyproject.toml | ||
| README.md | ||
fastmcp-events
Events for FastMCP servers and clients: the io.modelcontextprotocol/events extension defined in SEP-3415, with poll and push delivery.
Experimental: the API may change in any release without a deprecation period.
pip install "fastmcp[events]"
# with the Redis-backed log, through Docket
pip install "fastmcp[events]" "fastmcp-events[docket]"
from pydantic import BaseModel
from fastmcp import FastMCP
from fastmcp_events import EventsExtension
mcp = FastMCP("alerts")
events = EventsExtension()
mcp.add_extension(events)
@events.event("alert.fired")
class AlertFired(BaseModel):
"""An alert fired."""
project: str
# later, in a tool or webhook handler:
# await events.emit(AlertFired(project="api"))
See the Events docs.