# AI Usage [Health: Active]

**Category:** 💰 Finance & Fintech  
**Repository:** https://github.com/MohitBansal321/ai-usage-mcp  
**GitHub Stars:** 1  
**npm Downloads (last month):** 1315  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/ai-usage

## Description
Reports real token usage and cost from Claude Code and OpenCode data. Nothing leaves your machine.

## Tools
Capabilities this server exposes over MCP:

- **usage_report** — Start here: verdict, where usage went, heaviest sessions, what to change
- **usage_summary** — Totals for a period, split by client, tokens + cost
- **session_usage** — One session: client, model, duration, token breakdown, cost
- **model_usage** — Per-model tokens and cost
- **client_usage** — Per-client (Claude Code, Codex CLI, OpenCode) tokens and cost
- **recent_sessions** — Recent sessions with project, client, tokens, cost
- **project_usage** — Per-project tokens and cost, by the directory a turn ran in
- **daily_usage** — Per-day tokens and cost, newest day first
- **usage_breakdown** — Two or more dimensions at once -- project × day, model × day, client × day
- **counterfactual_cost** — These tokens at another model's list rates, beside what they actually cost
- **cache_health** — One session's cache breaks: when the cached prefix was lost, why, and cost
- **plan_usage** — Pro/Max 5-hour and weekly limit usage, when each resets, and the pace

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

```json
"mcpServers": {
  "ai-usage": {
    "command": "npx",
    "args": ["-y","ai-usage-mcp"]
  }
}
```

## Documentation

## What AI Usage MCP server does

AI Usage turns local activity from Claude Code, Codex CLI, and OpenCode into queryable usage data. It reports token counts, costs, sessions, projects, models, clients, and dates, giving an MCP-compatible agent enough context to answer questions about where usage went and what to change.

The server also examines prompt-cache behavior for individual sessions. Its cache analysis identifies turns where a cached prefix was lost, shows the likely reason, and calculates the associated cost. For Claude Pro and Max users, plan tracking records five-hour and weekly limit readings, reset times, current pace, and projected usage.

## How it works

On its first run, the package imports available history into a local SQLite database. As new source data is seen, turns are copied into that database, allowing longer retention than Claude Code’s configurable transcript cleanup. The data remains on the local machine; the server does not require an account or API key and does not upload usage records.

Cost reporting keeps values supplied by a client separate from package estimates. When a source lacks a value, the result remains unavailable rather than being treated as zero. A verification command independently rereads source files and compares its findings with the database, helping detect inflated counts caused by repeated usage objects in JSONL records.

## Setup and configuration

Run the package directly with:

```bash
npx ai-usage-mcp
```

The required runtime is Node.js 22.13 or newer. Storage uses Node’s built-in `node:sqlite`; an optional `better-sqlite3` fallback can be used on older Node versions, but it is not required for the normal supported runtime.

Claude Code can add the server with `claude mcp add ai-usage -s user -- npx -y ai-usage-mcp`, or install the supplied Claude Code plugin. Codex CLI uses `codex mcp add ai-usage -- npx -y ai-usage-mcp`. OpenCode, Cursor, VS Code, Windsurf, Claude Desktop, and JetBrains are also listed as installation targets. Native Windows clients should invoke `npx` through `cmd /c`.

## Tools and capabilities

The MCP tools include:

- `usage_report` for an overall verdict, major usage areas, heavy sessions, and suggested changes.
- `usage_summary`, `daily_usage`, `project_usage`, `model_usage`, and `client_usage` for grouped totals.
- `session_usage` and `recent_sessions` for detailed or recent session views.
- `usage_breakdown` for combined dimensions such as project by day or model by day.
- `counterfactual_cost` for pricing the same tokens at another model’s listed rates.
- `cache_health` for locating and pricing lost prompt-cache prefixes.
- `plan_usage` for five-hour and weekly Pro or Max limit status, reset times, and pace.

The package also provides a command-line interface, resources, prompts, CSV and JSON export, and a status-line command for retaining plan-limit readings.

## Limitations and notes

The analysis depends on history written by the supported clients, so it is intended for local usage records rather than remote provider billing data. Plan-limit tracking relies on readings passed through Claude Code’s status-line mechanism. Historical retention depends on the server seeing source data before it is removed; imported records remain in the local database afterward.

_Full upstream README: https://allmcps.com/mcp/ai-usage/readme_

