wartzar-bee avatar

Tokenscope

wartzar-bee/tokenscope

Exposes three MCP tools that parse your local Claude Code session logs to show token cost attribution. The analyze_claude_cost tool breaks down spend by output versus context re-sent every turn (typically 60%+ of bills), traces context growth across the session, and flags which models or tools are expensive. get_cost_benchmark compares your session against an offline reference dataset. tokenscope_share_summary generates privacy-safe markdown and SVG reports with no file paths or prompt content. Reads from ~/.claude/projects/**/*.jsonl, strictly local and read-only. Useful when an AI bill surprises you and you want the agent itself to explain where the money went, or when you're optimizing long-running sessions and need per-turn context metrics without leaving the chat.

GitHub stars
4
tools
3
transport
STDIO
last updated
Jul 25, 2026

Tools

3 tools

Public tool metadata for what this MCP can expose to an agent.

analyze_claude_costAnalyze a Claude Code session for cost and context attribution.

Analyze a Claude Code session for cost and context attribution.

No parameter schema in public metadata yet.

get_cost_benchmarkCompare a session's cache efficiency against the offline reference set of real sessions.

Compare a session's cache efficiency against the offline reference set of real sessions.

No parameter schema in public metadata yet.

tokenscope_share_summaryProduce a privacy-safe shareable summary of a session's cost breakdown.

Produce a privacy-safe shareable summary of a session's cost breakdown.

No parameter schema in public metadata yet.

Sponsors

Readme

tokenscope ⏣

See what your AI-coding session actually cost — and what's eating your context. A local, read-only CLI that parses your Claude Code session logs and shows where the money goes: model output vs. context being re-sent every turn (the hidden 60%+ of most bills).

$ npx @wartzar-bee/tokenscope

  tokenscope ⏣  latest session
  ──────────────────────────────────────────────────────
  Total cost   $868.84   over 967 model turns

  Where the money went
  output (model writing)     ████░░░░░░░░░░░░░░░░░░░░  16%  $137.24
  cache read (re-sent ctx)   ████████████████░░░░░░░░  66%  $577.59
  cache write (new ctx)      ████░░░░░░░░░░░░░░░░░░░░  18%  $153.67

  Context size per turn  (peak 822k · avg 404k · now 822k tokens)
  ▁▁▁▁▁▂▂▂▂▂▂▂▃▃▃▃▃▃▃▄▄▄▄▄▅▅▅▅▅▆▆▆▆▇▇▇▇▇▇█

  Insights
  • Re-sent (cached) context cost $577.59 (66% of spend) — context re-read every turn.
  • Peak context ~822k tokens — /compact or a fresh session would cut per-turn cost.
  • Only 16% of spend is the model's actual output.

(A real session, default Opus pricing. Your numbers will differ — prices are overridable.)


View the full README on GitHub

Details

Repository
github.com/wartzar-bee/tokenscope
Website
github.com/wartzar-bee/tokenscope#readme
Package
@wartzar-bee/tokenscope-mcp
Transport
STDIO
Registry
MCP registry, active