token-counter-mcp 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,168 +1,78 @@
1
1
  # Token Counter MCP
2
2
 
3
- An MCP server that accurately counts and tracks every Claude token — input, output, cache read/write, and planning. Uses the official Anthropic token-counting API for **exact** counts (not estimates).
3
+ Track every Claude token automatically — input, output, cache read/write — with a live local dashboard and per-project cost breakdown. Works in any Claude Code project with zero configuration after a one-time setup.
4
4
 
5
- ## Hosted Service — One Command Setup
5
+ ---
6
6
 
7
- We run a hosted instance so you don't need your own Anthropic API key or any deployment:
7
+ ## Quickstart
8
8
 
9
9
  ```bash
10
- claude mcp add --transport sse token-counter https://proud-motivation-production-c4ab.up.railway.app/sse
10
+ npx -y token-counter-mcp setup
11
11
  ```
12
12
 
13
- Restart Claude Code and the tools are ready.
14
-
15
- ### Interactive Setup (with Dashboard)
13
+ Restart Claude Code. That's it.
16
14
 
17
- For a guided setup that also configures the live dashboard token:
18
-
19
- ```bash
20
- npx -y token-counter-mcp --setup
21
- ```
15
+ **What setup does:**
16
+ 1. Registers `token-counter-mcp` globally (`--scope user`) — active in every project
17
+ 2. Creates `~/.claude/token-counter-stop.sh` — a stop hook that logs tokens after each response
18
+ 3. Wires the hook into `~/.claude/settings.json` — no per-project config needed
22
19
 
23
- This updates `~/.claude.json` automatically and prints your personal dashboard URL.
20
+ **Dashboard:** open the URL printed at session start (usually `http://localhost:8899`)
24
21
 
25
22
  ---
26
23
 
27
- ## Available Tools
24
+ ## Auto-Tracking
28
25
 
29
- | Tool | What it does |
30
- |------|-------------|
31
- | `count_tokens` | Exact token count for any text or conversation via Anthropic API |
32
- | `log_usage` | Record actual token usage after an API call (input, output, cache) |
33
- | `get_session_stats` | Running totals and USD cost for the current session |
34
- | `get_usage_history` | Last N usage entries across all sessions |
35
- | `reset_session` | Zero out session totals (history is preserved) |
36
- | `estimate_cost` | Calculate USD cost for a given token count without making an API call |
26
+ After setup, token usage is logged **automatically after every Claude response** — no manual `log_usage` calls needed. The dashboard shows:
37
27
 
38
- ---
39
-
40
- ## Usage in Claude Code
41
-
42
- Once added, ask Claude things like:
28
+ - Session totals (input / output / cache / cost)
29
+ - Per-project breakdown (costs grouped by project folder)
30
+ - Full usage history
43
31
 
32
+ To check your running cost mid-session, ask Claude:
44
33
  ```
45
- How many tokens is this conversation so far?
46
- Log my last API call: 1500 input, 300 output, claude-opus-4-6
47
34
  What's my total spend this session?
48
- How much would 50k input + 10k output tokens cost on claude-sonnet-4-6?
49
- Show me my usage history for the last 10 entries.
50
- Reset my session totals.
51
35
  ```
52
36
 
53
37
  ---
54
38
 
55
- ## Self-Hosted Deployment
56
-
57
- Want to run your own instance with your own API key?
58
-
59
- ### macOS
60
-
61
- ```bash
62
- # Install Railway CLI
63
- brew install railway
64
-
65
- # Clone and build
66
- git clone https://github.com/krishnakantparashar/TokenCounterMCP
67
- cd TokenCounterMCP
68
- npm install && npm run build
69
-
70
- # Deploy
71
- railway login
72
- railway init
73
- railway up
74
- railway domain
75
-
76
- # Set your Anthropic API key
77
- railway variables set ANTHROPIC_API_KEY=sk-ant-YOUR_KEY_HERE
78
- ```
79
-
80
- ### Windows (PowerShell)
81
-
82
- ```powershell
83
- # Install Railway CLI (requires Node.js)
84
- npm install -g @railway/cli
85
-
86
- # Clone and build
87
- git clone https://github.com/krishnakantparashar/TokenCounterMCP
88
- cd TokenCounterMCP
89
- npm install
90
- npm run build
91
-
92
- # Deploy
93
- railway login
94
- railway init
95
- railway up
96
- railway domain
97
-
98
- # Set your Anthropic API key
99
- railway variables set ANTHROPIC_API_KEY=sk-ant-YOUR_KEY_HERE
100
- ```
39
+ ## Available Tools
101
40
 
