Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- **The setup skill, after a cold test** (an agent with no context, asked to "set up the MCP Events bridge"): it defaults to a local bridge; creates the bridge in a folder of its own; asks which services and repositories before writing the config, with a GitHub example; has the user put credentials in `.env` rather than the chat, in a new Hookdeck project; treats event content as untrusted; runs `serve` in the background with a log; connects Claude Code without showing the secret, and recommends the plugin for events between prompts; and checks the bridge with `watch` before connecting an agent.
- **The `watch` skill without the plugin:** `npx skills add hookdeck/mcp-events-bridge` also installs the plugin's `watch` skill, and without the plugin its `events-bridge` commands fail with `command not found`. The skill now tells the agent to stop and explain how to install the plugin, or what to use outside Claude Code. To install only the setup skill, add `--skill mcp-events-bridge`.
- **`list_sources` lists each event's filters:** a new `filters` field maps each event name to the arguments it takes, each with its type and description, from the event's inputSchema. Clients with tools only (Claude Code without the plugin, Codex, Cursor) can't call `events/list`, so they had no way to find the filters, and guessed. `events` is still a list of names. The descriptions of `list_sources`, and of `poll_events` and `wait_for_event`'s `name` and `arguments`, point there instead of at `events/list`, and so do `get_event` and `list_events`' unknown-name errors.
- **Docs:** Codex (codex-cli 0.154.0, `codex exec`) and Cursor's CLI (`cursor-agent` 2026.11.05-86047df) are listed as tested clients in the README, and a new guide, [`poll-clients.md`](skills/mcp-events-bridge/references/poll-clients.md), sets each up to poll the bridge, with the approvals each needs to call the bridge's tools unattended: Codex's `default_tools_approval_mode = "approve"`, and Cursor's `--trust`, `--approve-mcps` and a tool allowlist in `.cursor/cli.json`. The skill points to it ([#94](https://github.com/hookdeck/mcp-events-bridge/pull/94)).

### Fixed

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ Clients that support MCP Events subscribe to the bridge, and receive each event
| Mastra (`@mastra/mcp`) | MCP Events, poll or webhook delivery | Poll: no. Webhook: a callback URL, as for the Vercel AI SDK | 2.5.0 | [Library guide](skills/mcp-events-bridge/references/library-clients.md#mastra) |
| TanStack AI (`@tanstack/ai-mcp`) | MCP Events, webhook delivery | A callback URL: your own public route, or one a local bridge creates | 1.0.0 | [Library guide](skills/mcp-events-bridge/references/library-clients.md#tanstack-ai) |
| OpenClaw | MCP Events (beta builds only), webhook delivery | Yes: a bare HTTPS origin, with no path, which a local bridge's callback URLs can't be | Not tested | None yet ([openclaw#184684](https://github.com/openclaw/openclaw/issues/184684)) |
| Other MCP clients (Cursor, Codex, VS Code and others) | Polls, with `wait_for_event` and `poll_events` | No | Not tested | [Polling](#polling) |
| Codex | Polls, with `wait_for_event` and `poll_events` | No | codex-cli 0.154.0 (`codex exec`) | [Poll clients guide](skills/mcp-events-bridge/references/poll-clients.md#codex) |
| Cursor's CLI (`cursor-agent`) | Polls, with `wait_for_event` and `poll_events` | No | 2026.11.05-86047df (`cursor-agent -p`) | [Poll clients guide](skills/mcp-events-bridge/references/poll-clients.md#cursor) |
| Other MCP clients (the Cursor editor's agent, VS Code and others) | Polls, with `wait_for_event` and `poll_events` | No | Not tested | [Polling](#polling) |

Versions are the ones tested against the bridge, in October 2026. MCP Events support is experimental in Hermes Agent and in the three libraries.
Versions are the ones tested against the bridge, in October and November 2026. MCP Events support is experimental in Hermes Agent and in the three libraries. Codex and Cursor's CLI were tested non-interactively, and each needs the bridge's tools allowed before it can call them: see the guide.

## Set up with a coding agent

Expand Down Expand Up @@ -398,7 +400,7 @@ claude mcp add --transport http events-bridge https://<bridge>/mcp --header "Aut

Any MCP client that can send a header connects the same way: the `/mcp` endpoint, with `BRIDGE_MCP_SECRET` as a bearer token.

Then ask the agent to wait for an event (Claude Code: see [the guide](skills/mcp-events-bridge/references/claude-code.md)), for example "wait for fills.order.filled for AAPL and tell me about each fill". It calls `wait_for_event`, which returns as soon as there are events (or after up to 50 seconds with none), and calls it again with the `cursor` it returned.
Then ask the agent to wait for an event (Claude Code: see [the guide](skills/mcp-events-bridge/references/claude-code.md); Codex and Cursor's CLI: see [the poll clients guide](skills/mcp-events-bridge/references/poll-clients.md)), for example "wait for fills.order.filled for AAPL and tell me about each fill". It calls `wait_for_event`, which returns as soon as there are events (or after up to 50 seconds with none), and calls it again with the `cursor` it returned.

![Claude Code, asked to watch hookdeck/hookdeck-demos for new issue comments until three arrive, calls the events-bridge tools and reports each comment as it's posted, then lists all three with their times](docs/images/claude-code-wait-for-event.png)

Expand Down
2 changes: 1 addition & 1 deletion skills/mcp-events-bridge/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Every event is named **`{source id}.{event}`**: the source `id` (by default its
3. What the agent's receiver must do: [references/receiving-deliveries.md](references/receiving-deliveries.md).
- **Hermes Agent** (v0.22.5 or later; experimental in Hermes): follow [references/hermes-agent.md](references/hermes-agent.md).
- **Code built on the Vercel AI SDK, Mastra or TanStack AI** (their MCP client libraries; experimental): follow [references/library-clients.md](references/library-clients.md).
- **Agents without MCP Events support** (Claude Code, Codex, Cursor): add the bridge as an HTTP MCP server and use the poll tools, which need no public URL of their own (webhooks arrive at the bridge's Event Gateway sources). For Claude Code and a local bridge, run this from the bridge's folder, so the secret goes from `.env` into Claude Code's config without being typed or shown: `claude mcp add --transport http events-bridge http://127.0.0.1:8080/mcp --header "Authorization: Bearer $(grep '^BRIDGE_MCP_SECRET=' .env | cut -d= -f2-)"` (see [references/claude-code.md](references/claude-code.md)). The poll tools:
- **Agents without MCP Events support** (Claude Code, Codex, Cursor): add the bridge as an HTTP MCP server and use the poll tools, which need no public URL of their own (webhooks arrive at the bridge's Event Gateway sources). For Claude Code and a local bridge, run this from the bridge's folder, so the secret goes from `.env` into Claude Code's config without being typed or shown: `claude mcp add --transport http events-bridge http://127.0.0.1:8080/mcp --header "Authorization: Bearer $(grep '^BRIDGE_MCP_SECRET=' .env | cut -d= -f2-)"` (see [references/claude-code.md](references/claude-code.md)). For Codex and Cursor's CLI, including the approvals each needs to call the tools unattended, see [references/poll-clients.md](references/poll-clients.md). The poll tools:
- `wait_for_event` (`name`, `arguments`, `cursor`): waits up to 45 s and returns as soon as there are events. Call it again with the `cursor` it returned to keep waiting.
- `poll_events` (same, plus `maxEvents`, `maxAgeMs`): returns at once; call again after `nextPollMs`, or at once when `hasMore` is true.
- Without a cursor, both start from now. Events can repeat: dedupe by `eventId`. For events that already happened, use `list_events` and `get_event`.
Expand Down
115 changes: 115 additions & 0 deletions skills/mcp-events-bridge/references/poll-clients.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Codex and Cursor with the bridge

Codex and Cursor's CLI poll the bridge with its tools, as Claude Code does without the plugin: the agent calls `wait_for_event`, which returns as soon as there are events, and calls it again with the `cursor` it returned. Services send webhooks to the bridge's Event Gateway sources and the bridge reads them from Event Gateway, so neither the agent nor the bridge needs a public URL of its own, and a local bridge works as well as a deployed one.

Both send `BRIDGE_MCP_SECRET` as an `Authorization: Bearer` header to the bridge's `/mcp` endpoint, read from an environment variable, so the secret stays out of their config files. Run them where `BRIDGE_MCP_SECRET` is set:

```sh
export BRIDGE_MCP_SECRET=... # the bridge's, from its .env
```

Run without a person to approve each call, both refuse the bridge's tools until you allow them. Each section below says how.

| Client | Tested | Run as | Allow the tools with |
| --- | --- | --- | --- |
| [Codex](#codex) | codex-cli 0.154.0 | `codex exec` | `default_tools_approval_mode = "approve"` on the server |
| [Cursor](#cursor) | `cursor-agent` 2026.11.05-86047df (Cursor's CLI) | `cursor-agent -p --trust --approve-mcps` | A tool allowlist in `.cursor/cli.json` |

**Tested:** each against a deployed bridge running 0.8.1 on 5 Nov 2026, with the poll tools (`wait_for_event`, called again with the `cursor` it returned) and the GitHub source's `github.issue_comment` events. Interactive Codex and the Cursor editor's agent weren't tested. Whether the tool annotations added in 0.9.0 (`readOnlyHint`) remove the need for Codex's approval mode or Cursor's allowlist hasn't been tested either.

## Codex

### 1. Add the bridge as an MCP server

```sh
codex mcp add events-bridge --url https://<bridge>/mcp --bearer-token-env-var BRIDGE_MCP_SECRET
```

For a local bridge, use the endpoint `serve` prints (`http://127.0.0.1:8080/mcp`). This writes the server to Codex's `config.toml` (`~/.codex/config.toml` by default), naming the environment variable, not the secret.

### 2. Allow the bridge's tools

`codex exec` refuses every call to the bridge ("MCP tool call requires approval, but approval policy is never") until the server's tools are approved. Add `default_tools_approval_mode` to the server's entry:

```toml
[mcp_servers.events-bridge]
url = "https://<bridge>/mcp"
bearer_token_env_var = "BRIDGE_MCP_SECRET"
default_tools_approval_mode = "approve"
```

This approves every tool the bridge offers. All are read-only except `create_callback_url`, which a local bridge offers and which creates a callback URL in Event Gateway; a deployed bridge doesn't offer it.

### 3. Ask for events

```sh
codex exec "Wait for new comments on issues in <owner>/<repo> (github.issue_comment, repository <owner>/<repo>) and summarize each one."
```

Codex calls `wait_for_event` and keeps calling it with the `cursor` it returned. Ask "what events can the bridge give me?" for the names and filters your bridge offers.

**Tested:** codex-cli 0.154.0, `codex exec`, against the deployed bridge running 0.8.1, on 5 Nov 2026. Codex called `wait_for_event` in a loop without being told how, and received 2 of 2 `github.issue_comment` events: about 3 s after each webhook when a call was waiting, and about 6 s when the webhook arrived between calls, with none lost. Calls with no events returned after about 44 s, well under Codex's default MCP tool timeout of 300 s. If you set a shorter one for the server (`tool_timeout_sec`), keep it above 50 s, the longest `wait_for_event` waits. Interactive Codex wasn't tested.

## Cursor

Tested with Cursor's CLI, `cursor-agent`, not the agent in the Cursor editor.

### 1. Add the bridge as an MCP server

In the project's `.cursor/mcp.json`:

```json
{ "mcpServers": { "events-bridge": { "url": "https://<bridge>/mcp", "headers": { "Authorization": "Bearer ${env:BRIDGE_MCP_SECRET}" } } } }
```

For a local bridge, use the endpoint `serve` prints (`http://127.0.0.1:8080/mcp`). Cursor reads `${env:BRIDGE_MCP_SECRET}` from the environment, so the file holds no secret and can be committed.

### 2. Allow the bridge's tools

Non-interactive `cursor-agent` needs three approvals:

- **`--trust`:** trusts the workspace.
- **`--approve-mcps`:** approves the project's MCP servers.
- **A tool allowlist** in the project's `.cursor/cli.json` (see Cursor's [permissions reference](https://cursor.com/docs/cli/reference/permissions)). Without it, every call to the bridge is rejected ("User rejected MCP").

```json
{
"permissions": {
"allow": [
"Mcp(events-bridge:wait_for_event)",
"Mcp(events-bridge:poll_events)",
"Mcp(events-bridge:list_events)",
"Mcp(events-bridge:get_event)",
"Mcp(events-bridge:list_sources)"
],
"deny": []
}
}
```

The list leaves out `create_callback_url` and `list_callback_urls`, which polling doesn't use.

### 3. Ask for events

```sh
cursor-agent -p --trust --approve-mcps "Wait for new comments on issues in <owner>/<repo> (github.issue_comment, repository <owner>/<repo>) and summarize each one."
```

Cursor calls `wait_for_event` and calls it again with the `cursor` it returned.

**Tested:** `cursor-agent` 2026.11.05-86047df, with `-p --trust --approve-mcps` and the allowlist above, against the deployed bridge running 0.8.1, on 5 Nov 2026. It received 2 of 2 `github.issue_comment` events, about 4.5 s and 5.5 s after each webhook. Calls with no events returned after about 49 s, with no timeout. The Cursor editor's agent wasn't tested.

## Using the events

- **Start from now:** a first call without a cursor returns only events after it. For events that already happened, ask for them: the agent uses `list_events` and `get_event`.
- **Repeats:** delivery is at least once. If the same `eventId` comes back, it's the same event.
- **Only during a run:** `wait_for_event` waits only while the agent is working on your request. Between runs, events wait in Event Gateway; a new run without a cursor starts from now, so ask for missed ones with `list_events`.
- **Latency:** an event reaches the agent about 2 seconds after Event Gateway receives it, sometimes up to 15 (see Polling in the README), plus the time until the agent's next call if none is waiting.

## Troubleshooting

| Symptom | Fix |
| --- | --- |
| Codex: "MCP tool call requires approval, but approval policy is never" | Add `default_tools_approval_mode = "approve"` to `[mcp_servers.events-bridge]` (Codex, step 2) |
| Cursor: "User rejected MCP" | Add the allowlist to `.cursor/cli.json`, and run with `--trust --approve-mcps` (Cursor, step 2) |
| The server doesn't connect, or the bridge answers 401 | `BRIDGE_MCP_SECRET` must be set in the shell that starts the agent, and match the bridge's |
Loading