Skip to content
Documentation hero background

OpenAI Codex CLI

To connect Flyweel MCP to OpenAI Codex CLI, add a [mcp_servers.flyweel] block to ~/.codex/config.toml using the mcp-remote shim. Codex currently supports stdio transport natively; the shim bridges Flyweel’s remote HTTP server to stdio.


Step 1: Get your API token

  1. Go to app.flyweel.co
  2. Click Settings, then API Tokens
  3. Click Create New Token, name it “Codex CLI”
  4. Click Generate and copy the fwl_… token

Step 2: Install mcp-remote (optional)

Terminal window
npm install -g mcp-remote

Or skip the install and let npx fetch it on first run (the config below uses npx -y).


Step 3: Edit ~/.codex/config.toml

If the file does not exist yet, create it: mkdir -p ~/.codex && touch ~/.codex/config.toml.

Add this block:

[mcp_servers.flyweel]
command = "npx"
args = [
"-y",
"mcp-remote",
"https://api.flyweel.co/mcp-server/mcp",
"--header",
"X-API-Key: fwl_YOUR_TOKEN_HERE",
]

Replace fwl_YOUR_TOKEN_HERE with your real token.

Optional: per-tool approvals

[mcp_servers.flyweel.tools.trigger_sync]
approval_mode = "approve"

Flyweel’s read-only tools (query_metrics, list_ad_accounts, get_setup_status) are safe to auto-approve. Tools that change state (trigger_sync, select_ad_accounts, connect_ad_platform) benefit from an approval prompt.


Step 4: Restart Codex

Terminal window
codex

Codex reads config.toml on startup. The flyweel server appears in the /mcp listing.


Step 5: Test it

In your Codex session, ask:

What Google Ads accounts do I have connected to Flyweel?

If you see your accounts, the connection is working.


Troubleshooting

”Failed to start mcp-remote”

npx cannot find or download mcp-remote.

Fix: Run npm install -g mcp-remote, then change command in config.toml to mcp-remote and drop the -y, mcp-remote args.

”Authentication error”

Token is invalid, revoked, or malformed.

Fix: Regenerate at app.flyweel.co, then Settings, then API Tokens.

Codex does not list the server

Config file is in the wrong location, or the TOML is malformed.

Fix: Run cat ~/.codex/config.toml to verify the path and syntax. TOML keys are case-sensitive.


Next Steps

Ready to get started?

Start optimizing your ad spend today with Flyweel.