
How to add Token Optimizer MCP to Claude Desktop
Cut Claude Code context usage 60-90% via caching, Brotli compression, and smart tool replacements. Paste the config into ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude Desktop.
Last updated June 14, 2026 ยท 409โ ยท stdio ยท no auth
Claude Desktop config for Token Optimizer MCP
npm install -g @ooples/token-optimizer-mcp{
"mcpServers": {
"token-optimizer-mcp": {
"command": "node",
"args": [
"$NPM_PREFIX/lib/node_modules/@ooples/token-optimizer-mcp/dist/server/index.js"
]
}
}
}Setup steps
- 1Open Claude Desktop โ Settings โ Developer โ Edit Config (this opens ~/Library/Application Support/Claude/claude_desktop_config.json).
- 2Paste the Token Optimizer MCP config below under the top-level "mcpServers" key.
- 3Fill in any placeholder secrets (API keys, paths) in the snippet.
- 4Save the file, then fully quit and reopen Claude Desktop.
- 5Open a chat and confirm Token Optimizer MCP's tools appear under the ๐ tools menu.
Before you start
- Node.js 18+ (README mentions Node.js 20+ in the stack) and npm
- An MCP-compatible client (Claude Code, Claude Desktop, Cursor, Cline, GitHub Copilot, or Windsurf)
- Package installed globally via npm (@ooples/token-optimizer-mcp)
- Windows: PowerShell 5.1+ for the optional global hooks system
What Token Optimizer MCP can do in Claude Desktop
optimize_textCompress and cache text; primary tool for token reduction.
get_cachedRetrieve previously cached text by key.
compress_textCompress text using Brotli.
decompress_textDecompress Brotli-compressed text.
count_tokensCount tokens using tiktoken (GPT-4 tokenizer).
analyze_optimizationAnalyze text and return optimization recommendations.
get_cache_statsView cache hit rates and compression ratios.
clear_cacheClear all cached data (supports olderThan filtering).
Security
Runs fully offline with no external dependencies. The npm postinstall script auto-detects and edits AI tool config files (Claude Desktop, Cursor, Cline, etc.), installs Claude Code global hooks that run on every tool call, and configures workspace trust and PowerShell execution policy; review what it changes before installing. Cached/compressed content is stored locally in an unencrypted SQLite database (~/.token-optimizer/cache.db), auto-cleaned after 7 days.
Token Optimizer MCP + Claude Desktop FAQ
Where is the Claude Desktop config file?
Claude Desktop reads MCP servers from ~/Library/Application Support/Claude/claude_desktop_config.json. Paste the Token Optimizer MCP config there under the "mcpServers" key and restart the client.
Is Token Optimizer MCP safe to use with Claude Desktop?
Runs fully offline with no external dependencies. The npm postinstall script auto-detects and edits AI tool config files (Claude Desktop, Cursor, Cline, etc.), installs Claude Code global hooks that run on every tool call, and configures workspace trust and PowerShell execution policy; review what it changes before installing. Cached/compressed content is stored locally in an unencrypted SQLite database (~/.token-optimizer/cache.db), auto-cleaned after 7 days.
Does it need an internet connection or API key?
No. The server runs fully offline with zero external dependencies and requires no authentication; it stores compressed content locally in SQLite.
Which clients does it support?
It works as a standard MCP server for Claude Desktop, Cursor, Cline, GitHub Copilot, and Windsurf. Claude Code additionally supports an optional 7-phase global hooks system that optimizes every tool call automatically.
How much token reduction can I expect?
The project reports 60-90% average reduction across 38,000+ real-world operations, with higher rates (83-95%) for cached API responses.