Skip to content

components C7: .mcp.json server approval gate - #299

Merged
ericleepi314 merged 1 commit into
mainfrom
components/c7-mcp-approvals
Jun 11, 2026
Merged

components C7: .mcp.json server approval gate#299
ericleepi314 merged 1 commit into
mainfrom
components/c7-mcp-approvals

Conversation

@ericleepi314

Copy link
Copy Markdown
Collaborator

Summary

  • Ports the TS .mcp.json approval feature (MCPServerApprovalDialog.tsx + getProjectMcpServerStatus, utils.ts:351-390): repo-declared MCP servers (scopes project+local) are untrusted until the user approves, with status precedence disabled→rejected, enabled→approved, enableAll→approved, else pending; decisions persist to .clawcodex/settings.local.json.
  • Enforcement at both choke points in services/mcp/config: get_all_mcp_configs filters .mcp.json scopes pre-merge (fixes a critic-reproduced bug where an unapproved repo server name-colliding with a user-scope server knocked both out), and get_mcp_config_by_name gates per-name resolves (reconnect/OAuth path). Pending → warning notice via the ValidationError channel (/doctor); rejected → silent drop.
  • TUI: McpApprovalScreen chained at boot per pending server (enable / enable all / disable; Esc = decide later, re-asked next launch); enable_all short-circuits the queue; settings-write failures report honestly and keep servers pending.
  • Settings read is merged user→local per TS semantics (lists unioned, scalars last-win); the project tier is deliberately excluded so a repo cannot self-approve via committed settings — documented safer-than-TS deviation.
  • Elicitation declared GATED (MCP client has no server→client request support); gap doc T12 corrected, plan §7 updated.

Test plan

  • 20 new tests: status precedence + persistence round-trips, normalization identity, pending enumeration, pre-merge enforcement end-to-end through the real get_all_mcp_configs, cross-scope shadowing regression, by-name gate, user-tier enableAll, non-list value guards, screen pilot (all four outcomes via real key presses), boot-chain behaviors incl. write-failure honesty
  • TUI + services + MCP suites: 893 passed (2 pre-existing PATH-dependent failures, stash-verified on base)
  • Full suite BASELINE-IDENTICAL vs the 12 known pre-existing failures
  • Critic loop: REQUEST CHANGES (3 MAJOR / 5 MINOR / 2 NIT) → all fixed → APPROVE

🤖 Generated with Claude Code

…alog)

Repo-declared MCP servers (.mcp.json, scopes project+local) are now
untrusted until the user approves them, porting TS
getProjectMcpServerStatus (utils.ts:351-390) + MCPServerApprovalDialog:

- services/mcp_approval.py: status precedence disabled->rejected,
  enabled->approved, enableAll->approved, else pending; merged
  user->local settings read (lists unioned, scalars last-win; project
  tier deliberately excluded so a repo cannot self-approve - documented
  safer-than-TS deviation); choices persist to
  .clawcodex/settings.local.json.
- Enforcement at both choke points: get_all_mcp_configs filters
  .mcp.json scopes PRE-merge (a name-colliding unapproved repo server
  can no longer shadow-then-drop a user-scope server - critic-reproduced
  bug), and get_mcp_config_by_name gates per-name resolves
  (reconnect/OAuth side door). Pending servers warn via the existing
  ValidationError channel; rejected servers drop silently.
- TUI: McpApprovalScreen (enable / enable all / disable; Esc = decide
  later) chained at boot per pending server; enable_all short-circuits
  the queue; write failures report honestly and keep servers pending.
- Elicitation declared GATED: the MCP client has no server->client
  request support, so ElicitationDialog parity stays parked with the
  client work (gap doc T12 corrected).

20 new tests incl. cross-scope shadowing regression and screen pilot
coverage; full suite baseline-identical.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ericleepi314
ericleepi314 merged commit a2a4863 into main Jun 11, 2026
singlaamitesh pushed a commit to singlaamitesh/clawcodex that referenced this pull request Jul 7, 2026
…-mcp-approvals

components C7: .mcp.json server approval gate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant