
How to add Token Optimizer MCP to Windsurf
Cut Claude Code context usage 60-90% via caching, Brotli compression, and smart tool replacements. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.
Last updated June 14, 2026 · 409★ · stdio · no auth
Windsurf 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 Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
- 2Paste the Token Optimizer MCP config below.
- 3Fill in placeholder secrets, then save.
- 4Click Refresh in the MCP panel.
- 5Token Optimizer MCP's tools become available to Cascade.
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 Windsurf
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 + Windsurf FAQ
Where is the Windsurf config file?
Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_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 Windsurf?
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.