AI Clients

Codex

OpenAI Codex reads MCP servers from a TOML config. Add MCP Ads there to use your ad accounts from the Codex CLI.

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.

~/.codex/config.toml
[mcp_servers.mcp-ads]
url = "https://mcp-ads.com/mcp-slim"
Note

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.

Authorise

The first tool call opens the browser for the OAuth authorisation, the same as every other client. Codex runs in the terminal, so it prints the authorisation URL as well as trying to open it, which is useful on a machine without a default browser.

  1. Start a new Codex session

    Codex reads config.toml at launch. Start a fresh session after saving, then ask it to list its MCP servers; mcp-ads should appear with its tools.

  2. Trigger the sign-in

    Ask for anything that needs a tool. Approve the grant in the browser and return to the terminal; Codex continues the call once the token arrives.

  3. Verify it works

    The first real tool call should return the platforms connected in your MCP Ads dashboard and the accounts on each. An empty list means the server is reachable but nothing is connected yet.

    Try this first
    Using mcp-ads, list the platforms I have connected and
    the accounts on each.

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.

Go further

Common questions

Why TOML and not JSON?

That is Codex's choice of config format. The content is the same: a named server with a URL.

What if my Codex version does not support remote MCP servers?

Then no configuration will help, because the client has to speak the protocol. Claude Code is the closest terminal-based alternative and supports remote servers today.

Can I keep the config per project instead of per user?

Codex reads the user-level file at ~/.codex/config.toml. If your version also supports a project-level config, the same table works there; the user-level one applies to every project either way.

Ready to connect?

Start free, connect the platforms you use, and run your first workflow from Claude in minutes.