MCP server for tracking AI agent costs in real time. Per-message spending, budget alerts, visual dashboard. Works with Claude Code, Cursor, Windsurf, Codex, Gemini CLI, OpenClaw. Stop overspending on AI APIs.MCP server that tracks AI agent spending in real time. Visual dashboard, budget alerts, 15+ models. Works with Claude Code, Cursor, Windsurf.
# agent-cost-mcp
MCP server that tracks AI agent token usage and spending in real time. Budget alerts, per-task cost breakdown, visual dashboard, daily/weekly/monthly reports.
Works with any MCP client: **Claude Code, Cursor, Windsurf, Codex, Cursor CLI**, and more.
[](LICENSE)
[](https://python.org)
[](https://modelcontextprotocol.io)


## Why?
Every developer using AI agents worries about spending. Most tools don't tell you what each message costs until the bill arrives.
This MCP server tracks it in real time — per message, per model, per day. Set a budget, get alerts, see exactly where your money goes.
## Features
- **Visual dashboard** — dark-themed web UI with spending charts, budget gauges, and activity log
- **Per-message cost logging** — see what each AI interaction costs instantly
- **Budget alerts** — warns when approaching daily/monthly limits
- **Cost reports** — today, this week, this month, all time
- **Model breakdown** — donut chart showing which model eats your budget
- **Spending trends** — 14-day bar chart with color-coded spending
- **15+ models supported** — Cursor, GPT, Cursor, Cursor, Llama
- **Estimate before running** — check cost before expensive tasks
- **Local storage** — all data stays on your machine (`~/.agent-cost-mcp/`)
- **Auto-refresh** — dashboard updates every 30 seconds
## Quick Start
### 1. Install
```bash
pip install agent-cost-mcp
```
Or with uv:
```bash
uv pip install agent-cost-mcp
```
### 2. Add to your AI tool
**Claude Code** — add to `~/.cursor/settings.json`:
```json
{
"mcpServers": {
"agent-cost": {
"command": "agent-cost-mcp"
}
}
}
```
**Cursor** — add to `.cursor/mcp.json`:
```json
{
"mcpServers": {
"agenAgent that generates comprehensive documentation, API references, architecture diagrams, and developer onboarding guides from existing code.
Agent configuration for systematic bug investigation that traces issues from error logs through the codebase to root cause with suggested fixes.
Agent for integrating third-party APIs including SDK setup, type generation, error handling, retry logic, and rate limit management.
Cursor's built-in autonomous coding agent that can make multi-file edits, run terminal commands, search the codebase, and iteratively build features with minimal human intervention.
Cloud-based autonomous coding agent that runs in the background on remote sandboxed environments, handling complex multi-step tasks while you continue working.
Cursor's multi-file editing agent within Composer mode that can create, edit, and delete files across your entire project in a single conversation.