Add the server
Codex uses TOML rather than JSON, so the entry looks different from Cursor and Windsurf even though it means the same thing.
[mcp_servers.mcp-ads]
url = "https://mcp-ads.com/mcp-slim"MCP client support differs between Codex versions and moves quickly. If the key name is rejected, check the config format for the version you are running rather than assuming the URL is wrong.
Troubleshooting
- The server is not listed in a new session: the file is not at ~/.codex/config.toml, or the table header is wrong. It must be [mcp_servers.mcp-ads] with an underscore in mcp_servers; a hyphen there is the most common typo and TOML accepts it silently as a different key.
- The OAuth window does not open: on a remote or headless machine there is no browser to open. Copy the URL Codex prints, open it on any machine, and approve; the token is delivered to the session that requested it.
- "A server with this URL already exists": the URL is defined under two table names, usually after renaming an entry without removing the old one. Keep one table and restart.
- The key name is rejected: MCP support differs between Codex versions. Run codex --version and check the config reference for that version; older builds used a different key for remote servers and some accept only local commands.