mcp-claude-usage-guard
v0.2.0Detects Claude plan usage that did not come from your own Claude Code: plan meter vs local transcrip
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
detect_foreign_usage
Check whether the Claude account's plan usage is all coming from Claude Code on this machine. Compares the plan meter Claude Code caches (/usage) against this machine's transcripts over time, and checks local signals: account switches, SDK/script use of the login, remote logins, background sessions. Records a plan snapshot on each call; needs a few snapshots over hours to calibrate.
| Parameter | Type | Description |
|---|---|---|
minUnexplainedPct | number | Plan-meter points that must go unexplained before an interval is flagged (default 3) |
usage_report
Claude Code token usage on this machine, from local transcripts, grouped by session, day, project, entrypoint or model. Shows cost-weighted tokens (what plan limits track) and each session's peak context size.
| Parameter | Type | Description |
|---|---|---|
groupBy | string | |
hours | number | Look-back window in hours (default 24) |
plan_forecast
The 5-hour and 7-day plan meters, the current pace (from the plan meter across all devices, or this machine's usage once calibrated), and whether the limit will be hit before it resets.
install_hooks
Add Claude Code hooks (SessionStart and Stop in ~/.claude/settings.json) that record a plan reading automatically, so detect_foreign_usage and plan_forecast have history, and show an alarm when a new reading shows plan usage this machine does not explain. Leaves other hooks untouched; backs up settings.json. Dry run by default.
| Parameter | Type | Description |
|---|---|---|
dryRun | boolean | Default true |
lang | string | Alarm language (default en) |
notify | boolean | Also raise a desktop notification (macOS, Linux) |
uninstall_hooks
Remove the hooks install_hooks added, and nothing else. Dry run by default. With no changes to make, lists what is installed.
| Parameter | Type | Description |
|---|---|---|
dryRun | boolean | Default true |
account_status
Which Claude account Claude Code on this machine is signed in to, and the plan meters (5-hour and 7-day) it last fetched.