feat(agents)!: Horton requires an explicit MCP allowlist#4363
Conversation
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
Replaces the unconditional `...mcp.tools()` spread in `createAssistantHandler` (previously at `horton.ts:396`) with an allowlist-aware expansion. `mcpAllowlist` is now a required field on the registration options at every layer customers touch: `registerHorton`, `createBuiltinAgentHandler`, `BuiltinAgentsServer`. Acceptable values: - `'*'` — every registered MCP server (the previous behavior; explicit-unsafe). - `[]` — disable MCP entirely. - `['gmail', ...]` — restrict to named servers. Forcing the choice catches the "I accidentally exposed every MCP server to LLM-driven tool calls" failure mode at compile time. Existing callers see a TS error and update one line. Desktop wiring passes `'*'` because the user already curates the MCP server list in the desktop settings UI. The env-driven entrypoint reads `ELECTRIC_AGENTS_MCP_ALLOWLIST` (`*` or comma-separated names) and defaults to `[]` for a secure-by-default deployment. BREAKING: any code calling `registerHorton`, `createBuiltinAgentHandler`, `BuiltinAgentsServer`, or `createAgentHandler` must add `mcpAllowlist` or supply it as a positional arg. Migration is one line per callsite. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
75d9c70 to
104c319
Compare
|
Closing as MCP servers are already explicitly registered and added so no reason to have a separate allowlist mechanism IMO. |
Claude Code ReviewSummaryThis PR replaces Horton's unconditional What's Working Well
Issues FoundCritical (Must Fix)Four callsites not updated — production CLI broken, e2e test crashingFiles:
All four import Smoking gun: the codecov bot on this PR reports
That is exactly the crash produced by Impact:
Suggested fix:
Important (Should Fix)Changeset is marked
|
Summary
Closes the "every MCP server's tools auto-attached to Horton" surface (
horton.ts:396— unconditional...mcp.tools()).registerHorton,createBuiltinAgentHandler, andBuiltinAgentsServernow require anmcpAllowlist: '*' | ReadonlyArray<string>:Stacked on #4354 (the characterization tests, base branch). When that lands, this auto-rebases to
main.See
plans/sandboxing-investigation.md§1.4, §1.6, §3.5.Why required (not optional with a default)
A silent default — even a safe one like `[]` — would let customers ship with the wrong toolset without realizing it. Forcing the choice catches the failure mode at compile time. One line per callsite to update.
Cross-package edit
The desktop app's `BuiltinAgentsServer` callsite (
packages/agents-desktop/src/main.ts:2105) is updated to pass `'*'`. Rationale: the user already curates the MCP server list in the desktop settings UI, so the choice of "expose them all to Horton" is explicit at the configuration layer. A per-server allowlist surfaced in the UI would be a separate change.The env-driven CLI entrypoint reads `ELECTRIC_AGENTS_MCP_ALLOWLIST` (`*` or comma-separated names) and defaults to `[]` for secure-by-default deployment — operators opt in explicitly.
Breaking
Compile-time error on every direct caller. Migration is one line per callsite:
```ts
registerHorton(registry, { ..., mcpAllowlist: '*' }) // keep old behavior
registerHorton(registry, { ..., mcpAllowlist: [] }) // disable MCP
registerHorton(registry, { ..., mcpAllowlist: ['gmail'] }) // explicit list
```
`createAgentHandler(agentServerUrl, ...)` gains `mcpAllowlist` as its second positional argument.
Test plan
🤖 Generated with Claude Code