NEW! |One API call, clean data back. No scrapers needed.Get 10,000 Free Tokens →

Connect OpenAI Codex CLI to FineProxy MCP

Add the FineProxy MCP server to the OpenAI Codex CLI with codex mcp add or config.toml, sending the API key from an environment variable as a bearer token.

This page shows how to connect the OpenAI Codex CLI to the FineProxy MCP server. Codex connects directly over Streamable HTTP and sends your API key as a bearer token that it reads from an environment variable.

Requirements

  • Codex CLI with MCP support, codex on your PATH.
  • A FineProxy API key (starts with fb_). Create one in Settings → API keys. Start with read-only scopes.

Set up

Where the config lives

ScopePath
User~/.codex/config.toml
Project.codex/config.toml (only in trusted projects)

~ is your home folder.

Option 1: add the server with the CLI

  1. Put your key in an environment variable:

    export FINEPROXY_API_KEY="fb_your_api_key"
  2. Add the server:

    codex mcp add fineproxy --url https://fineproxy.org/account_new/api/v1/mcp \
      --bearer-token-env-var FINEPROXY_API_KEY

Option 2: edit config.toml

Add this table to ~/.codex/config.toml:

[mcp_servers.fineproxy]
url = "https://fineproxy.org/account_new/api/v1/mcp"
bearer_token_env_var = "FINEPROXY_API_KEY"

Codex reads the variable when it starts and sends Authorization: Bearer <value> with every request.

Keep your key out of the config

  • bearer_token_env_var stores only the name of the variable. The key itself stays in your environment, so config.toml holds no secret.
  • env_http_headers maps header names to environment variable names in the same way, for servers that need other headers. For FineProxy, bearer_token_env_var is all you need.
  • Avoid http_headers with a literal key: it writes the secret into config.toml.

Warning: A project-level .codex/config.toml is easy to commit. Keep only variable names in it, never a literal fb_... key.

Verify the connection

Check that the server is configured:

codex mcp list
codex mcp get fineproxy --json

Then start codex, type /mcp to see the active servers and their tools, and ask:

What is my FineProxy balance?

Codex calls the wallet_balance tool and answers with your balance, for example "balance_cents": 5000 — money values are integer cents, so that is $50.00.

Tips

  • Approve tool calls. Review each FineProxy tool call before Codex runs it, especially order, renewal and cancellation tools, and don’t switch to an approval mode that runs money-moving tools unattended.
  • Use a read-only key first. For exploring, a key with customer:read, wallet:read, services:read and catalog:read is enough. Without wallet:spend, the agent can’t run tools that debit your wallet.
  • Add wallet:spend only for purchases. Create a separate key with wallet:spend when you want Codex to buy or renew. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice.
  • Some tools take a while to answer (list_countries can take about 10 seconds). If a call times out, raise tool_timeout_sec for the server (the default is 60 seconds).
  • Read MCP safety and the scopes reference before you give an agent spending rights.

Troubleshooting

SymptomCause and fix
401FINEPROXY_API_KEY isn’t set in the shell that starts codex. Export it there and restart Codex.
Codex asks you to sign in with OAuthThe bearer token isn’t configured. codex mcp login is for OAuth servers; FineProxy MCP accepts API keys only — use bearer_token_env_var.
The project config is ignored.codex/config.toml is read only in trusted projects. Trust the project or use ~/.codex/config.toml.
429 Too Many RequestsToo many sessions connecting at once. Wait a moment and start Codex again.

For server-side errors and tool failures, see MCP troubleshooting.