ghwh: GitHub webhooks for agents
GitHub events (PRs, issues, comments, reviews, CI results, pushes) reach your agents and scripts within seconds, on any machine, with no open port. That includes laptops behind NAT, headless VPSes and a whole swarm of them at once.
GitHub ──webhook──▶ your hub (Cloudflare Worker + Durable Object) ──▶ ghwh tail / ghwh wait (WebSocket)
signature check, last 1000 events, seq └▶ any MCP client (POST /mcp)
- You run your own hub. It's a small Worker on your Cloudflare account; the free plan is enough. There is
no shared service and no default domain.
bunx ghwh setupdeploys it and hooks your repos. - Every client reads the same ordered log. Each event has an increasing
seq. Clients resume from their last seq after a restart or disconnect, so nothing is missed. The hub keeps the last 1000 events. - For agents. Clients can be a CLI that prints JSON lines (
tailfor streaming tools,waitfor agents that can only run a command and read the result), an MCP endpoint (wait_eventslong-polls), or the raw WebSocket. - Private by default. Without the stream key you get nothing. Optionally, the hub can serve public repos' events without a key.
Quick start
The wizard checks every step and offers fixes until events actually arrive:
- Cloudflare login: in the browser, or with a pasted API token on servers without one.
- Deploy: the Worker, on
*.workers.devor on your own domain (hooks.example.com). - Secrets: it generates the webhook secret and the stream key and stores them in
~/.config/ghwh/config.json(0600). - Hooks: it adds webhooks to the repos or orgs you name (through
gh), pings each one, and waits until the ping reaches the hub.
Then:
Install the CLI with npm i -g ghwh or bun add -g ghwh, which pull in a prebuilt binary, or with cargo install ghwh.
Other machines only need bunx ghwh setup --connect https://hooks.example.com and the stream key.
Use it from agents
| Agent can… | Use |
|---|---|
run a command and react to each output line (Claude Code's Monitor tool, tail -f-style tools) |
ghwh tail --repo owner/name |
| only run a command and read its result (pi, simple tool loops, cron) | ghwh wait --state FILE -t 600 in a loop |
| speak MCP | https://<hub>/mcp, tools wait_events and list_events |
| anything else | the WebSocket at wss://<hub>/github/stream (protocol) |
# Claude Code: add the hub as an MCP server
More, including prompts that work: docs/agents.md.
Events
Every event has seq, kind, action, repo, private and sender, plus fields for its kind:
| kind | actions | from GitHub event |
|---|---|---|
pr |
opened, reopened, ready_for_review, converted_to_draft, closed, synchronize, labeled, unlabeled | pull_request |
issue |
opened, reopened, closed, labeled, unlabeled | issues |
comment |
created | issue_comment, pull_request_review_comment |
review |
submitted | pull_request_review |
check |
completed | check_suite, workflow_run |
push |
pushed (default branch only) | push |
ping |
ping | ping (when a hook is created or pinged) |
Field by field: docs/protocol.md.
Without the wizard
You can do everything setup does by hand with wrangler and the GitHub UI: docs/manual-setup.md. That page also covers custom domains, org-wide hooks, using a GitHub App instead of per-repo hooks, and rotating keys.
Deploying or updating the hub from a checkout of this repo, step by step with a check after each one: skills/deploy-hub/SKILL.md. Claude Code also loads it as the deploy-hub skill.
Cost and limits
- Cost: one Worker and one Durable Object (SQLite). Typical webhook volume fits Cloudflare's free plan. WebSocket clients hibernate while idle.
- Retention: the hub keeps the last 1000 events. A client that stays offline past that sees a gap (
firstin hello). - Size: comment and review bodies are cut at 1000 characters and titles at 300. Use
urlor the GitHub API for the full text.
Develop
Releases: push a v* tag. CI builds the binaries, publishes the npm packages and the crate, and attaches the
binaries to a GitHub release (.github/workflows/release.yml).
MIT