Repository navigation
Description
Problem or use case
When a scheduled squirrelscan cloud audit finishes or fails, or opens new issues, the coding agent working on that site doesn't find out until someone asks it to check. We want squirrelscan to ping the running agent session ("last night's audit of example.com found 11 new issues") so the agent can triage and fix without being prompted.
Claude Code supports this through channels (research preview): a local stdio MCP server declares capabilities.experimental['claude/channel'] and sends notifications/claude/channel with { content, meta }. Claude sees a <channel source="..."> event and starts a turn, even if the session is idle. Docs: https://code.claude.com/docs/en/channels and https://code.claude.com/docs/en/channels-reference
Channels have to be local stdio servers. A hosted MCP server can't be one, so the bridge has to be the squirrel binary, which already holds the user's cloud login.
Proposed behavior
A new squirrel channel command that runs a stdio MCP channel server. It polls the logged-in org's cloud notification feed and emits a channel event for each new audit_complete, audit_failed and issues_detected notification.
- Declare
capabilities.experimental['claude/channel'] = {}. Do not declareclaude/channel/permission(permission relay): nobody but Claude Code should be able to approve tool use in the session. instructions(8,192-character cap) explains what the events mean and which squirrelscan tools to call next (get_report,list_issues,compare_audits).metakeys must match[A-Za-z0-9_], because Claude Code silently drops keys with hyphens: usewebsite_id,run_id,category,domain.- Event
contentis built from ids, counts and fixed strings only, never from text taken from crawled pages (titles, issue text). That text is attacker-influenced, and an ungated channel is a prompt-injection vector. The agent pulls details through tools. - Negotiate the legacy MCP handshake. Claude Code does not register a channel server that negotiates MCP revision 2026-07-28.
- Persist the last-seen cursor per org under
~/.squirrel/so a restart catches up exactly once. Channels only deliver while a session is open, and Claude Code doesn't replay events. - No cloud login: emit a single event telling the agent the user needs to run
squirrel login, and keep running.
Needs a cursor (after=) on the cloud notification feed. That's tracked on the cloud side.
Alternatives considered
- Making the hosted MCP server the channel: not possible, because channels are stdio only.
- Cloud webhooks into the developer machine: needs a public URL or tunnel.
- MCP Triggers & Events (a standard server-to-client push mechanism): still at the ideating stage in the MCP working group. Revisit once it lands, so agents other than Claude Code get the same push.
Who it helps
Claude Code users with scheduled cloud audits who want their agent to follow up on results automatically.
Rollout caveat: only plugins on Anthropic's channel allowlist register with --channels. Until squirrelscan is listed, users need --dangerously-load-development-channels server:squirrelscan, or an org admin who adds us to allowedChannelPlugins. Team and Enterprise orgs must also set channelsEnabled.
Acceptance Criteria
-
squirrel channelstarts a stdio MCP server that Claude Code registers as a channel when launched with--dangerously-load-development-channels server:squirrelscan. - When a cloud audit for the logged-in org completes, the open session receives a channel event within 60 seconds, carrying
category,website_id,run_idanddomainmeta and a one-line summary. -
audit_failedandissues_detectednotifications are also delivered, and the delivered categories are configurable. - Events that happened while Claude Code was closed are delivered exactly once on the next start.
- Event content never includes text taken from crawled pages.
- With no cloud login, the server emits one event explaining how to log in, and does not crash.
- The poll interval is configurable and backs off on 429 or 5xx responses.
- Shell completions in
apps/cli/src/self/completion.tsinclude the new command. - The new behavior is documented in
docs/, including the allowlist and development-flag caveats.
Generated by Claude Code
Activity
fix(cli): allowlist fake key in channel e2e test #569
fix(cli): mark channel rows seen only after emit, bound interval, tig…
fix(cli): recheck active org in channel, reject out-of-range interval…
fix(cli): restore MCP SDK v1 dependency for the channel server #569
feat(cli): add squirrel channel to push cloud audit events into Claud…
nc9 commentedon Oct 10, 2026
Ticked criteria 3 to 9: #571 (shipped in v0.0.106) adds
squirrel channelwith tests for categories, restart catch-up (poller.test.ts), no crawled text (events.test.ts), the no-login event, interval and 429/5xx backoff (server.test.ts), completions anddocs/developers/channel.mdx. The cloud feed'safter=cursor has also landed.Left: criteria 1 and 2 are covered by a stdio e2e test against a mock feed, but not yet checked live: start Claude Code with
--dangerously-load-development-channels server:squirrelscan, run a cloud audit, and see the event arrive within 60 seconds with its meta. Resized to XS, since only that check remains.nc9 commentedon Oct 11, 2026
Checked against 0.0.108 and current main (ad95fb2): CANNOT TEST HERE for criteria 1 and 2. They need a live Claude Code session started with
--dangerously-load-development-channels server:squirrelscan, a cloud login and a real cloud audit.One thing for whoever runs the live check:
squirrel channelmoved to the v2 MCP SDK after 0.0.108 (#654). On main,apps/cli/src/channel/server.tsbuilds its ownServerwithsupportedProtocolVersions: CHANNEL_PROTOCOL_VERSIONS, which keeps only the versions before 2026-07-28 (lines 50 to 62). It also avoidsserveStdio, so the legacy-handshake requirement looks preserved. Since #654 is not in 0.0.108, the live check should run on a build that includes it, so it tests the code that will ship.nc9 commentedon Oct 13, 2026
Direction change (maintainer): the channel moves into
squirrel mcp, which becomes a stdio front end for the hosted MCP. See #737. The rules here still apply (ids and counts only, no permission relay, catch up exactly once); the event source becomes the hosted MCP's events instead of a separate poller.nc9 commentedon Oct 30, 2026
Checked against main (23a34c1, v0.0.144). Ticked what holds. Open: criteria 1 and 2 (registering in a live Claude Code session and delivery within 60 seconds) are only covered by a stdio e2e test against a mock feed, and the direction moved into
squirrel mcp(#737) whileapps/cli/src/channelstill exists on main. Needs a live check or a restated criterion.nik
nc9 commentedon Nov 13, 2026
Shipped in v0.0.106: 4892263 "add squirrel channel to push cloud audit events into Claude Code (#571)" (an ancestor of the v0.0.106 tag);
docs/cli/channel.mdxdocuments it, and the v0.0.106 CHANGELOG entry describes it.nik