Claude Code
Connect Claude Code to the hosted Costfluent MCP server with claude mcp add and sign in, or send an API token, or run the server on your machine with the Costfluent plugin.
Claude Code connects to the hosted Costfluent MCP server at https://mcp.costfluent.com with one command, and you sign in or send an API token. The Costfluent plugin connects the same hosted server and adds the task skills of costfluent/agent-skills. To run the server on your machine instead, costfluent mcp install adds it alone.
Before you start
- To sign in, a Costfluent account in the organization Claude Code should read. To send a token, an API token from the Read only preset, with write capabilities only if Claude Code may change objects; see Create a token.
- To run the server on your machine,
costfluent-mcpon yourPATH; see Install the server.
Connect and sign in
- Run
claude mcp add --transport http costfluent https://mcp.costfluent.com. Add--scope userto reach the server from every project, or--scope projectto share it with your team through the project's.mcp.json. - In Claude Code, run
/mcp, selectcostfluentand sign in. Costfluent opens in your browser: sign in, choose the organization Claude Code may read and select Allow. - Ask Claude Code a question, such as "What did we spend on AWS last month, by service?".
Connect with an API token
For the write tools, or where no one can sign in in a browser, send a token instead. Add the server to the project's .mcp.json with a reference to COSTFLUENT_API_TOKEN, which Claude Code reads from its environment when it starts:
Code
The single quotes keep your shell from replacing the reference with the token, so the file holds ${COSTFLUENT_API_TOKEN}, never the token. Start Claude Code from a shell where COSTFLUENT_API_TOKEN is set, and ask it a question.
Add the skills with the plugin
- In Claude Code, run
/plugin marketplace add costfluent/agent-skills. - Run
/plugin install costfluent@costfluent. The plugin connects the hosted server, which/mcplists ascostfluent; sign in there. - Restart Claude Code and ask it a question, such as "What did we spend on AWS last month, by service?".
Run it on your machine
- Install the command line, which comes in the same release archive as the server.
- In your project's directory, run
costfluent mcp install --client claude-code --write. It adds the server to.mcp.jsonthere, with a reference toCOSTFLUENT_API_TOKENrather than the token. - Start Claude Code from a shell where
COSTFLUENT_API_TOKENis set, and ask it a question.
How it behaves
- Claude Code renews the sign-in on its own until it ends, then
/mcpasks you to sign in again.claude mcp login costfluentsigns in from the shell, and Clear authentication under/mcpsigns Claude Code out. - A token Costfluent refuses in the header fails the connection; Claude Code does not fall back to signing in.
- The plugin holds no token: it connects the hosted server, and you sign in to it as above.
- Claude Code started without
COSTFLUENT_API_TOKENpasses the server the text${COSTFLUENT_API_TOKEN}rather than a token, which the server takes for no token: it then uses the sign-in ofcostfluent login, and without one it stops and says so.
Related
- MCP server: the address, the token, the tools and how the server behaves
- Command line: every client
costfluent mcp installwrites for - Ask good questions and Troubleshooting: asking for the right figures, and what each error means