102
- After deployment, connect with:
103
- ```bash
104
- claude mcp add --transport sse token-counter https://YOUR-URL.up.railway.app/sse
105
- ```
41
+ | Tool | What it does |
42
+ |------|-------------|
43
+ | `count_tokens` | Estimate token count for any text before reading it |
44
+ | `log_usage` | Manually record token usage (input, output, cache) |
45
+ | `get_session_stats` | Running totals and USD cost for the current session |
46
+ | `get_usage_history` | Last N usage entries across all sessions |
47
+ | `reset_session` | Zero out session totals (history is preserved) |
48
+ | `estimate_cost` | Calculate USD cost for a given token count |
106
49
 
107
50
  ---
108
51
 
109
- ## Local stdio Mode
110
-
111
- Runs entirely on your machine. Requires Node.js 18+.
52
+ ## Manual Install (alternative to setup)
112
53
 
113
- ### Quickstart (no clone needed)
54
+ If you prefer to register the MCP without the stop hook:
114
55
 
115
56
  ```bash
116
- claude mcp add token-counter -- npx -y token-counter-mcp
57
+ claude mcp add --scope user token-counter -- npx -y token-counter-mcp
117
58
  ```
118
59
 
119
- That's it. Restart Claude Code — the server starts on demand via `npx`.
120
-
121
- ### Manual install (if you prefer)
122
-
60
+ Or per-project only:
123
61
  ```bash
124
- git clone https://github.com/krishnakantparashar/TokenCounterMCP
125
- cd TokenCounterMCP
126
- npm install && npm run build
127
- ```
128
-
129
- Set your API key for exact counts (optional — falls back to ~97–99% accurate local counting without it):
130
-
131
- ```bash
132
- export ANTHROPIC_API_KEY=sk-ant-YOUR_KEY_HERE # macOS/Linux
133
- $env:ANTHROPIC_API_KEY="sk-ant-YOUR_KEY_HERE" # Windows PowerShell
62
+ claude mcp add token-counter -- npx -y token-counter-mcp
134
63
  ```
135
64
 
136
- Add to Claude Code:
137
-
138
- ```bash
139
- # macOS/Linux
140
- claude mcp add token-counter -- node "/absolute/path/to/TokenCounterMCP/dist/index.js"
141
-
142
- # Windows
143
- claude mcp add token-counter -- node "C:\path\to\TokenCounterMCP\dist\index.js"
144
- ```
65
+ ---
145
66
 
146
- ### Local Dashboard
67
+ ## Local Dashboard
147
68
 
148
- When running in local stdio mode, a live dashboard is available at:
69
+ The dashboard runs on your machine while Claude Code is active. The actual port is printed at session start:
149
70
 
150
71
  ```
151
- http://localhost:8899
72
+ Token usage dashboard → http://localhost:8899
152
73
  ```
153
74
 
154
- Open it in your browser to see session totals, per-project cost breakdowns, and usage history.
155
-
156
- ---
157
-
158
- ## Counting Modes
159
-
160
- | Mode | Accuracy | Requires |
161
- |------|----------|----------|
162
- | Exact (Anthropic API) | 100% | `ANTHROPIC_API_KEY` set on server |
163
- | Local approximation | ~97–99% | Nothing — works offline |
164
-
165
- The hosted service uses exact counting. Local mode without a key uses `gpt-tokenizer` (cl100k_base BPE) as a fallback.
75
+ If port 8899 is taken, it increments automatically (8900, 8901, …). The current port is always saved to `~/.claude/token-counter/dashboard-port.txt` so the stop hook finds it regardless.
166
76
 
167
77
  ---
168
78
 
