Problem
Toggling an MCP server on or off currently requires manually editing ~/.codex/config.toml (or .codex/config.toml) to set enabled = true|false, or passing -c 'mcp_servers.<name>.enabled=false' on every invocation — which is verbose and has known issues (#16045).
The codex mcp subcommand already supports add and remove, but there is no middle ground: you either have a server configured or you don't. Temporarily disabling a server without losing its configuration (URL, args, env, tool approvals) should be a first-class operation.
Existing proposals and how this differs
| Issue |
Approach |
Scope |
| #11765 |
General request for enable/disable UX |
No concrete API proposed |
| #12197 |
Interactive TUI toggle inside a running session (/mcp) |
In-session only, not scriptable |
This proposal focuses on a non-interactive CLI command that works outside of a Codex session. It complements the TUI approach (#12197) rather than replacing it — both address the same need on different Codex surfaces. A CLI primitive could also serve as a foundation for IDE extensions that want to toggle MCP servers programmatically.
Proposed behavior
codex mcp enable <server> # sets enabled = true
codex mcp disable <server> # sets enabled = false
Scope flag:
--scope global # ~/.codex/config.toml (default)
--scope project # .codex/config.toml in the current project
This mirrors how config already works: project-level overrides global, closest to cwd wins.
Examples:
# Disable a noisy MCP server globally
codex mcp disable context7
# Enable an MCP server only for this project
codex mcp enable atlassian --scope project
# Re-enable globally
codex mcp enable context7
Edge cases:
- If
<server> is not defined in the target scope, the command should error with a suggestion (e.g., "server 'foo' is not configured in project scope; did you mean --scope global?").
codex mcp list could show the effective enabled state per server (already shows status, but making enabled/disabled explicit would help).
Why this matters
- Scriptable — useful in CI, dotfiles, project setup scripts,
Makefile targets
- Fast — single command vs opening TUI →
/mcp → navigate → toggle → confirm
- Consistent — follows the existing
codex mcp {add|remove|list|get} pattern
- Cross-surface — a CLI primitive that complements the TUI toggle and can be consumed by IDE extensions
Observations on feasibility
The enabled boolean field already exists in RawMcpServerConfig (see codex-rs/core/config.schema.json), and the codex mcp add command already reads/writes config.toml — so the building blocks appear to be in place. That said, the team is best positioned to decide on the right approach and scope.
Related
Problem
Toggling an MCP server on or off currently requires manually editing
~/.codex/config.toml(or.codex/config.toml) to setenabled = true|false, or passing-c 'mcp_servers.<name>.enabled=false'on every invocation — which is verbose and has known issues (#16045).The
codex mcpsubcommand already supportsaddandremove, but there is no middle ground: you either have a server configured or you don't. Temporarily disabling a server without losing its configuration (URL, args, env, tool approvals) should be a first-class operation.Existing proposals and how this differs
/mcp)This proposal focuses on a non-interactive CLI command that works outside of a Codex session. It complements the TUI approach (#12197) rather than replacing it — both address the same need on different Codex surfaces. A CLI primitive could also serve as a foundation for IDE extensions that want to toggle MCP servers programmatically.
Proposed behavior
Scope flag:
This mirrors how config already works: project-level overrides global, closest to cwd wins.
Examples:
Edge cases:
<server>is not defined in the target scope, the command should error with a suggestion (e.g., "server 'foo' is not configured in project scope; did you mean --scope global?").codex mcp listcould show the effectiveenabledstate per server (already shows status, but making enabled/disabled explicit would help).Why this matters
Makefiletargets/mcp→ navigate → toggle → confirmcodex mcp {add|remove|list|get}patternObservations on feasibility
The
enabledboolean field already exists inRawMcpServerConfig(seecodex-rs/core/config.schema.json), and thecodex mcp addcommand already reads/writesconfig.toml— so the building blocks appear to be in place. That said, the team is best positioned to decide on the right approach and scope.Related
/mcp(in-session)-cdot-notation overrides for MCP