codex - 💡(How to fix) Fix [profiles] Empty mcp_servers in profile does not shadow global mcp_servers [1 comments, 2 participants]

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…
GitHub stats
openai/codex#17503Fetched 2026-04-12 13:27:29
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4closed ×1commented ×1cross-referenced ×1

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.

Root Cause

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.

Fix Action

Workaround

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

RAW_BUFFERClick to expand / collapse

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" -`

  2. 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.

extent analysis

TL;DR

The issue can be worked around by using a separate config file for the review profile that does not include the global MCP server entries.

Guidance

  • The likely cause is that the empty [profiles.review.mcp_servers] table is not properly overriding the global [mcp_servers] entries.
  • To verify, try removing the global MCP server entries from the config file and see if the review profile starts without any MCP servers.
  • To mitigate, consider using a separate config file for the review profile that only includes the necessary settings, without the global MCP server entries.
  • The -c 'mcp_servers={}' override attempt suggests that the issue may be related to how the config file is being parsed or merged.

Example

No code snippet is provided as it is not clearly supported by the issue.

Notes

The issue seems to be specific to the Codex CLI v0.116.0 and the way it handles config files. The workaround of using a separate config file may not be ideal, but it can help achieve the desired behavior.

Recommendation

Apply workaround: use a separate config file for the review profile that does not include the global MCP server entries. This is because the current config file parsing behavior does not seem to support overriding global entries with an empty table.

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…

FAQ

Expected behavior

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

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 [profiles] Empty mcp_servers in profile does not shadow global mcp_servers [1 comments, 2 participants]