# metrxbots/mcp-server [Health: Active]

**Category:** 📊 Monitoring  
**Repository:** https://github.com/metrxbots/mcp-server  
**GitHub Stars:** 2  
**npm Downloads (last month):** 227  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/metrxbots-mcp-server

## Description
AI agent cost intelligence — track spend across providers, optimize model selection, manage budgets with enforcement, detect cost leaks, and prove ROI. 23 tools across 10 domains.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "mcp-server": {
    "command": "npx",
    "args": ["-y","@metrxbot/mcp-server"],
    "env": {
      "METRX_API_KEY": "",
      "METRX_API_URL": ""
    }
  }
}
```

**Requires environment variables:** `METRX_API_KEY`, `METRX_API_URL` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What metrxbots/mcp-server MCP server does

The metrxbots/mcp-server MCP server connects an MCP-compatible agent to Metrx, an AI agent cost intelligence platform. Its tool set covers operational cost analysis rather than general-purpose model execution. Agents can inspect spend, call volume, error rates, model usage, agent health, budgets, alerts, and optimization opportunities.

The server also supports actions and analysis beyond reporting. It can apply an optimization recommendation, create or stop a model-routing experiment, change budget enforcement, acknowledge alerts, attribute agent work to business outcomes, and generate ROI-oriented reports. A separate cost leak detector package is included in the repository, but it is an offline CLI rather than part of this server's MCP tool set.

## How it works

The metrxbots/mcp-server MCP server communicates with the Metrx API when connected to real account data. The API key can come from the `METRX_API_KEY` environment variable or from `~/.metrxrc`, which is created by the interactive authentication flow. `METRX_API_URL` can override the default API base URL of `https://metrxbot.com/api/v1`.

For evaluation, `npx @metrxbot/mcp-server --demo` starts the server with sample data and does not require signup or an API key. The normal client configuration starts the package over stdio. A remote option is also documented at `https://metrxbot.com/api/mcp`, where requests use a bearer token and JSON content type.

## Setup and configuration

Install and run the package with:

```bash
npx -y @metrxbot/mcp-server
```

To authenticate interactively, run `npx @metrxbot/mcp-server --auth`. The process opens a browser, obtains and validates an API key, then stores it in `~/.metrxrc`. Alternatively, set `METRX_API_KEY` in the environment. The README identifies the key as free to obtain through the Metrx sign-up page.

An MCP client can use this stdio configuration:

```json
{
  "mcpServers": {
    "metrx": {
      "command": "npx",
      "args": ["@metrxbot/mcp-server"]
    }
  }
}
```

If the key is not stored in `~/.metrxrc`, add `METRX_API_KEY` under the client's `env` object. Claude Desktop, Cursor, and Windsurf are named as supported client examples.

## Tools and capabilities

The 23 tools are organized into ten functional areas:

- Dashboard tools summarize costs and list or inspect agents.
- Optimization tools recommend changes, apply recommendations, route tasks to models, and compare provider pricing and capabilities.
- Budget tools report status, create or update limits, and change enforcement modes including hard, soft, monitor, paused, and resumed states.
- Alert tools retrieve and acknowledge alerts and provide failure predictions.
- Experiment tools run traffic-split model comparisons, report results, and stop experiments.
- Cost leak scanning audits for waste patterns across an agent fleet.
- Attribution tools connect agent actions with outcomes and calculate task or fleet ROI.
- Alert configuration sets cost or operational thresholds with email, webhook, or auto-pause behavior.
- ROI audit produces a report intended for review of agent-fleet returns.
- Upgrade justification evaluates tier upgrades using current usage patterns.

Prompt templates named `analyze-costs`, `find-savings`, and `cost-leak-scan` provide predefined workflows for common investigations.

## Limitations and notes

Real-data operation depends on access to the Metrx API and normally requires an API key, although the server can use a locally saved key instead of an environment variable. Demo mode uses sample data and therefore is not a substitute for checking an actual account. The README documents an HTTP endpoint for remote agents, but does not describe deployment or hosting steps for running a private copy of that endpoint.

The repository is licensed under MIT. The companion cost leak detector is separate from the MCP server: it scans local LLM API logs offline and should not be represented as one of the server's 23 MCP tools.

_Full upstream README: https://allmcps.com/mcp/metrxbots-mcp-server/readme_

