Token Optimizer MCP server
Context-window optimization: caching, compression & smart file tools that cut tokens 60-90%.
530 stars1.4k downloads/wk
Reviews
Write oneNobody has reviewed Token Optimizer yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
Token Optimizer tools (100, 9 write)
write = sends, deletes, buys or postsRead from the package source without running it. The installed server may list more.
alert_managerComprehensive alerting system with multi-channel notifications, intelligent routing, and 89% token reduction through aggressive caching and history aggregation
analyze_optimizationAnalyze text and provide recommendations for optimization including compression benefits and token savings.
analyze_project_tokensAnalyze observed token usage across multiple sessions within a project. Aggregates session logs and identifies top contributors. Cost is Not priced unless the caller supplies an effective input-token rate; any resulting value is a cost equivalent, not an invoice.
anomalyexplainerExplain anomalies with root cause analysis, hypothesis generation, and remediation suggestions
cache_analyticsComprehensive cache analytics with 88%+ token reduction. Real-time dashboards, trend analysis, alerting, heatmaps, bottleneck detection, and cost optimization.
cache_auditReport Anthropic prompt-cache economics for this project: measured cache-read input, cache-write input, hit rate, and warm prefix size read from a Claude Code transcript, plus likely invalidation sources. Cost equivalents are labeled Anthropic-specific, excluded from universal savings, and are not invoices.
cache_benchmarkCache Performance Benchmarking with 89% token reduction through comprehensive testing and analysis. Features: - Strategy comparison (LRU vs LFU vs FIFO vs TTL vs size vs hybrid) - Load testing with configurable concurrency and ramp-up - Latency profiling with percentiles (p50, p90, p95, p99, p99.9) - Throughput testing (operations per second) - Comprehensive reports in markdown, HTML, JSON, PDF -
cache_compressionAdvanced compression strategies for cache optimization with 89%+ token reduction. Supports 6 algorithms (gzip, brotli, lz4, zstd, snappy, custom), adaptive selection, dictionary-based compression, and delta compression for time-series data.
cache_invalidationComprehensive cache invalidation with 88%+ token reduction, dependency tracking, pattern matching, scheduled invalidation, and distributed coordination
cache_optimizerAdvanced cache optimization with 89%+ token reduction. Analyzes performance, benchmarks strategies, provides ML-based recommendations, detects bottlenecks, and performs cost-benefit analysis.
cache_partitionAdvanced cache partitioning and sharding with 87%+ token reduction through consistent hashing, automatic rebalancing, and partition isolation
cache_replicationDistributed cache replication with 88%+ token reduction. Supports primary-replica and multi-primary modes, strong/eventual consistency, automatic conflict resolution, failover, incremental sync, and health monitoring.
cache_warmupIntelligent cache pre-warming with 87%+ token reduction, featuring schedule-based warming, pattern analysis, dependency resolution, and progressive warming strategies
checkpoint_handoffwrite actionCreate or restore a resumable checkpoint and return a takeover receipt.
clear_cacheClear all cached data. Use with caution.
cognition_recordVerify external grader evidence, then propose and activate evidence-backed cognition authored by the active model. Use operation=verify-evidence before recording unfamiliar evidence.
compress_textCompress text using Brotli, returned as a base64 string. Intended for AT-REST STORAGE/caching (reduces bytes ~50%). NOTE: base64 tokenizes poorly, so the output usually has MORE LLM tokens than the input — do NOT feed the result into a model context expecting savings. The response includes originalTokens/compressedTokens and a warning when the output would increase tokens.
context_deltaCompute a unified-diff delta for a file in a given session so the model only sees changes since the last snapshot. Operations: compute-delta, seed, clear.
context_pageObtain bounded decision-specific cognition. Returns an explicit empty result when nothing safe applies.
context_receipt_verifyVerify that one adapter-delivered context receipt and its correction trace to authenticated external grader evidence.
count_tokensCount tokens in text using the pluggable tokenizer framework (#124). Picks a model-specific tokenizer (tiktoken for GPT/Claude, Google AI REST for Gemini, content-aware heuristic fallback).
custom_widgetwrite actionCreate and manage custom dashboard widgets with 88% token reduction through template caching and configuration compression
data_visualizerwrite actionCreate and manage interactive data visualizations with 92% token reduction through SVG/Canvas optimization and configuration caching
decompress_textDecompress base64-encoded Brotli-compressed text.
expandRetrieve the full output behind a preview reference, served from the local store rather than by re-running anything.
export_analyticsExport all analytics data in JSON or CSV format. Supports filtering by date range, hook phase, tool name, and MCP server. Useful for external analysis, reporting, and data integration.
fleet_auditLook across every project on this machine at once: which projects hold the cost (ranked with dollar figures), which fixes
get_action_analyticsGet detailed token usage analytics broken down by tool/action (Read, Write, Grep, Bash, count_tokens, etc.). Shows which tools consume the most tokens and identifies optimization opportunities for specific operations.
get_cache_statsGet cache statistics including hit rate, compression ratio, and token savings.
get_cachedRetrieve previously cached and optimized text. Returns the original text if found in cache.
get_hook_analyticsGet detailed token usage analytics broken down by hook phase (PreToolUse, PostToolUse, SessionStart, PreCompact, UserPromptSubmit). Shows which hook phases consume the most tokens and where optimization efforts should be focused.
get_mcp_server_analyticsGet detailed token usage analytics broken down by MCP server (token-optimizer, filesystem, github, etc.). Shows which MCP servers are contributing the most to token usage and helps identify cross-server optimization opportunities.
get_optimization_reportGet a provenance-gated token report. Verified savings require a materialized MCP payload before and after optimization; historical and tool-reported estimates are excluded. Direct API-price equivalents use each exact captured model and route; ambiguous operations remain unpriced.
get_session_statsGet comprehensive statistics from the PowerShell wrapper session tracker including system reminders, tool operations, and total tokens with accurate tiktoken-based counting.
health-monitorMonitor health status of systems, services, and applications with dependency tracking. Supports 8 operations: check, register-check, update-check, delete-check, get-status, get-history, configure-dependencies, get-impact. Achieves 87% token reduction through status caching and dependency graph compression.
health_monitorMonitor system and application health with 91% token reduction through health state compression and metric aggregation
install_doctorCheck that this installation actually works. Runs the real hook binaries with synthetic payloads and asserts a large read
intelligent-assistantProvides intelligent assistance including contextual help, suggestions, explanations, and troubleshooting
knowledge_graphBuild and query knowledge graphs with 91% token reduction through intelligent caching. Supports graph building, pattern querying, path finding, community detection, node ranking, relation inference, visualization, and export.
log_dashboardInteractive log analysis dashboard with filtering, searching, pattern detection, and 90% token reduction through intelligent caching and compression
metric_collectorComprehensive metrics collection and aggregation with multi-source support, time-series compression, and 88% token reduction through delta encoding and intelligent caching
model_routingWhich model tier this project's work actually goes better on, measured from episode outcomes in the client transcript
monitoring_integrationExternal monitoring platform integration with 87% token reduction through data compression and intelligent caching
natural-language-queryNatural language query translation and optimization
optimize_sessionAnalyzes operations in the current session from the session JSONL log, identifies large text blocks from file-based tools (Read, Write, Edit), compresses them, and stores them in the cache to reduce future token usage. Returns a summary of the optimization.
optimize_textCompress and cache text to reduce token usage. Returns compressed version and saves to cache for future use.
outcome_reportRecord correctness-first task outcome and deterministic grader evidence.
pattern-recognitionPattern detection and analysis in logs, metrics, and events
performance-trackerTracks and analyzes performance metrics (CPU, memory, response times, throughput) with advanced statistical capabilities. Supports 8 operations: track, query, analyze-trends, forecast, compare, detect-regressions, get-baseline, generate-report. Achieves 89%+ token reduction through intelligent caching and data aggregation.
predictive-analyticsPredictive modeling and forecasting for system metrics
predictive_cacheML-based predictive caching with 91%+ token reduction using ARIMA, exponential smoothing, LSTM, and collaborative filtering
recommendation-engineIntelligent recommendations for optimization and resource allocation
smart-dashboardUnified dashboard management with widget management and multi-source data integration. Supports 8 operations: check, register-check, update-check, delete-check, get-status, get-history, configure-dependencies, get-impact. Achieves 87% token reduction through status caching and dependency graph compression.
smart_api_fetchwrite actionExecute HTTP requests with intelligent caching and retry logic. Features: - Automatic retry with exponential backoff (1s, 2s, 4s, 8s) - Response caching with TTL-based invalidation (default: 5 minutes) - Request deduplication for in-flight requests - Circuit breaker pattern (opens after 5 consecutive failures) - ETag/Cache-Control header support - 83% average token reduction through intelligent ou
smart_ast_grepPerform structural code search with 83% token reduction through AST indexing and caching
smart_branchList and manage git branches with 60% token reduction through structured JSON output and smart filtering
smart_buildwrite actionRun TypeScript build with intelligent caching, diff-based change detection, and token-optimized output
smart_cacheAdvanced multi-tier cache with 90%+ token reduction, 6 eviction strategies, stampede prevention, and automatic tier management
smart_cache_apiAPI Response Caching with 83% token reduction through intelligent cache management. Features: - Multiple caching strategies (TTL, ETag, Event-based, LRU, Size-based) - Intelligent cache key generation with query normalization - Pattern-based and tag-based invalidation - Stale-while-revalidate support - Cache hit rate analysis and recommendations - Cache warming and preloading Actions: - get: Retri
smart_complexityAnalyze code complexity metrics including cyclomatic, cognitive, Halstead, and maintainability index (70-80% token reduction)
smart_config_readRead and parse configuration files (JSON, YAML, TOML) with 83% token reduction through schema-aware caching and intelligent diffing
smart_databaseDatabase query optimizer with connection pooling, circuit breaking, and 83% token reduction. Supports query execution, EXPLAIN analysis, performance optimization, health monitoring, slow query detection, and batch operations.
smart_dependenciesAnalyze project dependencies with 83% token reduction through graph caching and incremental updates
smart_diffGet git diffs with 85% token reduction through diff-only output and smart filtering
smart_dockerDocker operations with build/run/stop/logs support, image layer analysis, and optimization suggestions
smart_editEdit files with 90% token reduction through line-based operations and diff-only output
smart_envSmart environment variable analyzer with security checking and suggestions (83% token reduction)
smart_exportsAnalyze TypeScript/JavaScript export statements with intelligent caching. Tracks exports, detects unused exports, and provides optimization suggestions. Achieves 75-85% token reduction through export analysis summarization.
smart_globSearch files with glob patterns and 75% token reduction through path-only results and smart filtering
smart_graphqlGraphQL query optimizer with complexity analysis and caching (83% token reduction)
smart_grepSearch file contents with 80% token reduction through match-only output and smart filtering
smart_importsAnalyze TypeScript/JavaScript import statements with intelligent caching. Detects unused imports, missing imports, and provides optimization suggestions. Achieves 75-85% token reduction through import analysis summarization.
smart_installPackage installation with dependency analysis, conflict detection, and smart caching for npm/yarn/pnpm
smart_lintwrite actionRun ESLint with intelligent caching, incremental analysis, and auto-fix suggestions
smart_logGet git commit history with 75% token reduction through structured JSON output and smart filtering
smart_logsSystem log aggregation and analysis with multi-source support, pattern filtering, error detection, and insights
smart_mergeManage git merges with 80% token reduction through structured status and conflict management
smart_migrationDatabase migration tracker with status monitoring and 83% token reduction. Supports listing migrations, checking status, viewing history, rollback operations, and migration generation.
smart_networkNetwork diagnostics and monitoring with connectivity testing, port scanning, DNS resolution, and anomaly detection
smart_ormORM query optimizer with N+1 detection (83% token reduction)
smart_package_jsonAnalyze package.json with dependency resolution, version conflict detection, and security scanning. Provides 83% token reduction through intelligent caching.
smart_processesMonitor and analyze system processes with anomaly detection and resource tracking
smart_readRead files with 80% token reduction through intelligent caching, diff-based updates, and syntax-aware optimization
smart_refactorProvides intelligent refactoring suggestions with code examples and impact analysis (75-85% token reduction)
smart_restREST API analyzer with endpoint discovery and health scoring (83% token reduction)
smart_schemaDatabase schema analyzer with intelligent caching and 83% token reduction. Supports PostgreSQL, MySQL, and SQLite. Provides schema introspection, relationship analysis, index recommendations, and schema diff.
smart_securitySecurity vulnerability scanner with pattern detection and intelligent caching (83% token reduction)
smart_sqlSQL query analyzer with optimization suggestions and execution plan analysis (83% token reduction)
smart_statusGet git status with 70% token reduction through status-only output and smart filtering
smart_symbolsExtract and analyze TypeScript/JavaScript symbols with scope, type, and reference information (75-85% token reduction)
smart_system_metricsSystem resource monitoring with CPU, memory, disk usage tracking, anomaly detection, and performance recommendations
smart_testwrite actionRun the project's tests (Jest, Vitest, Mocha, AVA or node --test) with
smart_tsconfigParse and analyze TypeScript configuration with 83% token reduction. Resolves extends chains, detects issues, and caches results for 7 days.
smart_typecheckwrite actionRun TypeScript type checking with intelligent caching and categorized error reporting
smart_typescriptIncremental TypeScript compilation with dependency tracking and intelligent caching (83% token reduction)
smart_websocketWebSocket connection manager with message tracking (83% token reduction)
smart_workflowIntelligent CI/CD workflow file analysis with 83% token reduction. Analyzes GitHub Actions, GitLab CI, CircleCI, and Azure Pipelines workflows with syntax validation, security analysis, and performance recommendations.
smart_writewrite actionWrite files with 85% token reduction through verification, atomic operations, and change tracking
token_auditThe one thing to run. A single ranked queue of what is costing the most in this project -- waste detectors, prompt-cache
waste_auditReport behavioural token waste in this project, ranked by cost per session and compared against the previous week.
Public scan report
scanner v0.1.9 · 2026-09-19 · same rubric, same numbers if you re-run it
- Code scan1333 source files scanned10/25
- –Live reliabilityno gateway calls yet and no remote to proben/a
- –Tool poisoningtools not inspected (local package is not executed); not countedn/a
- Auth qualitylocal package, no credentials required12/15
- Maintenancelast push 0 days ago15/15
- Maintainer identityregistry namespace matches repository owner; GitHub account older than a year8/10
Findings (3)
- mediumnpm install lifecycle script present
install.script - mediumeval / new Function used
exec.evaldist/tools/code-analysis/smart-security.js: …, cwe: 'CWE-327', }, // eval() usage { id: 'unsafe-eval',… - mediumnpm install lifecycle script present
install.scriptpackage.json: … "!**/.env.*" ], "scripts": { "postinstall": "node scripts/postinstall.cjs", "ch…
What the publisher says
From the Token Optimizer repository's README, as published. We do not edit it. Read it on GitHub
Token Optimizer MCP
Compression that optimises your bill, not your byte count — and ships the benchmark so you can check it.
One local ledger for optimizer tools, live-graph substitutions, every agent, and the graph's own cost.
Why it wins
Providers cache the prompt prefix: cached tokens re-read at 0.1x, rewritten ones bill at 1.25x. Most compressors optimise bytes removed and ignore that multiplier. This one optimises the bill.
It wins both columns. Against a faithful reimplementation of the leading open compressor's published design, node bench/compression/proof.mjs:
Raw removal: ours on 7 of 8. Cache-weighted cost: ours on 8 of 8.
The two columns come from different arms of the same engine, and that is the point. v3-history compresses history too and matches them byte for byte; v1-frontier leaves the cached prefix alone and wins the invoice by 11–42%. Maximising bytes removed is available and is not the default, because on a cached prefix it costs money.
The competitor arm is this repository's reimplementation of their published design — opaque hash markers, history compressed, a retrieval tool and system message injected — not their binary, and it is held to the same signed-content guard we hold ourselves to.
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
Grade history
- 2026-09-19restoreD → Cscore 69: npm install lifecycle script present; eval / new Function used; npm install lifecycle script present
Install directly
Runs npx -y @ooples/token-optimizer-mcp on your machine. Read the scan report first; the gateway never runs local packages.
claude mcp add token-optimizer-mcp -- npx -y @ooples/token-optimizer-mcp
Token Optimizer: common questions
- Is Token Optimizer MCP server safe?
- With care: it is graded C, so read the findings first (69/100). Read the Token Optimizer safety report
- How do I install Token Optimizer?
- It runs on your machine. Copy the Claude Code, Claude Desktop or Cursor config from the install section.
- Does Token Optimizer need an API key?
- No secret keys are declared. It reads 1 setting from the environment.
- Is Token Optimizer maintained?
- The last commit was in the last day (2026-09-19). The latest release is v7.2.0.
- What can I use instead of Token Optimizer?
- Servers from other publishers that do the same job: Visual Memory MCP server.
Alternatives to Token Optimizer
Same job from other publishers: the closest match first, then the best rated.
Visual Memory MCPLocal visual UI cache for AI agents using perceptual hashing + CLIP to cut vision token use.not reviewedEstablishedA