Skip to content

fix: stop auto-approving user MCP server tools in headless claude runs - #200

Merged
currentbits merged 1 commit into
mainfrom
coder/security-user-registered-mcp-servers-get-2a6797
Aug 16, 2026
Merged

currentbits merged 1 commit into
mainfrom
coder/security-user-registered-mcp-servers-get-2a6797

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes #126.

getClaudeMcpArgs built --allowedTools=mcp__<name>__* from all activeServers(), which includes user-registered servers synced in from settings. In headless -p runs there is no permission prompt, so every tool a user-added (possibly remote) MCP server exposes ran unapproved — including tools added server-side after registration, since the rule covers the whole namespace.

Now only first-party servers (coder-memory, coder-threads) go into the allow rule. User servers stay in the mcp config (still reachable) but go through the normal permission path. When no first-party server is up the flag is omitted entirely rather than emitted empty.

Skipped: the per-server "auto-approve in headless" opt-in setting the issue floats — no one has asked for it; add when a user actually wants a specific server pre-approved.

Test: electron/test/skills.test.js — user server absent from the allow rule but present in the mcp config; user-servers-only → no --allowedTools at all. Full npm run test:electron (781) and npm run typecheck pass.

🤖 Generated with Claude Code

#126)

--allowedTools was built from every active server, so a user-registered
(possibly remote) MCP endpoint got mcp__<name>__* blanket approval in
headless -p runs, covering tools added server-side after registration.
Only coder-memory/coder-threads are pre-approved now; user servers stay
in the mcp config and go through the normal permission path.

Co-Authored-By: Claude Opus 5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit 9be0eb5 into main Aug 16, 2026
1 check passed
@currentbits
currentbits deleted the coder/security-user-registered-mcp-servers-get-2a6797 branch October 3, 2026 16:07
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.

Security: user-registered MCP servers get blanket tool auto-approval in headless claude runs

1 participant