Connect Codex to Traffic Creator
Codex (the CLI and the IDE extension) can read and manage your campaigns through the Traffic Creator MCP server. Both share the same settings file, ~/.codex/config.toml .
Option 1: With an API Key#
- In the dashboard, open API & MCP and create a key (choose Read only if Codex should only report). See Create, use and revoke API keys.
- Store the key in your shell as
TRAFFIC_CREATOR_API_KEY, for example in~/.zshrc:
export TRAFFIC_CREATOR_API_KEY="tgp_account_…"
- Add this to
~/.codex/config.toml:
[mcp_servers.traffic-creator]
url = "https://traffic-creator.com/mcp"
bearer_token_env_var = "TRAFFIC_CREATOR_API_KEY"
Or run the same setup as one command:
codex mcp add traffic-creator --url https://traffic-creator.com/mcp \
--bearer-token-env-var TRAFFIC_CREATOR_API_KEY
- Open a new terminal and run
codex mcp list:traffic-creatorshows asenabled, with Bearer token under Auth. To check that Codex can actually reach it, startcodexand type/mcp.
Option 2: Sign In With Your Account#
- Add the server without a key:
codex mcp add traffic-creator --url https://traffic-creator.com/mcp
Codex detects the sign-in and opens the Traffic Creator sign-in in your browser. If it doesn't, run codex mcp login traffic-creator.
- Sign in, choose Full access or Read only, and click Allow.
The app then appears under API & MCP → Connected apps, where you can disconnect it.
IDE Extension and ChatGPT Desktop App#
Both use the same ~/.codex/config.toml, so a server you added in the CLI is already there. To add it in the extension instead: open the gear menu, MCP servers → Add server, enter the name and the address with Streamable HTTP, save, restart the extension and click Authenticate. In the ChatGPT desktop app: Settings → MCP servers → Add server, same fields, save, click Restart, then Authenticate.
Apps you open from the Dock may not see variables from ~/.zshrc. If the key isn't picked up there, signing in is the simpler choice.
Try It#
Ask Codex, for example: "Show my Traffic Creator balance and my active campaigns."
By default, Codex asks for your approval before it uses a tool that changes something, such as creating or resuming a campaign. Creating and resuming spend credits, so check the cost preview first.
Remove It#
If you signed in, run codex mcp logout traffic-creator first. Then run codex mcp remove traffic-creator, and revoke the key under API & MCP → Your keys, or disconnect the app under Connected apps if you signed in.
Troubleshooting#
| Problem | What to check |
|---|---|
codex mcp list doesn't show the server | Check the [mcp_servers.traffic-creator] section in ~/.codex/config.toml. |
Environment variable TRAFFIC_CREATOR_API_KEY … is not set | Set the key in the terminal Codex runs in, then restart Codex. |
| 401 or "Unauthorized" | The key is wrong or was revoked. |
MCP tool call requires approval, but approval policy is never | You run Codex without approvals (for example codex exec). Run it interactively, or allow the tool for this server. |
API scope or server IP not permitted | The key is read only. Use a full-access key for changes. |
More: Fix problems with AI assistants and the API.