From 31a33d515f0c93f052bc6742ce8f350aba4515ab Mon Sep 17 00:00:00 2001 From: Phil Leggetter Date: Thu, 5 Nov 2026 16:33:32 +0000 Subject: [PATCH 1/2] docs: list Codex and Cursor as tested poll clients The README's client table gets its own rows for Codex (codex-cli 0.154.0, codex exec) and Cursor's CLI (cursor-agent 2026.11.05-86047df), tested against a deployed bridge running 0.8.1 on 5 Nov 2026 with wait_for_event and GitHub issue_comment events. A new guide, skills/mcp-events-bridge/references/poll-clients.md, has the config for each and the approvals each needs to call the bridge's tools non-interactively. The skill points to it, and the changelog has an Unreleased entry. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 + README.md | 8 +- skills/mcp-events-bridge/SKILL.md | 2 +- .../references/poll-clients.md | 115 ++++++++++++++++++ 4 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 skills/mcp-events-bridge/references/poll-clients.md diff --git a/CHANGELOG.md b/CHANGELOG.md index b663575..f2e4f6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Changed + +- **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)). + ## 0.9.0 (2026-11-05) Breaking, for agents that call `create_callback_url` again for an existing URL with a different `port` or `path`: that's now an error. diff --git a/README.md b/README.md index 0e941b2..3faca03 100644 --- a/README.md +++ b/README.md @@ -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 @@ -398,7 +400,7 @@ claude mcp add --transport http events-bridge https:///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) diff --git a/skills/mcp-events-bridge/SKILL.md b/skills/mcp-events-bridge/SKILL.md index 51bdacd..76d8dab 100644 --- a/skills/mcp-events-bridge/SKILL.md +++ b/skills/mcp-events-bridge/SKILL.md @@ -89,7 +89,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 (Claude Code: `claude mcp add --transport http events-bridge /mcp --header "Authorization: Bearer "`; see [references/claude-code.md](references/claude-code.md)) and use the poll tools, which need no public URL of their own (webhooks arrive at the bridge's Event Gateway sources): +- **Agents without MCP Events support** (Claude Code, Codex, Cursor): add the bridge as an HTTP MCP server (Claude Code: `claude mcp add --transport http events-bridge /mcp --header "Authorization: Bearer "`; see [references/claude-code.md](references/claude-code.md); Codex and Cursor's CLI, including the approvals each needs to call the tools unattended: see [references/poll-clients.md](references/poll-clients.md)) and use the poll tools, which need no public URL of their own (webhooks arrive at the bridge's Event Gateway sources): - `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`. diff --git a/skills/mcp-events-bridge/references/poll-clients.md b/skills/mcp-events-bridge/references/poll-clients.md new file mode 100644 index 0000000..4b45ed7 --- /dev/null +++ b/skills/mcp-events-bridge/references/poll-clients.md @@ -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:///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:///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 / (github.issue_comment, repository /) 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, under Codex's default 60 s tool timeout: 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:///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 / (github.issue_comment, repository /) 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 | From 208f8857f8e4b8d824e4c236060faa14fc4aad1a Mon Sep 17 00:00:00 2001 From: Phil Leggetter Date: Thu, 5 Nov 2026 16:38:30 +0000 Subject: [PATCH 2/2] docs: correct Codex's default MCP tool timeout (300 s) Codex 0.154.0 uses 300 s when a server sets no tool_timeout_sec (DEFAULT_TOOL_TIMEOUT in codex-rs/codex-mcp/src/rmcp_client.rs at rust-v0.154.0). Co-Authored-By: Claude Opus 5.5 --- skills/mcp-events-bridge/references/poll-clients.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/mcp-events-bridge/references/poll-clients.md b/skills/mcp-events-bridge/references/poll-clients.md index 4b45ed7..9dd2289 100644 --- a/skills/mcp-events-bridge/references/poll-clients.md +++ b/skills/mcp-events-bridge/references/poll-clients.md @@ -48,7 +48,7 @@ codex exec "Wait for new comments on issues in / (github.issue_comm 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, under Codex's default 60 s tool timeout: 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. +**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