Removing a saved Model Context Protocol (MCP) server from Codex prevents that integration from being available in later sessions, which is useful when a server is obsolete, duplicated, or no longer trusted. Because MCP servers can start local commands or connect to remote endpoints, removing unused entries reduces accidental tool exposure.
In the Codex CLI, codex mcp remove <name> deletes a named global MCP server entry from ~/.codex/config.toml, the user-level configuration shared by the CLI and the IDE extension. That is different from disabling a server in config: a disabled entry stays in the file for later reuse, while a removed entry is deleted and must be added again before Codex can use it.
Remove the server by its saved name, not by command, URL, or package name. Check the name first with codex mcp list or codex mcp get. If a server still appears after the global entry is removed, check whether the same name is defined in a trusted project's .codex/config.toml instead of the global config file.
Related: How to list Codex MCP servers
Related: How to get Codex MCP server details
$ codex mcp list Name Command Args Env Cwd Status Auth context7 npx -y @upstash/context7-mcp - - enabled Unsupported
codex mcp remove accepts the saved server name only. Removing the wrong name deletes that stored entry from the global Codex config.
$ codex mcp get context7 --json
{
"name": "context7",
"enabled": true,
"disabled_reason": null,
"transport": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp"
],
"env": null,
"env_vars": [],
"cwd": null
},
"enabled_tools": null,
"disabled_tools": null,
"startup_timeout_sec": null,
"tool_timeout_sec": null
}
Reviewing the JSON helps confirm that the saved name points to the intended launcher or endpoint before the entry is deleted.
$ codex mcp remove context7 Removed global MCP server 'context7'.
If the goal is only to stop loading the server for now, keep the entry in config.toml and set enabled = false instead of removing it.
$ codex mcp list No MCP servers configured yet. Try `codex mcp add my-tool -- my-command`.
If other servers are still configured, codex mcp list should return the remaining rows without context7. If the removed server still appears, inspect a trusted project's .codex/config.toml for another [mcp_servers.context7] entry.