Token Analyzer MCP
A tool for independent verification of token counts and context volume in Model Context Protocol (MCP) server configurations. Provides accurate token consumption analysis to validate and optimize your Claude Code setup.
Purpose
This tool serves as an independent verification system for token usage in MCP configurations. Rather than relying on estimates or built-in metrics, it provides precise token counting and context volume analysis to:
Verify actual token consumption vs. expected usage
Validate context window utilization against the 200k token limit
Identify servers consuming excessive tokens
Provide independent confirmation of token optimization efforts
Features
Independent Token Verification - Accurate token counting separate from MCP server self-reporting
Context Volume Analysis - Precise measurement of total context consumption
MCP Configuration Scanning - Automatic discovery and analysis of configured servers
Overhead Calculation - Breakdown of token usage by server and tool definitions
Verification Reports - Detailed analysis for validating token usage claims
Quick Estimation Mode - Fast overhead checking without full server connections
Installation
Usage
Basic Verification
Verification Reports
Configuration Discovery
The analyzer automatically discovers MCP configurations from standard locations:
~/.claude/claude_desktop_config.json~/.config/claude-desktop/claude_desktop_config.jsonWindows:
%APPDATA%/Claude/claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Supported Configuration Format
Sample Verification Output
Commands
analyze- Full independent verification with detailed breakdownquick- Fast context overhead verification without server connectionsconfig- Validate MCP configuration accessibility and formatdoctor- Verify analyzer dependencies and permissions
Verification Accuracy
Connection Timeout: 10 seconds per server to ensure accurate results
Retry Logic: Up to 2 retry attempts for reliable token counting
Independent Counting: Separate token calculation engine from MCP servers
Cross-Validation: Multiple counting methods for accuracy verification
Troubleshooting
Configuration Not Found
Server Connection Issues
Token Count Discrepancies
Development
API Reference
TokenVerificationEngine
performIndependentVerification()- Execute comprehensive token verificationverifyServerTokens(servers)- Independently verify token consumptionvalidateContextUsage(tokens)- Check context volume against limitsgenerateVerificationReport(analysis)- Create verification documentation
ConfigurationValidator
discoverConfigurations()- Find and validate MCP configuration filesverifyServerAccessibility(server)- Test server connection and responsevalidateConfigurationFormat(config)- Check configuration file structurecalculateBaselineOverhead()- Measure built-in tool token consumption
Contributing
Fork the repository
Create a feature branch:
git checkout -b feature-nameAdd verification improvements and tests
Run the test suite:
npm testSubmit a pull request
License
MIT License - see LICENSE file for details.
Support
This server cannot be installed
Provides intelligent analysis of token usage patterns and optimization recommendations to improve efficiency and reduce costs in Claude Code sessions. Offers real-time analysis, cost metrics, and actionable insights for better context window and tool usage optimization.