codex - 💡(How to fix) Fix Expose server-level MCP approval defaults in codex mcp add

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

mcp_servers.<id>.default_tools_approval_mode is supported in config, but codex mcp add cannot set it. That leaves scripted/noninteractive setups hand-editing TOML, and JSON readbacks do not expose the server-level default.

Root Cause

Note: just fmt completed the Rust formatting phase, then failed in the Python SDK ruff phase because openai-codex-cli-bin==0.132.0 has no Linux glibc wheel for this platform. No SDK files were changed.

Fix Action

Fix / Workaround

Ready patch

I tried to open this as a pull request, but GitHub shows: "An owner of this repository has limited the ability to open a pull request to users that are collaborators on this repository." Filing this issue so the tested patch is visible and easy to cherry-pick or recreate.

Code Example

codex mcp add <name> --default-tools-approval-mode <auto|prompt|approve> -- <command> [args...]

---

PATH=/home/rage/.cargo/bin:$PATH just test -p codex-cli --test mcp_add_remove
PATH=/home/rage/.cargo/bin:$PATH just fix -p codex-cli
git diff --check
PATH=/home/rage/.cargo/bin:$PATH cargo fmt --check -- --config imports_granularity=Item
RAW_BUFFERClick to expand / collapse

Summary

mcp_servers.<id>.default_tools_approval_mode is supported in config, but codex mcp add cannot set it. That leaves scripted/noninteractive setups hand-editing TOML, and JSON readbacks do not expose the server-level default.

Proposed change

Add:

codex mcp add <name> --default-tools-approval-mode <auto|prompt|approve> -- <command> [args...]

The flag would persist the existing default_tools_approval_mode field. codex mcp get --json and codex mcp list --json would include it so setup scripts can verify the result. Existing defaults and runtime approval precedence are unchanged.

Ready patch

I prepared and tested a minimal branch:

I tried to open this as a pull request, but GitHub shows: "An owner of this repository has limited the ability to open a pull request to users that are collaborators on this repository." Filing this issue so the tested patch is visible and easy to cherry-pick or recreate.

Tests run

PATH=/home/rage/.cargo/bin:$PATH just test -p codex-cli --test mcp_add_remove
PATH=/home/rage/.cargo/bin:$PATH just fix -p codex-cli
git diff --check
PATH=/home/rage/.cargo/bin:$PATH cargo fmt --check -- --config imports_granularity=Item

The targeted CLI integration test passed, including valid persistence/readback and invalid-mode rejection. cargo fmt --check exited 0, with stable rustfmt warning that imports_granularity = Item is nightly-only.

Note: just fmt completed the Rust formatting phase, then failed in the Python SDK ruff phase because openai-codex-cli-bin==0.132.0 has no Linux glibc wheel for this platform. No SDK files were changed.

Related: #24135 and #13476. This is a narrow CLI/config surface improvement, not a complete resolution of all runtime MCP approval behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Expose server-level MCP approval defaults in codex mcp add