Skip to content
Documentation hero background

OpenAI Codex CLI

To connect Flyweel MCP to OpenAI Codex CLI, add a [mcp_servers.flyweel-mcp-server] 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 tokenLink to this section

  1. Go to app.flyweel.co
  2. Open Settings → API & MCP
  3. Under Advanced: use an API key instead, click Generate API key (or Create Token to name your own)
  4. Copy the fwl_… key once — it won’t be shown again

Step 2: Install mcp-remote (optional)Link to this section

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.tomlLink to this section

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

Add this block:

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

Replace fwl_YOUR_TOKEN_HERE with your real token.

Optional: per-tool approvalsLink to this section

[mcp_servers.flyweel-mcp-server.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 CodexLink to this section

Terminal window
codex

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


Step 5: Test itLink to this section

In your Codex session, ask:

What Google Ads accounts do I have connected to Flyweel?

If you see your accounts, the connection is working.


TroubleshootingLink to this section

”Failed to start mcp-remote”Link to this section

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”Link to this section

Token is invalid, revoked, or malformed.

Fix: Regenerate at app.flyweel.co, then Settings → API & MCP.

Codex does not list the serverLink to this section

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 StepsLink to this section

Ready to get started?

Start optimizing your ad spend today with Flyweel.