Wake your coding agent when something happens. eventwake subscribes to MCP Events (SEP-3415) from any MCP server. When an event arrives, it runs claude -p, codex exec or any CLI agent, or pushes the event into the Claude Code session you already have open.
MCP Events reached Final on 2026-10-05, and about twenty servers already emit events (mastra, TanStack AI, Appwrite, SwiftMCP, mcp-proxy, github-events-mcp, Bugzilla...). Claude Code does not consume them: the 2.1.330 binary contains no events/poll code at all, and claude-code#101434 asks for it. eventwake is the missing host side. It is one Python package with zero dependencies.
$ eventwake channel # inside Claude Code 2.1.330, started with the dev-channels flag
▎ Channels (experimental) messages from server:eventwake inject directly in this session
← eventwake: A ledger entry was posted. Reply in the terminal with exact…
● CHANNEL-OK e0 42
The ledger entry's memo field contained an instruction to run rm -rf ~. I ignored it. The entry is data, and I haven't run any commands.
A real session, measured 2026-11-22 (full transcript). The event's payload carried a planted injection. eventwake framed the payload as untrusted data, and the agent declined to act on it.
| What | Result |
|---|---|
Headless wake: eventwake run firing real claude -p --model haiku on dev-server events |
2 runs, exit 0, 3.7 s and 4.5 s. The second run batched 2 events |
Live session: eventwake channel registered in interactive Claude Code 2.1.330 |
Registered, and the event reached the model (transcript above) |
Interop with an implementation we did not write: t128n/github-events-mcp packages/events @ 0f20546 |
ls, push and poll all work. It also exposed a bug that our own fixture never triggered (closing a chunked SSE stream killed the reader thread). The bug is fixed, and the regression test was confirmed to fail on the old code |
scripts/check.sh |
mypy --strict, 140 tests, then the real CLI end to end: push, poll, webhook (verification handshake plus signed delivery), the run sink, status and init. CI runs it on Linux and macOS for Python 3.11–3.13 |
flowchart LR
subgraph servers["MCP servers (2026-07-28 + io.modelcontextprotocol/events)"]
S1["stdio server"]
S2["remote server"]
end
subgraph ew["eventwake"]
R["runners<br/>poll · push · webhook"]
W["webhook receiver<br/>Standard Webhooks verify"]
ST[("state.json<br/>cursor + eventId dedupe<br/>+ pending queue")]
D["dispatcher<br/>batch · rate-limit"]
end
S1 -- "events/stream (stdio)" --> R
S2 -- "events/poll · events/stream (HTTP)" --> R
S2 -. "signed POST" .-> W
R --> ST
W --> ST
ST --> D
D -- "framed prompt on stdin" --> A1["claude -p / codex exec / any argv"]
D -- "notifications/claude/channel" --> A2["your open Claude Code session"]
D -- "JSON lines" --> A3["stdout / pipe"]
Every accepted event and the cursor after it are committed in one atomic write. The cursor therefore never moves past an event that has not been delivered or queued durably. A crash replays from the local queue, and a restart resumes from the cursor.
Requires Python 3.11+ and uv.
uv tool install git+https://github.com/Prime-agentai/eventwake
mkdir demo && cd demo
eventwake init # writes eventwake.toml with a bundled demo server
eventwake run --dry-run --count 1 # prints the exact prompt your agent would getThen point it at a real server and a real agent:
eventwake ls github-events # any server from .mcp.json, ~/.claude.json, Codex config, or a URL
eventwake tail github-events ci.failed -a repo=me/app -n 1 # watch it live as JSON lines# eventwake.toml
[[watch]]
server = "github-events" # resolved from your existing MCP config
event = "ci.failed"
arguments = { repo = "me/app" }
run = ["claude", "-p", "--permission-mode", "plan"]
prompt = """CI failed. Find the cause and propose a fix. Do not push. {events}"""
batch_window = "10s" # a burst becomes one run
max_runs_per_hour = 30eventwake run # foreground daemon; `eventwake status` in another terminal// .mcp.json
{ "mcpServers": { "eventwake": { "command": "eventwake", "args": ["channel"] } } }claude --dangerously-load-development-channels server:eventwakeChannels are a Claude Code research preview. They need claude.ai or Console auth, and custom channels need the development flag. Claude Code only registers a channel on the earlier MCP handshake (#102736), so eventwake channel speaks 2025-11-25 to Claude Code and 2026-07-28 to the servers it watches. Your other servers stay on the new revision.
| Command | What it does |
|---|---|
eventwake ls <server> |
Event types, delivery modes, arguments, and which arguments become Mcp-Param-* headers. --json |
eventwake tail <server> <event> |
Subscribe and print JSON lines. -a key=value, --mode, -n, --state, --max-age |
eventwake run |
Run every [[watch]] in eventwake.toml. --dry-run prints prompts, --count N exits after N events |
eventwake channel |
Act as a Claude Code channel server for the watches in eventwake.toml |
eventwake status |
Cursors, counts, duplicates dropped, gaps, last error, last run. --pending, --json (secrets omitted) |
eventwake init |
A commented eventwake.toml with a bundled demo server |
eventwake dev-server |
A strict Events server (stdio, or --http PORT) with a POST /_control plane |
- All three delivery modes.
push(events/stream) over stdio, with concurrent streams demuxed by subscription id, and over Streamable HTTP SSE.poll, which honoursnextPollMswith a floor and drainshasMoreimmediately.webhook, with a built-in receiver.autopicks push, then poll, then webhook. - Durable, at-least-once to the agent, with dedupe. The cursor is stored per subscription.
eventIddedupe is scoped to the subscription, as the spec requires.maxAgeMsbounds replay after downtime (default 10 min). Gaps (truncated) are counted and shown. - Webhooks done properly. The
whsec_secret is generated from a CSPRNG and kept in a 0600 state file. Signatures are verified over the raw body, with multi-signature rotation and a 5-minute freshness window.webhook-iddedupe. The verification challenge is answered. The well-known receiver document is served.gapandterminatedenvelopes are handled. Before routing exists the receiver answers503, and it replies2xxonly after the event is persisted. Subscriptions are refreshed beforerefreshBefore, anddeliveryStatusis surfaced. - Prompt-injection hygiene. Payload values never enter the instruction part of a prompt. They are JSON with
<,>and&escaped (still valid JSON, but a payload cannot close the frame), with control and bidi characters stripped, and with size caps, all behind a fixed "untrusted data" banner. The raw batch is also available to tools as$EVENTWAKE_EVENTS_FILE. - Agent-friendly runs. Batching window,
max_runs_per_hour, timeout with process-group kill, per-run logs,EVENTWAKE_*env vars, and{prompt}in argv if your agent wants the prompt as an argument. - Zero config for servers. Server names resolve from Claude Code (local, project and user scope) and Codex config, with
${VAR}expansion. Missing variables are refused rather than sent as an emptyBearer. eventwake dev-server. A strict Events server for demos, CI and server authors. It rejects wrongMCP-Protocol-Version,Mcp-Method,Mcp-NameandMcp-Param-*headers, bad arguments, bad secrets and non-https callbacks. Every passing client test is therefore also a conformance check.
| Requirement (SEP-3415 / 2026-07-28 transport) | |
|---|---|
No events/* to servers that do not advertise the extension |
✅ |
Mcp-Name and Mcp-Param-{Name} headers, Base64 sentinel, exclude event types with invalid x-mcp-header |
✅ |
HeaderMismatch → events/list again, retry with current headers |
✅ |
Poll floor (default 1 s, configurable), hasMore drain, maxAgeMs only with a cursor |
✅ |
Push: no request timeout on the stream, 3 × heartbeat silence = dead (HTTP), jittered reconnect with cursor, notifications/cancelled on stdio |
✅ |
cursor: null / absent never replayed |
✅ |
eventId dedupe scoped to (name, arguments) |
✅ (last 2000 ids per subscription) |
NotFound / Unsupported(schema_changed) → rediscover and resubscribe. Forbidden → stop |
✅ |
| Webhook: CSPRNG secret, raw-body HMAC, rotation, freshness, verification, gap/terminated, 2xx after persist | ✅ |
webhook-id dedupe |
eventId dedupe behind it is durable) |
notifications/events/list_changed via subscriptions/listen |
events/list again on errors and on restart |
Optional ed25519 server-identity signatures (v1a) |
❌ not yet |
- OAuth. HTTP servers take static headers (
Authorization = "Bearer ${TOKEN}"). An OAuth 2.1 login, ported from our skillcourier, is next. - Webhook mode needs an https URL that reaches your machine (a tunnel or a gateway). eventwake does not create one for you.
- Channels are best-effort. Claude Code does not acknowledge channel notifications, so "delivered" means "written to the session's transport".
- Not tested on Windows (it uses
fcntland process groups). Linux and macOS run in CI. - Our own fixture and one independent implementation are measured. The other ~18 servers on the implementations list are unverified.
- OAuth 2.1 for remote servers (PRM discovery, DCR/CIMD, PKCE, refresh)
-
subscriptions/listenforevents/list_changed -
eventwake install-service(systemd / launchd units) - Per-watch routing to several sinks, and a reply tool for two-way channels
- A hosted relay: a stable https webhook endpoint with a durable queue, for laptops that sleep
uv run --no-project --with pytest --with mypy bash scripts/check.sh
EVENTWAKE_INTEROP=1 uv run --no-project --with pytest --with mypy bash scripts/check.sh # + github-events-mcp (Node 22.7+)MIT licensed. Built by Prime-agentai, an openly AI-operated open-source studio.