[profiles] Empty mcp_servers in profile does not shadow global mcp_servers

Resolved 💬 1 comment Opened Apr 12, 2026 by sho-ikeda-ai Closed Apr 12, 2026

Summary

When a profile defines [profiles.review.mcp_servers] as an empty table in ~/.codex/config.toml, global [mcp_servers.*] entries still start up in that profile's session. The intent is to run a lightweight review session with zero MCP servers, but global servers leak through.

Steps to reproduce

  1. Global MCP servers in ~/.codex/config.toml:

\\\`toml
[mcp_servers.google_workspace]
command = "node"
args = ['workspace-server/dist/index.js']

[mcp_servers.openaiDeveloperDocs]
url = "https://developers.openai.com/mcp"
\\\`

  1. Review profile with empty mcp_servers:

\\\`toml
[profiles.review]
sandbox_mode = "read-only"
approval_policy = "never"

[profiles.review.mcp_servers]
\\\`

  1. Run: \echo "PING" | codex exec -p review --skip-git-repo-check --ephemeral -C "\$HOME" -\
  1. Expected: no MCP servers start.

Actual:
\\\
mcp: openaiDeveloperDocs starting
mcp: google_workspace starting
mcp startup: ready: openaiDeveloperDocs, google_workspace
\
\\

Also tried \-c 'mcp_servers={}'\ override — same result.

Expected behavior

\[profiles.<name>.mcp_servers]\ (even empty) should replace global \[mcp_servers]\, matching how \sandbox_mode\ and \approval_policy\ override globals.

Environment

  • Codex CLI v0.116.0, Windows 11 (Git Bash), ChatGPT OAuth auth

Workaround

None within a single config.toml. Must remove global entries or use separate config files.

Context

Discovered building Lysis, a cross-model review tool pairing Claude Code + Codex CLI. Review profile disables MCP for security isolation.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