MCP Directory

How to add Token Optimizer MCP to Cursor

Cut Claude Code context usage 60-90% via caching, Brotli compression, and smart tool replacements. Paste the config into ~/.cursor/mcp.json and restart Cursor.

Last updated June 14, 2026 · 409 · stdio · no auth

Cursor 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

  1. 1Open Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
  2. 2Paste the Token Optimizer MCP config below into the "mcpServers" object.
  3. 3Fill in placeholder secrets, then save.
  4. 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
  5. 5Ask Cursor to use one of Token Optimizer MCP's tools to confirm it's connected.

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 Cursor

optimize_text

Compress and cache text; primary tool for token reduction.

get_cached

Retrieve previously cached text by key.

compress_text

Compress text using Brotli.

decompress_text

Decompress Brotli-compressed text.

count_tokens

Count tokens using tiktoken (GPT-4 tokenizer).

analyze_optimization

Analyze text and return optimization recommendations.

get_cache_stats

View cache hit rates and compression ratios.

clear_cache

Clear 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 + Cursor FAQ

Where is the Cursor config file?

Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the Token Optimizer MCP config there under the "mcpServers" key and restart the client.

Is Token Optimizer MCP safe to use with Cursor?

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.

View repo Full Token Optimizer MCP page