Tokenscope MCP server
io.github.wartzar-bee/tokenscope·v0.2.3·4 starsAnalyze Claude Code session cost & context attribution: output, cached re-reads, cache writes.
4 stars29 downloads/wk
Reviews
Write oneNobody has reviewed Tokenscope yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
Tokenscope tools (3)
write = sends, deletes, buys or postsRead from the package source without running it. The installed server may list more.
analyze_claude_costAnalyze a Claude Code session's token cost and context attribution.
get_cost_benchmarkCompare a Claude Code session against tokenscope's shipped reference set of real sessions
tokenscope_share_summaryProduce a privacy-safe, shareable summary of a Claude Code session built ONLY from aggregate
Public scan report
scanner v0.1.9 · 2026-09-24 · same rubric, same numbers if you re-run it
- Code scan2 source files scanned25/25
- –Live reliabilityno gateway calls yet and no remote to proben/a
- –Tool poisoningtools not inspected (local package is not executed); not countedn/a
- Auth qualitylocal package, no credentials required12/15
- Maintenancelast push 58 days ago12/15
- Maintainer identityregistry namespace matches repository owner6/10
How Tokenscope compares
Against every graded MCP server, from our own scans and uptime checks. Updated after each scan run.
- Safety score
- 85/100
- higher than 70% of 48,255 servers
- Tools
- 3
- the typical server has 7
- Tools that change things
- 0%
- typical: 0%. Fewer write tools means less an agent can break
- GitHub stars
- 4
- more than 82% of 28,688 servers
- Downloads a week
- 29
- more than 16% of 12,191 servers with a package
What its tools let an agent do: 3 read
Install Tokenscope in Claude Code, Cursor or VS Code
Runs npx -y @wartzar-bee/tokenscope-mcp on your machine. Read the scan report first; the gateway never runs local packages.
claude mcp add tokenscope -- npx -y @wartzar-bee/tokenscope-mcp
What the publisher says
From the Tokenscope repository's README, as published. We do not edit it. Read it on GitHub
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.)
Why
Agentic coding (Claude Code, etc.) produces surprise bills, and the cause is mundane: as a session grows, the whole context is re-sent every turn, so cost balloons even when the model writes little. Existing dashboards show totals; tokenscope shows the attribution — output vs. cache-read vs. cache-write vs. fresh input, the per-turn context-growth curve, cost by model, subagent spend, and which tools fill your context — with concrete "trim this" insights.
Try it in 10 seconds (no Claude Code logs needed)
npx @wartzar-bee/tokenscope --demoRuns on a bundled sample session so you see the full report before pointing it at your own logs — no setup, nothing to configure. (The sample is synthetic, for demonstration.)
Install / run
No install — runs via npx:
npx @wartzar-bee/tokenscope # your most recent Claude Code session
npx @wartzar-bee/tokenscope --demo # a bundled sample session — no logs needed
npx @wartzar-bee/tokenscope --all # aggregate every session
npx @wartzar-bee/tokenscope <file|dir> # a specific session .jsonl
npx @wartzar-bee/tokenscope --version # print the installed version and exit
npx @wartzar-bee/tokenscope --json # machine-readable
npx @wartzar-bee/tokenscope --share # privacy-safe shareable summary (markdown + SVG card)
npx @wartzar-bee/tokenscope --share-svg # just the SVG "cost report card"
npx @wartzar-bee/tokenscope scan # static token footprint of a source dir (the engine behind ci-guardrail)
npx @wartzar-bee/tokenscope scan --diff ../base # cost delta of the current dir vs a base dir — catch a regression before you push
npx @wartzar-bee/tokenscope scan --max-total 50000 # exit 1 if the footprint exceeds a budget — a local cost gate
npx @wartzar-bee/tokenscope scan --diff ../base --max-delta 2000 # exit 1 if the diff adds more than N tokensReads ~/.claude/projects//.jsonl. Read-only, local, no network, no telemetry — open the source; nothing leaves your machine.
Local cost gate (pre-push / pre-commit)
--max-total N / --max-delta N make scan exit 1 when the token footprint (or a diff's delta) blows a budget — the same check ci-guardrail runs in CI, but locally, before you push. Wire the absolute budget into a git hook so a runaway prompt/config never leaves your machine:
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
Tokenscope: common questions
- Is Tokenscope MCP server safe?
- Yes, by our scan: it is graded A (85/100). Read the Tokenscope safety report
- How do I install Tokenscope?
- It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
- Does Tokenscope need an API key?
- Not as far as the registry entry and our scan can tell: no credentials are declared or required.
- Is Tokenscope maintained?
- The last commit was 99 days ago (2026-07-28). The latest release is v0.2.3.
- How does Tokenscope compare with other MCP servers?
- safety score 85/100 (higher than 70% of 48,255 servers); tools 3 (the typical server has 7); tools that change things 0% (typical: 0%. Fewer write tools means less an agent can break). Full comparison.