Skip to content

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

Closed as duplicate

Description

@sho-ikeda-ai

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

Activity

  1. added
    bug
    CLI
    config
    mcp
    on Apr 12, 2026
  2. github-actions commented on Apr 12, 2026

    @github-actions
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugconfigmcp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions