MCP Hub
Back to servers

mcp-server

Track AI agent costs, detect waste, optimize models, and prove ROI. 23 MCP tools.

Registrynpm29/wk
Updated
Mar 5, 2026

Quick Install

npx -y @metrxbot/mcp-server

Metrx MCP Server

npm version CI License: MIT Smithery

Your AI agents are wasting money. Metrx finds out how much, and fixes it.

The official MCP server for Metrx — the AI Agent Cost Intelligence Platform. Give any MCP-compatible agent (Claude, GPT, Gemini, Cursor, Windsurf) the ability to track its own costs, detect waste, optimize model selection, and prove ROI.

Why Metrx?

ProblemWhat Metrx Does
No visibility into agent spendReal-time cost dashboards per agent, model, and provider
Overpaying for LLM callsProvider arbitrage finds cheaper models for the same task
Runaway costsBudget enforcement with auto-pause when limits are hit
Wasted tokensCost leak scanner detects retry storms, context bloat, model mismatch
Can't prove AI ROIRevenue attribution links agent actions to business outcomes

Quick Start

One-command install (Claude Desktop, Cursor, Windsurf)

{
  "mcpServers": {
    "metrx": {
      "command": "npx",
      "args": ["@metrxbot/mcp-server"],
      "env": {
        "METRX_API_KEY": "sk_live_your_key_here"
      }
    }
  }
}

Get your free API key at metrxbot.com/settings/security.

Remote HTTP endpoint

For remote agents (no local install needed):

POST https://metrxbot.com/api/mcp
Authorization: Bearer sk_live_your_key_here
Content-Type: application/json

From npm

npm install @metrxbot/mcp-server

23 Tools Across 10 Domains

Dashboard (2 tools)

ToolDescription
metrx_get_cost_summaryTotal spend, call counts, error rates, agent breakdown, and optimization opportunities
metrx_list_agentsAll agents with status, category, cost metrics, and health indicators

Optimization (4 tools)

ToolDescription
metrx_get_provider_arbitrageCompare costs across providers — find cheaper alternatives
metrx_get_revenue_intelligenceRevenue per agent with confidence scores and ROI metrics
metrx_get_token_guardrailsToken limit recommendations and overflow detection
metrx_get_model_recommendationsModel switching recommendations based on cost, latency, quality

Budgets (4 tools)

ToolDescription
metrx_create_budgetCreate monthly/daily budgets with hard, soft, or monitor enforcement
metrx_update_budgetUpdate limits, frequency, or enforcement mode
metrx_list_budgetsAll budgets with current spend vs. limits
metrx_delete_budgetRemove a budget (historical data preserved)

Alerts (3 tools)

ToolDescription
metrx_create_alert_policyAlert on cost overages, error rates, latency spikes, anomalies
metrx_update_alert_policyUpdate thresholds, channels, enable/disable
metrx_list_alertsActive alerts and current status per agent

Experiments (2 tools)

ToolDescription
metrx_start_experimentA/B test comparing two LLM models with traffic splitting
metrx_get_experiment_resultsStatistical significance, cost delta, and recommended action

Cost Leak Detector (2 tools)

ToolDescription
metrx_scan_cost_leaksFind cost anomalies and waste across your fleet
metrx_analyze_cost_leakDeep-dive into a specific anomaly with timeline and root cause

Attribution (2 tools)

ToolDescription
metrx_attribute_taskLink agent actions to business outcomes for ROI tracking
metrx_get_attribution_reportMulti-source attribution report with confidence scores

ROI & Reporting (2 tools)

ToolDescription
metrx_get_upgrade_justificationROI report for tier upgrades based on usage patterns
metrx_generate_roi_auditBoard-ready ROI audit report

Alert Configuration (2 tools)

ToolDescription
metrx_configure_alert_thresholdSet cost/operational thresholds with email, webhook, or auto-pause
metrx_get_failure_predictionsPredictive analysis — identify agents likely to fail before it happens

Prompts

Pre-built prompt templates for common workflows:

PromptDescription
analyze-costsComprehensive cost overview — spend breakdown, top agents, optimization opportunities
find-savingsDiscover optimization opportunities — model downgrades, caching, routing
cost-leak-scanScan for waste patterns — retry storms, oversized contexts, model mismatch

Examples

"How much am I spending?"

User: What was my AI cost this week?
→ metrx_get_cost_summary(period_days=7)

Total Spend: $234.56 | Calls: 2,450 | Error Rate: 0.2%
├── customer-support: $156.23 (1,800 calls)
└── code-generator: $78.33 (650 calls)

💡 Switch customer-support from GPT-4 to Claude Sonnet: Save $42/week

"Find me savings"

User: Am I overpaying for my agents?
→ metrx_get_provider_arbitrage(agent_id="agent_123")

Current: GPT-4 @ $15.20/1K calls
Alternative: Gemini 1.5 @ $6.80/1K calls (-55%)
Estimated Savings: $420/month

"Test a cheaper model"

User: Test Claude 3.5 Sonnet against my GPT-4 setup
→ metrx_start_experiment(name="Claude Trial", agent_id="agent_123",
    model_a="gpt-4", model_b="claude-3-5-sonnet", traffic_split=10)

Experiment started: 90% GPT-4, 10% Claude 3.5 Sonnet
Check back in 14 days for statistical significance.

Configuration

VariableRequiredDescription
METRX_API_KEYYesYour Metrx API key (get one free)
METRX_API_URLNoOverride API base URL (default: https://metrxbot.com/api/v1)

Rate Limiting

60 requests per minute per tool. For higher limits, contact support@metrxbot.com.

Development

git clone https://github.com/metrxbots/mcp-server.git
cd mcp-server
npm install
npm run typecheck
npm test

Contributing

See CONTRIBUTING.md for guidelines.

Links

License

MIT — see LICENSE.

Reviews

No reviews yet

Sign in to write a review