# Agent platform recipes

Herald talks to agent platforms in two directions:

- **Pull (MCP):** the agent connects to `herald-mcp` and asks for the briefing when it wants it.
- **Push (webhook):** Herald POSTs a `herald.event/v1` event to the platform when a briefing is
  published (or a run fails), and the platform acts on it.

Use pull when the agent should answer questions ("what happened in Brazilian markets today?") or
change what you follow. Use push when something should happen right after Herald finishes,
without polling.

| Platform | Pull via MCP | Push via webhook | Status |
|---|---|---|---|
| [OpenBot](openbot.md) | stdio or streamable HTTP + bearer | webhook routine (Standard Webhooks, 64 KiB cap) | MCP verified (2026-11-29); push documented |
| [Hermes Agent](hermes.md) | stdio or streamable HTTP + bearer | webhook route (Standard Webhooks) | documented |
| [OpenClaw](openclaw.md) | stdio or streamable HTTP + bearer | gateway hooks (bearer) | documented |
| [Claude Desktop and Claude Code](claude.md) | stdio or streamable HTTP + bearer | routine API trigger (Claude Code) | documented |
| [n8n](n8n.md) | MCP Client Tool node (HTTP + bearer) | Webhook node (header auth) | documented |

**verified** means the recipe was run end to end against a real install on the date shown.
**documented** means it follows the platform's official docs (linked in each recipe) and every
Herald config snippet is checked by `tests/test_integration_docs.py`, but nobody has run it against
the platform yet. If you run one, open an issue or PR to mark it verified, or to add a platform.
Make, Zapier and other generic webhook consumers follow the [n8n](n8n.md) push recipe: an HTTPS
endpoint, a bearer or header token, and Herald's JSON.

## Common ground

**MCP tools.** Bot tools, read-only first:

| Tool | Changes anything? |
|---|---|
| `herald_briefing(date?, language?, category?)` | no |
| `herald_categories(language?)` | no |
| `herald_history_search(query, days?, profile?, limit?)` | no |
| `herald_follow(categories)` / `herald_unfollow(categories)` | yes: rewrites `config.json` (from the next run) |

Allow the read-only ones first. Add `herald_follow` / `herald_unfollow` only for agents you trust
to change your config. The pipeline tools (`herald_run`, `herald_fetch`, ...) spend AI credits;
leave them off chat agents.

**Transports.** stdio when the platform runs on the same machine as Herald (it starts
`herald-mcp` itself). Streamable HTTP otherwise:

```bash
# HERALD_MCP_TOKEN (16+ characters) in Herald's .env
openssl rand -hex 32
uv run herald-mcp --http            # http://127.0.0.1:8765/mcp
```

Every HTTP request must send `Authorization: Bearer <HERALD_MCP_TOKEN>`. Keep it on `127.0.0.1`,
and put a reverse proxy with TLS in front if the platform runs on another machine.

**Webhook.** One `webhook` notifier per target, in `config.json` under `notifiers`. Secrets go in
`.env` and are referenced as `${VAR}`. Events, auth modes and formats are in
[Channels: Webhook for agents](../channels.md#webhook-for-agents); the receiver side is in [`../webhooks.md`](../webhooks.md).

## Testing without the platform

Point the same notifier at `herald dev sink` first. It checks the HMAC signature (`--secret`), the
Standard Webhooks signature (`--standard-webhooks-secret`) or the bearer token (`--token`),
validates envelopes against the schema, and saves every body it gets:

```bash
uv run herald dev sink --port 8787 --token "$HERALD_WEBHOOK_TOKEN" --out herald-sink
# in another shell: HERALD_WEBHOOK_URL=http://127.0.0.1:8787/ in .env, then a real run that
# delivers (not --dry-run) against a throwaway data dir, so your history is untouched:
uv run herald --data-dir /tmp/herald-try run --hours 6
```

Then replay a saved body to the platform, without running Herald again (bearer or no auth; HMAC
and Standard Webhooks signatures have a timestamp and expire after five minutes):

```bash
curl -i -X POST "$PLATFORM_WEBHOOK_URL" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $PLATFORM_TOKEN" \
  --data-binary @herald-sink/evt_<id>.json
```

For the MCP side, `npx @modelcontextprotocol/inspector` connects to `herald-mcp` (stdio, or
`http://127.0.0.1:8765/mcp` with the bearer header) and lists and calls the tools.
