MCP Directory

Token Optimizer MCP

Cut Claude Code context usage 60-90% via caching, Brotli compression, and smart tool replacements.

Unverified
stdio (local)
No auth
TypeScript

Add to your client

Copy the config for your MCP client and paste it into its config file.

Install / run
npm install -g @ooples/token-optimizer-mcp

Paste into ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "token-optimizer-mcp": {
      "command": "node",
      "args": [
        "$NPM_PREFIX/lib/node_modules/@ooples/token-optimizer-mcp/dist/server/index.js"
      ]
    }
  }
}

Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf

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

About Token Optimizer MCP

An MCP server that reduces context window usage by 60-90% through SQLite-backed caching, Brotli compression, and smart replacements for standard tools. It provides 60+ tools across caching, file operations, API/database access, build/test workflows, monitoring, and token analytics, using tiktoken for accurate token counting. Works as a standard MCP server for Claude Desktop, Cursor, Cline, GitHub Copilot, and Windsurf, and additionally offers a 7-phase global hooks system for Claude Code that optimizes every tool call automatically.

Tools & capabilities (65)

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).

smart_read

Read files with caching and diff-based output (~80% token reduction).

smart_write

Write files with verification and change tracking.

smart_edit

Line-based file editing with diff-only output (~90% reduction).

smart_grep

Search file contents with match-only output (~80% reduction).

smart_glob

File pattern matching with path-only results (~75% reduction).

smart_diff

Git diffs with diff-only output (~85% reduction).

smart_branch

Git branch listing with structured JSON (~60% reduction).

smart_log

Git commit history with smart filtering (~75% reduction).

smart_merge

Git merge management with conflict analysis (~80% reduction).

smart_status

Git status with status-only output (~70% reduction).

smart_api_fetch

HTTP requests with caching and retry logic (~83% reduction on cache hits).

smart_cache_api

API response caching with TTL/ETag/event-based strategies.

smart_database

Database queries with connection pooling and caching (~83% reduction).

smart_sql

SQL query analysis with optimization suggestions (~83% reduction).

smart_schema

Database schema analysis with intelligent caching.

smart_graphql

GraphQL query optimization with complexity analysis (~83% reduction).

smart_rest

REST API analysis with endpoint discovery (~83% reduction).

smart_orm

ORM query optimization with N+1 detection (~83% reduction).

smart_migration

Database migration tracking (~83% reduction).

smart_websocket

WebSocket connection management with message tracking.

smart_build

TypeScript builds with diff-based change detection.

smart_test

Test execution with incremental test selection.

smart_lint

ESLint with incremental analysis and auto-fix.

smart_typecheck

TypeScript type checking with caching.

smart_install

Package installation with dependency analysis.

smart_docker

Docker operations with layer analysis.

smart_logs

Log aggregation with pattern filtering.

smart_network

Network diagnostics with anomaly detection.

smart_processes

Process monitoring with resource tracking.

smart_system_metrics

System resource monitoring with performance recommendations.

smart_cache

Multi-tier cache (L1/L2/L3) with 6 eviction strategies (~90% reduction).

cache_warmup

Intelligent cache pre-warming with schedule support (~87% reduction).

cache_analytics

Real-time dashboards and trend analysis (~88% reduction).

cache_benchmark

Performance testing and strategy comparison (~89% reduction).

cache_compression

6 compression algorithms with adaptive selection (~89% reduction).

cache_invalidation

Dependency tracking and pattern-based invalidation (~88% reduction).

cache_optimizer

ML-based recommendations and bottleneck detection (~89% reduction).

cache_partition

Sharding and consistent hashing (~87% reduction).

cache_replication

Distributed replication with conflict resolution (~88% reduction).

predictive_cache

ML-based predictive caching with ARIMA/LSTM (~91% reduction).

alert_manager

Multi-channel alerting (email, Slack, webhook) with routing (~89% reduction).

metric_collector

Time-series metrics with multi-source support (~88% reduction).

monitoring_integration

Integrates external platforms (Prometheus, Grafana, Datadog) (~87% reduction).

custom_widget

Dashboard widgets with template caching (~88% reduction).

data_visualizer

Interactive visualizations with SVG optimization (~92% reduction).

health_monitor

System health checks with state compression (~91% reduction).

log_dashboard

Log analysis with pattern detection (~90% reduction).

smart_cron

Scheduled task management (cron / Windows Task Scheduler) (~85% reduction).

smart_user

User and permission management across platforms (~86% reduction).

smart_ast_grep

Structural code search with AST indexing (~83% reduction).

get_session_stats

Session-level token usage statistics and savings breakdown.

analyze_project_tokens

Project-wide token analysis and cost estimation.

optimize_session

Compress large file operations from the current session.

get_hook_analytics

Token usage breakdown by hook phase (PreToolUse, PostToolUse, etc.).

get_action_analytics

Token usage breakdown by tool/action (Read, Write, Grep, etc.).

get_mcp_server_analytics

Token usage breakdown by MCP server.

export_analytics

Export analytics data in JSON or CSV format with filtering.

What this server can do

Token Optimizer MCP provides tools for these capabilities — tap one to see every MCP server that does the same:

When to use it

  • Slashing Claude Code / Claude Desktop context window usage on large codebases and long sessions
  • Caching API and database responses so repeated calls cost minimal tokens
  • Reading, editing, grepping, and diffing files with diff-only output to save tokens
  • Measuring and reporting token savings per session, action, and MCP server

Security notes

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 FAQ

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.

Where is cached data stored and is it cleaned up?

In a local SQLite database at ~/.token-optimizer/cache.db. Entries are automatically cleaned up after 7 days, and clear_cache can purge data manually.

Alternatives to Token Optimizer MCP

Compare all alternatives →

Microsoft's official browser-automation MCP using Playwright's accessibility tree (no vision model).

Featured
Verified
stdio (local)
No auth
TypeScript
12 tools
Updated 13 days agoRepo

Up-to-date, version-specific library documentation injected into your coding agent.

Verified
stdio (local)
API key
TypeScript
2 tools
Updated 17 days agoRepo

LSP-powered coding agent toolkit: semantic symbol search, references and structural edits.

Verified
stdio (local)
No auth
Python
11 tools
Updated 15 days agoRepo