@@ -174,23 +84,23 @@ The hosted service uses exact counting. Local mode without a key uses `gpt-token
174
84
  | `claude-sonnet-4-6` | $3.00 / 1M | $15.00 / 1M | $0.30 / 1M | $0.75 / 1M |
175
85
  | `claude-haiku-4-5` | $1.00 / 1M | $5.00 / 1M | $0.10 / 1M | $0.25 / 1M |
176
86
 
177
- Models not in the table fall back to Sonnet pricing. Versioned model IDs (e.g. `claude-opus-4-6-20260101`) are matched by prefix.
87
+ Models not in the table fall back to Sonnet pricing. Versioned IDs (e.g. `claude-sonnet-4-6-20260101`) are matched by prefix.
178
88
 
179
89
  ---
180
90
 
181
- ## Rate Limits
91
+ ## Token Storage
182
92
 
183
- The hosted service allows **60 requests per minute** per IP. For higher limits, deploy your own instance.
184
-
185
- ---
186
-
187
- ## Token Storage (local mode only)
188
-
189
- Usage history is stored at `~/.claude/token-counter/` (macOS/Linux) or `%USERPROFILE%\.claude\token-counter\` (Windows):
93
+ Usage is stored locally at `~/.claude/token-counter/`:
190
94
 
191
95
  | File | Contents |
192
96
  |------|----------|
193
- | `session.json` | Current session totals (reset with `reset_session`) |
97
+ | `session.json` | Current session totals |
194
98
  | `history.json` | All-time log, capped at 10,000 entries |
99
+ | `dashboard-port.txt` | Port the dashboard is currently listening on |
100
+
101
+ ---
102
+
103
+ ## Requirements
195
104
 
196
- The hosted service does not persist your usage data between sessions.
105
+ - Node.js 18+
106
+ - Claude Code CLI (`claude`)
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAQA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAkE9C"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AA6FA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CA2B9C"}
package/dist/setup.js CHANGED
@@ -1,61 +1,111 @@
1
- import readline from "readline/promises";
2
1
  import fs from "fs";
3
2
  import path from "path";
4
3
  import os from "os";
5
- import crypto from "crypto";
6
- const CLAUDE_CONFIG = path.join(os.homedir(), ".claude.json");
7
- export async function runSetup() {
8
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
9
- const ask = (q) => rl.question(q);
10
- console.log("\nToken Counter MCP — Setup\n");
11
- // Read existing Claude config
12
- let config = {};
4
+ import { execSync } from "child_process";
5
+ const HOME = os.homedir();
6
+ const CLAUDE_DIR = path.join(HOME, ".claude");
7
+ const GLOBAL_SETTINGS = path.join(CLAUDE_DIR, "settings.json");
8
+ const STOP_SH = path.join(CLAUDE_DIR, "token-counter-stop.sh");
9
+ function ensureDir(p) {
10
+ if (!fs.existsSync(p))
11
+ fs.mkdirSync(p, { recursive: true });
12
+ }
13
+ function readJson(p) {
13
14
  try {
14
- config = JSON.parse(fs.readFileSync(CLAUDE_CONFIG, "utf8"));
15
+ return JSON.parse(fs.readFileSync(p, "utf8"));
15
16
  }
16
17
  catch {
17
- config = {};
18
+ return {};
18
19
  }
19
- const mcpServers = config.mcpServers ?? {};
20
- const existing = mcpServers["token-counter"];
21
- const existingEnv = existing?.env ?? {};
22
- if (existing) {
23
- const ans = await ask("token-counter is already configured. Update it? (y/N): ");
24
- if (ans.trim().toLowerCase() !== "y") {
25
- console.log("Nothing changed.");
26
- rl.close();
27
- return;
28
- }
20
+ }
21
+ function writeJson(p, data) {
22
+ fs.writeFileSync(p, JSON.stringify(data, null, 2) + "\n", "utf8");
23
+ }
24
+ function registerMcp() {
25
+ try {
26
+ execSync("claude mcp remove token-counter --scope user 2>/dev/null; claude mcp add --scope user token-counter -- npx -y token-counter-mcp", { stdio: "ignore", shell: "/bin/bash" });
27
+ return "ok";
29
28
  }
30
- const remoteInput = await ask("Hosted dashboard URL (press Enter to skip): ");
31
- const remoteUrl = remoteInput.trim();
32
- let token = "";
33
- let dashboardUrl = "http://localhost:8899";
34
- if (remoteUrl) {
35
- // Reuse existing token so old localStorage history still works
36
- token = existingEnv.DASHBOARD_TOKEN || crypto.randomBytes(12).toString("hex");
37
- dashboardUrl = `${remoteUrl.replace(/\/$/, "")}/?token=${token}`;
38
- console.log(`\nYour token: ${token}`);
39
- console.log("Keep this — it's your personal dashboard key.\n");
29
+ catch {
30
+ return "fallback";
40
31
  }
41
- const env = {};
42
- if (remoteUrl) {
43
- env.REMOTE_DASHBOARD_URL = remoteUrl;
44
- env.DASHBOARD_TOKEN = token;
32
+ }
33
+ function writeStopHook() {
34
+ // Build the bash script without using TS template literals for the bash variables
35
+ // to avoid conflicts between bash $VAR syntax and TS template literal ${VAR}.
36
+ const D = "$"; // shorthand to embed $ chars safely
37
+ const lines = [
38
+ "#!/usr/bin/env bash",
39
+ `INPUT=${D}(cat)`,
40
+ `TRANSCRIPT=${D}(echo "${D}INPUT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('transcript_path',''))" 2>/dev/null || echo "")`,
41
+ `if [[ -n "${D}TRANSCRIPT" && -f "${D}TRANSCRIPT" ]]; then`,
42
+ ` CHARS=${D}(python3 - "${D}TRANSCRIPT" 2>/dev/null << 'PYEOF'`,
43
+ "import json, sys",
44
+ "lines = open(sys.argv[1]).readlines()",
45
+ "for line in reversed(lines):",
46
+ " try:",
47
+ " msg = json.loads(line)",
48
+ ` if msg.get("type") == "assistant":`,
49
+ ` print(len(str(msg.get("message", {}).get("content", ""))))`,
50
+ " break",
51
+ " except Exception:",
52
+ " pass",
53
+ "PYEOF",
54
+ ")",
55
+ ` OUT=${D}(( ${D}{CHARS:-0} / 4 ))`,
56
+ ` IN=${D}(( OUT * 4 ))`,
57
+ ` PROJ_DIR=${D}(basename "${D}(dirname "${D}TRANSCRIPT")")`,
58
+ ` PROJECT_PATH=${D}(echo "${D}PROJ_DIR" | sed 's|^-|/|' | sed 's|-|/|g')`,
59
+ ` PORT_FILE="${D}HOME/.claude/token-counter/dashboard-port.txt"`,
60
+ ` DASH_PORT=8899`,
61
+ ` if [[ -f "${D}PORT_FILE" ]]; then DASH_PORT=${D}(cat "${D}PORT_FILE"); fi`,
62
+ ` curl -sf -X POST "http://localhost:${D}DASH_PORT/log" \\`,
63
+ ` -H "Content-Type: application/json" \\`,
64
+ ` -d "{\\"input_tokens\\":${D}IN,\\"output_tokens\\":${D}OUT,\\"model\\":\\"claude-sonnet-4-6\\",\\"description\\":\\"auto\\",\\"project\\":\\"${D}PROJECT_PATH\\"}" \\`,
65
+ " >/dev/null 2>&1 || true",
66
+ "fi",
67
+ "exit 0",
68
+ "",
69
+ ];
70
+ fs.writeFileSync(STOP_SH, lines.join("\n"), { encoding: "utf8", mode: 0o755 });
71
+ }
72
+ function addStopHook() {
73
+ ensureDir(CLAUDE_DIR);
74
+ const settings = readJson(GLOBAL_SETTINGS);
75
+ const hooks = (settings.hooks ?? {});
76
+ const stopHookCmd = `/bin/bash "${STOP_SH}"`;
77
+ const existing = (hooks.Stop ?? []);
78
+ const alreadyIn = existing.some(h => h.hooks?.some(hh => hh.command === stopHookCmd));
79
+ if (!alreadyIn) {
80
+ existing.push({ matcher: "", hooks: [{ type: "command", command: stopHookCmd }] });
81
+ }
82
+ hooks.Stop = existing;
83
+ settings.hooks = hooks;
84
+ writeJson(GLOBAL_SETTINGS, settings);
85
+ }
86
+ export async function runSetup() {
87
+ console.log("\nToken Counter MCP — Setup\n");
88
+ ensureDir(CLAUDE_DIR);
89
+ // 1. Register MCP globally
90
+ process.stdout.write("Registering MCP (scope: user)... ");
91
+ const mcpResult = registerMcp();
92
+ if (mcpResult === "ok") {
93
+ console.log("done.");
45
94
  }
46
- mcpServers["token-counter"] = {
47
- command: "npx",
48
- args: ["-y", "token-counter-mcp"],
49
- ...(Object.keys(env).length ? { env } : {}),
50
- };
51
- config.mcpServers = mcpServers;
52
- fs.writeFileSync(CLAUDE_CONFIG, JSON.stringify(config, null, 2) + "\n", "utf8");
53
- console.log("Written to ~/.claude.json");
54
- console.log("\nDone! Restart Claude Code to activate.\n");
55
- console.log(`Dashboard: ${dashboardUrl}`);
56
- if (remoteUrl) {
57
- console.log("Bookmark this URL — it loads your history from localStorage even when offline.\n");
95
+ else {
96
+ console.log("could not run `claude` CLI — add manually:");
97
+ console.log(" claude mcp add --scope user token-counter -- npx -y token-counter-mcp\n");
58
98
  }
59
- rl.close();
99
+ // 2. Write global stop hook script
100
+ process.stdout.write("Writing stop hook script... ");
101
+ writeStopHook();
102
+ console.log(`done. (${STOP_SH})`);
103
+ // 3. Register Stop hook in global settings.json
104
+ process.stdout.write("Adding Stop hook to ~/.claude/settings.json... ");
105
+ addStopHook();
106
+ console.log("done.");
107
+ console.log("\nAll set! Restart Claude Code to activate.\n");
108
+ console.log("Dashboard: http://localhost:8899 (exact port printed at session start)");
109
+ console.log("Usage is logged automatically after each Claude response.\n");
60
110
  }
61
111
  //# sourceMappingURL=setup.js.map
package/dist/setup.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAE9D,MAAM,CAAC,KAA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AA2E,CAAC,CAAC;IAC3F,CAAC;IAED,mCAAmC;IACnC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACrD,aAAa,EAAE,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,GAAG,CAAC,CAAC;IAElC,gDAAgD;IAChD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACxE,WAAW,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;AAC7E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "token-counter-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "MCP server that accurately counts and tracks every Claude Code token — input, output, cache, and planning",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",