Codex
Connect OpenAI Codex to the hosted Costfluent MCP server with codex mcp add and sign in with codex mcp login or pass an API token, or run the server on your machine with costfluent mcp install.
Codex connects to the hosted Costfluent MCP server at https://mcp.costfluent.com from a table in its config.toml, and you sign in or pass an API token. The Codex CLI, its IDE extension and the ChatGPT desktop app share that file. To run the server on your machine instead, costfluent mcp install adds a table that starts it and passes COSTFLUENT_API_TOKEN from Codex's environment to the server rather than holding the token.
Before you start
- To sign in, a Costfluent account in the organization Codex should read. To pass a token, or to run the server on your machine, an API token from the Read only preset; see Create a token.
- To run the server on your machine,
costfluent-mcpand the command line,costfluent, on yourPATH; both come in the same release archive.
Connect and sign in
- Run
codex mcp add costfluent --url https://mcp.costfluent.com. It adds the server's table to~/.codex/config.toml. - Run
codex mcp login costfluent. Costfluent opens in your browser: sign in, choose the organization Codex may read and select Allow. In a terminal without a browser, run it with--no-browser. - Ask Codex a question, such as "What did we spend on AWS last month, by service?".
Connect with an API token
For the write tools, pass a token instead of signing in. Write the table into ~/.codex/config.toml with bearer_token_env_var, which names the variable Codex sends as the bearer token, so the file holds no token:
Code
Start Codex from a shell where COSTFLUENT_API_TOKEN is set, and ask it a question.
Run it on your machine
- Run
costfluent mcp install --client codex --write. It adds the server to~/.codex/config.toml; with--projectit writes.codex/config.tomlin the current directory instead. - Set
COSTFLUENT_API_TOKENto the token in your shell, and start Codex from that shell. - Ask Codex a question, such as "What did we spend on AWS last month, by service?".
How it behaves
- Signed in, Codex gets the read tools alone, and never more than you may read yourself in that organization. It is listed under Settings, Connected apps in Costfluent, where Revoke disconnects it.
costfluent mcp installkeeps every other table inconfig.toml, and refuses a file that already defines acostfluentserver unless--forcereplaces it.
Related
- MCP server: the token, the tools and how the server behaves
- Command line: every client
costfluent mcp installwrites for - costfluent/agent-skills: the cost skills for Codex
- Ask good questions and Troubleshooting: asking for the right figures, and what each error means