Parses Claude Code's local JSONL session logs to calculate token usage and estimated costs. Uses the same LiteLLM pricing source as ccusage but runs as a lightweight MCP server with no external dependencies beyond the MCP SDK.
Source: apps/mcp-servers/cc-usage/
Daily or monthly usage breakdown with per-model cost estimates.
| Parameter | Required | Description |
|---|---|---|
period |
No | daily (default) or monthly |
days |
No | Number of days to look back (default: 30) |
Returns: table of usage per period with input/output tokens and cost, broken down by model.
Aggregate spend across all time or a specific window.
| Parameter | Required | Description |
|---|---|---|
days |
No | Number of days to look back (omit for all time) |
Returns: total cost, token counts, and per-model cost breakdown.
*.jsonl files under ~/.claude/projects/message.usage records (input, output, cache
creation, cache read tokens)Pricing is fetched once per server lifetime and cached in memory.
cd apps/mcp-servers/cc-usage
npm install
npm run build
Add to .mcp.json under mcpServers:
{
"cc-usage": {
"command": "node",
"args": ["<absolute-path-to-repo>/apps/mcp-servers/cc-usage/build/index.js"]
}
}
No environment variables required.
@modelcontextprotocol/sdk v1.27.1zod for parameter validation