Analyze token usage, estimate API costs, compare AI models, and assess file sizes for context window optimization.
npx claudepluginhub novanoticia/token-calculator-suiteToolkit for understanding and managing AI resource consumption.
Unified token calculation system for Claude Chat, Cowork, and Claude Code.
Reusable, open-source library for estimating Claude token consumption across three Anthropic platforms. Built with modularity, accuracy, and privacy in mind.
✨ Features:
token-calculator-suite/
├── packages/
│ ├── core/ ← Shared calculation logic
│ ├── chat-skill/ ← Claude.ai skill
│ ├── cowork-plugin/ ← Claude Cowork plugin
│ └── claude-code-mcp/ ← Claude Code CLI tool
├── README.md ← This file
└── package.json ← Monorepo config
Installation: Copy packages/chat-skill/SKILL.md to your skills folder.
Usage:
/tokens
Features:
Installation:
packages/cowork-plugin/ as token-calculator.zipUsage:
/tokens:analyze # Analyze current file
/tokens:report # Generate token usage report
Features:
This MCP server integrates token calculation directly into Claude Code, allowing you to estimate token usage and API costs while working on projects.
Clone the repository
git clone https://github.com/token-calculator-suite/token-calculator-suite.git
cd token-calculator-suite
Install dependencies
yarn install
This installs all workspace dependencies. The installation creates a node_modules directory and sets up workspace links.
Build the MCP server
yarn workspace @token-calculator/claude-code-mcp build
This compiles the TypeScript code into JavaScript in the dist directory. You should see output indicating successful compilation with no errors.
Verify the build was successful
ls -la packages/claude-code-mcp/dist/
You should see mcp-server.js in this directory.
Configure Claude Code
Edit (or create) ~/.claude/settings.json and add the MCP server configuration:
{
"mcpServers": {
"token-calculator": {
"command": "node",
"args": ["/full/path/to/token-calculator-suite/packages/claude-code-mcp/dist/mcp-server.js"],
"type": "stdio"
}
}
}
Important: Replace /full/path/to/token-calculator-suite with the absolute full path to your cloned repository. You can find the full path by running pwd in the repository directory.
Restart Claude Code
Close and reopen Claude Code. The token calculator MCP will be automatically loaded.
If the MCP server fails to start:
node --version and ensure it's >= 18.0.0packages/claude-code-mcp/dist/mcp-server.js exists and is not emptyargs path in settings.json uses the absolute full path (starting with /) to the mcp-server.js fileyarn clean followed by yarn install && yarn buildOnce installed, the token calculator MCP provides:
packages/core/)