Metrx — Claude Code MCP server: what it does, how to install
Metrx tracks LLM deployment spend, highlights budget drains, and routes tasks to cost-effective models.
no license 1,849 installs updated 2026-03-04
claude mcp add --transport http mcp-server https://mcp-server--metrxbot.run.toolsWhat Metrx does
The server connects agent fleets to expense tracking and governance tools. It exposes functions such as metrx_get_cost_summary to review total token spend, error rates, and outcome attribution. The audit tool metrx_run_cost_leak_scan detects idle agents, excessive context sizes, missed cache setups, and cross-provider arbitrage chances.
Spending limits support three modes: notification-only (alert_only), overridable limits (soft_block), and strict prevention (hard_block). You can also run live model A/B tests to assess latency and output quality before switching defaults. Halting an evaluation via metrx_stop_experiment is permanent, so keep tests running until results reach statistical confidence.
What it helps with
- scan agent fleets for idle runs and context bloat
- run live A/B tests between two LLMs to evaluate cost and latency
- enforce dollar spending caps with hard-block rules
- attribute agent task expenditures to measured business returns
Example prompts for the agent
- Check fleet spending with
metrx_get_cost_summaryand list the highest cost agents - Run
metrx_run_cost_leak_scanto spot missing caches and oversized context - Set an alert-only budget limit using
metrx_set_budget
How to install Metrx
Platform CLI: remote server
claude mcp add --transport http mcp-server https://mcp-server--metrxbot.run.toolsPlatform CLI: remote server
codex mcp add metrx --url https://mcp-server--metrxbot.run.toolsConfig file
{
"mcpServers": {
"metrx": {
"url": "https://mcp-server--metrxbot.run.tools"
}
}
}Config file
{
"servers": {
"metrx": {
"type": "http",
"url": "https://mcp-server--metrxbot.run.tools"
}
}
}Platform CLI: remote server
gemini mcp add -t http metrx https://mcp-server--metrxbot.run.toolsStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Metrx
How to install Metrx in Claude Code?
Run claude mcp add --transport http metrx https://mcp-server--metrxbot.run.tools in your terminal.
What does Metrx do?
It gives coding assistants access to cost auditing, model comparisons, automated budget enforcement, and ROI tracking for AI agents.
Can Metrx halt tasks when spending exceeds limits?
Yes. When you configure budgets with metrx_set_budget or metrx_update_budget_mode, setting the mode to hard_block strictly cuts off further spending.