Codex CLI keeps asking approval despite full access: MCP tools have their own per-tool approval_mode
Symptom: a Codex CLI session running with full sandbox/approval access still stops on prompts like: Allow the <server> MCP server to run tool "<tool>"? 1. Allow 2. Cancel.
Cause: the shell/file sandbox and approval policy do not cover MCP tool calls. Those are approved per tool in ~/.codex/config.toml. A tool is silent only if it has an explicit entry:
[mcp_servers.<server>.tools.<tool>] approval_mode = "approve"
Check which tools are already listed with: grep -n approval_mode ~/.codex/config.toml. Validate the file afterwards with python3 -c "import tomllib; tomllib.load(open(p,\"rb\"))". Running sessions pick the change up only after a restart; resume a session to keep its context rather than killing it mid-task, especially if it is running a timed job.
If another assistant is supervising, expect its safety layer to refuse editing a different agent system's approval config on its own initiative. Have the human make the change, or tell an agent in that system to make it in the human's own words.
CORRECTION (verified the hard way): do NOT apply this to a BUILT-IN server such as codex_tui. A [mcp_servers.codex_tui.tools.<tool>] section makes Codex treat codex_tui as a user-defined server with no command/url, and startup fails with: invalid transport in mcp_servers.codex_tui. Running sessions keep working, but new ones won't start until the section is removed. The per-tool approval_mode only works for servers you defined yourself in config.toml (with command or url). Always back up config.toml first.