1. Conduid
  2. Data
  3. ooples/token-optimizer-mcp
MCP server · Data

ooples/token-optimizer-mcp

91.5% fewer tokens on tool output on Headroom's own benchmark, where Headroom removes 61.4%. Separately, the same SWE-bench tasks resolved at 0.71x the cost of plain Claude Code. Plus memory across sessions and subscription quota pacing. Claude Code, Codex, Copilot, Gemini and 12 more. Local, MIT.

Unclaimed MIT data
82Strong

Scored 20 hours ago · breakdown

About ooples/token-optimizer-mcp

ooples/token-optimizer-mcp is an MCP server published by ooples in the Data category: 91.5% fewer tokens on tool output on Headroom's own benchmark, where Headroom removes 61.4%. Separately, the same SWE-bench tasks resolved at 0.71x the cost of plain Claude Code. Plus memory across sessions and subscription quota pacing. Claude Code, Codex, Copilot, Gemini and 12 more. Local, MIT. Conduid read 45 tools from its source: analyze_optimization, analyze_project_tokens, cache_analytics, cache_audit, cache_benchmark, cache_compression and 39 more. It is published to npm as @ooples/token-optimizer-mcp and starts with npx.

The repository has 598 stars and 76 forks, is licensed MIT, and its last commit was on 1 Dec 2026. The latest release is v7.11.0 (14 Nov 2026): Features make agents cheap - cache ttl, agent overhead, spawn costs (#567) (#568) (6a7b75e) Documentation shorten the readme and tidy the repository root (#562) (e7e29ad… It follows v7.10.0 (11 Nov 2026), and the 5 most recent releases go back to v7.7.1 (26 Oct 2026). It passes 4 of the 6 static checks Conduid ran on the repository; it does not pass No dynamic code execution and Scoped permissions. Its topics include data.

Install

Claude Code
claude mcp add token-optimizer-mcp -- npx -y @ooples/token-optimizer-mcp@latest
Run
npx -y @ooples/token-optimizer-mcp@latest
From source
git clone https://github.com/ooples/token-optimizer-mcp

Tools (45)

analyze_optimizationAnalyze text and provide recommendations for optimization including compression benefits and token savings.
ParameterTypeDescription
text *stringText to analyze
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.
ParameterTypeDescription
costPerMillionTokensnumberOptional effective USD cost per million input tokens. No provider price is assumed when omitted.
endDatestringOptional end date filter (YYYY-MM-DD format).
projectPathstringPath to the project directory. If not provided, uses the hooks data directory.
startDatestringOptional start date filter (YYYY-MM-DD format).
cache_analyticsComprehensive cache analytics with an unmeasured design target of 88%+ token reduction. Real-time dashboards, trend analysis, alerting, heatmaps, bottleneck detection, and cost optimization.
ParameterTypeDescription
aggregationstringAggregation method for metrics
alertConfigobjectAlert configuration
alertTypestringType of alert to check
cacheTTLnumberCache TTL in seconds (default: 30)
compareWithstringPeriod to compare trends with
filePathstringFile path for data export
formatstringExport data format
granularitystringTime granularity for aggregation
heatmapTypestringType of heatmap to generate
metricTypesarrayTypes of metrics to collect
operation *stringAnalytics operation to perform
resolutionstringHeatmap resolution
thresholdnumberThreshold value for alerts
timeRangeobjectTime range for analysis
trendTypestringType of trend analysis
useCachebooleanEnable caching of analytics results (default: true)
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 - Workload simulation (read-heavy, write-heavy, mixed, realistic) Operations: - run-benchmark: Execute complete benchmark suite - compare: Compare multiple cache configurations - load-test: Stress test cache under load - latency-test: Measure latency distribution with percentiles - throughput-test: Measure throughput limits - report: Generate comprehensive benchmark report Token Reduction: - Benchmark results: ~89% (summary only) - Comparison: ~91% (rankings + winner) - Load test: ~88% (summary + breaking point) - Latency test: ~87% (percentiles only) - Throughput test: ~90% (key metrics only) - Report: ~85% (formatted summary) - Average: 89% reduction
ParameterTypeDescription
benchmarkIdstringID of benchmark results to generate report for
cacheTTLnumberCache TTL in seconds (default: 604800 - 7 days)
concurrencynumberNumber of concurrent workers (default: 10)
configobjectCache configuration for single benchmark
configsarrayMultiple cache configurations for comparison
durationnumberBenchmark duration in seconds (default: 60)
formatstringReport format (default: markdown)
includeChartsbooleanInclude charts in report
maxConcurrencynumberMaximum concurrency for load test (default: 100)
operation *stringBenchmark operation to perform
outputPathstringPath to save report
percentilesarrayPercentiles to measure (default: [50, 90, 95, 99])
rampUpnumberRamp-up time in seconds (for load-test)
resultsPathstringFile to write the benchmark results to, in addition to returning them
stepSizenumberConcurrency step size for load test (default: 10)
targetTPSnumberTarget transactions per second
useCachebooleanCache benchmark results (default: true)
warmupDurationnumberWarmup duration in seconds (default: 10)
workloadobjectShape of the synthetic load to run. Every field is optional.
workloadRatioobjectCustom read/write ratio
workloadTypestringType of workload to simulate
cache_compressionAdvanced compression strategies for cache optimization with an unmeasured design target of 89%+ token reduction. Supports 6 algorithms (gzip, brotli, lz4, zstd, snappy, custom), adaptive selection, dictionary-based compression, and delta compression for time-series data.
ParameterTypeDescription
algorithmstringCompression algorithm (auto-selected if not specified)
algorithmsarrayAlgorithms to benchmark
autoSelectbooleanEnable auto-selection of algorithm based on data type
cacheTTLnumberCache TTL in seconds
dataanyData to compress/decompress/analyze
dataTypestringData type hint for adaptive compression
defaultAlgorithmstringDefault algorithm for configure operation
enableDeltabooleanEnable delta compression for time-series data
includeMetricsbooleanInclude per-algorithm ratio and timing metrics in the result
iterationsnumberNumber of benchmark iterations
levelnumberCompression level (0-9, higher = better compression)
maxLatencynumberMaximum acceptable latency in milliseconds
operation *stringCompression operation to perform
sampleSizenumberBytes of the input to sample when choosing an algorithm, instead of measuring all of it
targetRationumberTarget compression ratio for optimize operation (0-1)
testDataanyData to compress for a benchmark or analysis operation. Any JSON value; a string is used as-is and anything else is serialised first.
useCachebooleanEnable caching of analysis/benchmark results
workloadTypestringWorkload type for optimization
cache_invalidationComprehensive cache invalidation with an unmeasured design target of 88%+ token reduction, dependency tracking, pattern matching, scheduled invalidation, and distributed coordination
ParameterTypeDescription
broadcastToNodesbooleanBroadcast invalidation to distributed nodes
cacheTTLnumberCache TTL in seconds (default: 300)
cascadeDepthnumberMaximum depth for dependency cascade (default: 10)
childKeystringChild key for dependency relationship
childKeysarrayArray of child keys for dependency relationship
cronExpressionstringCron expression for scheduled invalidation
enableAuditbooleanEnable audit logging (default: true)
executeAtnumberTimestamp when to execute invalidation
keystringCache key to invalidate
keysarrayArray of cache keys to invalidate
maxAuditEntriesnumberMaximum audit log entries to keep (default: 10000)
modestringInvalidation mode
nodeIdstringNode ID for distributed coordination
operation *stringThe cache invalidation operation to perform
parentKeystringParent key for dependency relationship
patternstringPattern for matching keys (wildcards: * for any chars, ? for single char)
repeatIntervalnumberInterval in ms for repeating scheduled invalidation
revalidateOnInvalidatebooleanTrigger revalidation after invalidation
scheduleIdstringID of scheduled invalidation
skipExpiredbooleanSkip expired entries during validation (default: true)
strategystringInvalidation strategy
tagstringTag to invalidate all associated keys
tagsarrayArray of tags to invalidate
useCachebooleanEnable result caching (default: true)
cache_optimizerAdvanced cache optimization with an unmeasured design target of 89%+ token reduction. Analyzes performance, benchmarks strategies, provides ML-based recommendations, detects bottlenecks, and performs cost-benefit analysis.
ParameterTypeDescription
analysisWindownumberTime window in milliseconds for analysis (default: 3600000)
cacheTTLnumberCache TTL in seconds (default: 300)
constraintsobjectHard limits the recommendation must respect
currentConfigobjectFull cache configuration in use now
currentStrategystringEviction strategy in use now, used as the comparison baseline
epochsnumberNumber of training epochs for tuning (default: 50)
includeBottlenecksbooleanInclude the identified bottlenecks rather than the summary alone
includeChartsbooleanEmbed charts in a markdown or html report
includePredictionsbooleanInclude forecast figures alongside the current measurements
includeRecommendationsbooleanInclude the recommended changes, not just the measurements
iterationsnumberHow many times to repeat a simulation or tuning pass
learningRatenumberStep size for the adaptive tuner; larger converges faster and overshoots
objectivestringOptimization objective (default: balanced)
operation *stringThe optimization operation to perform
reportFormatstringFormat for a report operation
simulationDurationnumberSimulated time span in seconds
strategiesarrayEviction strategies to benchmark
targetConfigobjectFull cache configuration to evaluate against the current one
targetStrategystringEviction strategy to evaluate against the current one
tuningMethodstringML tuning method (default: bayesian)
useCachebooleanEnable result caching (default: true)
workloadPatternstringWorkload pattern for benchmarking
workloadSizenumberNumber of synthetic operations to model when simulating a workload
cache_partitionAdvanced cache partitioning and sharding with an unmeasured design target of 87%+ token reduction through consistent hashing, automatic rebalancing, and partition isolation
ParameterTypeDescription
cacheTTLnumberCache TTL in seconds (default: 300)
includeKeyDistributionbooleanInclude key distribution in statistics (default: true)
includeMemoryUsagebooleanInclude memory usage in statistics (default: true)
keyPatternstringRegex pattern for keys to migrate
maxMigrationsnumberMaximum number of migrations during rebalance (default: 1000)
operation *stringThe partition operation to perform
partitionFunctionstringCustom partition function (JavaScript code)
partitionIdstringPartition identifier (required for create/delete operations)
shardingStrategystringSharding strategy configuration
sourcePartitionstringSource partition for migration
strategystringPartitioning strategy (default: hash)
targetDistributionstringTarget distribution strategy for rebalancing (default: even)
targetPartitionstringTarget partition for migration
useCachebooleanEnable result caching (default: true)
virtualNodesnumberNumber of virtual nodes per partition (default: 150)
cache_replicationDistributed cache replication with an unmeasured design target of 88%+ token reduction. Supports primary-replica and multi-primary modes, strong/eventual consistency, automatic conflict resolution, failover, incremental sync, and health monitoring.
ParameterTypeDescription
cacheTTLnumberCache TTL in seconds (default: 300)
conflictResolutionstringConflict resolution strategy (for configure operation)
conflictsarrayConflicts to resolve, for a resolve operation. Each entry names the key and the competing local and remote entries.
consistencystringConsistency model (for configure operation)
deltaOnlybooleanSync only delta changes (for sync operation)
enableCompressionbooleanCompress replicated payloads before sending them to peers
endpointstringNode endpoint URL (for add-replica operation)
forcebooleanForce sync even if up-to-date (for sync operation)
heartbeatIntervalnumberHeartbeat interval in milliseconds (for configure operation)
includeMetadatabooleanInclude snapshot data in response (for snapshot operation)
modestringReplication mode (for configure operation)
nodeIdstringNode ID (for add-replica/remove-replica operations)
operation *stringReplication operation to perform
readQuorumnumberNumber of replicas required for reads (for configure operation)
regionstringRegion name (for add-replica operation)
snapshotIdstringSnapshot ID (for restore operation)
syncIntervalnumberSync interval in milliseconds (for configure operation)
targetNodeIdstringTarget node ID (for promote-replica operation)
useCachebooleanEnable result caching (default: true)
weightnumberNode weight for load balancing (for add-replica operation)
writeQuorumnumberNumber of replicas required for writes (for configure operation)
cache_warmupIntelligent cache pre-warming with an unmeasured design target of 87%+ token reduction, featuring schedule-based warming, pattern analysis, dependency resolution, and progressive warming strategies
ParameterTypeDescription
accessHistoryarrayAccess history for pattern-based warmup
batchSizenumberBatch size for warmup (default: 50)
cacheTTLnumberCache TTL in seconds (default: 300)
categoriesarrayCategories to warm (for selective operation)
dataSourceobjectWhere to fetch values from when warming keys that are not cached
delayBetweenBatchesnumberDelay between batches in ms
dependenciesobjectDependency graph for dependency-based warmup
dryRunbooleanSimulate warmup without executing (default: false)
enableRollbackbooleanEnable rollback on failures (default: true)
endTimenumberEpoch milliseconds after which a scheduled warmup stops
hotKeyThresholdnumberMinimum access count for hot keys
keysarrayKeys to warm (for immediate/selective operations)
maxConcurrencynumberMax concurrent warmup operations (default: 10)
maxRetriesnumberMaximum retry attempts (default: 3)
minAccessCountnumberMinimum access count for hot keys (default: 5)
operation *stringThe warmup operation to perform
patternstringRegex pattern for key matching
prioritystringWarmup priority (default: normal)
progressIntervalnumberProgress report interval in ms
reportProgressbooleanEnable progress reporting (default: true)
resolveDependenciesbooleanWarm each key’s dependencies first, in graph order, rather than the listed keys alone
retryDelaynumberDelay between retries in ms
schedulestringCron expression for scheduled warmup (e.g., '0 * * * *' for hourly)
scheduleIdstringSchedule ID for cancel operation
startTimenumberEpoch milliseconds at which a scheduled warmup becomes active
strategystringWarmup strategy (default: progressive)
timeWindownumberTime window for pattern analysis in ms (default: 3600000)
timeoutnumberTimeout for warmup operations in ms (default: 30000)
useCachebooleanEnable result caching (default: true)
validateBeforeCommitbooleanCheck each fetched value before writing it into the cache
warmupPercentagenumberPercentage of cache to warm (default: 80)
checkpoint_handoffCreate or restore a resumable checkpoint and return a takeover receipt.
ParameterTypeDescription
boundarystring
checkpoint *object
consumerstring
currentStateobject
operation *string
clear_cacheClear all cached data. Use with caution.
ParameterTypeDescription
confirm *booleanMust be true to confirm cache clearing
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.
ParameterTypeDescription
evidenceReceipts *arrayReceipts signed by the configured external deterministic grader. Models must pass them unchanged.
kindstring
operationstringverify-evidence is read-only and returns authenticated observations; record compiles and persists model-authored cognition.
semanticObjectobjectCompact model-authored delta. Always include trigger, applicability, nonApplicability, invalidators, scope, confidence, confidenceLabel, and expectedOutcome. A failure/guard also includes attemptedAction, observedFailure, rootCause, correction, and verificationEvidence. Other kinds include their kind-specific evidence fields. The server validates the complete contract and rejects omissions.
sessionIdstring
taskIdstring
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.
ParameterTypeDescription
qualitynumberCompression quality (0-11, default 11)
text *stringText to compress
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.
ParameterTypeDescription
currentContentstringThe file as it stands now. Required for compute-delta and seed.
filePath *stringFile being tracked. Required by every operation.
operation *stringcompute-delta: diff currentContent against the last snapshot. seed: record a baseline without producing a diff. clear: forget the snapshot for this file.
sessionId *stringSession the snapshot belongs to. Required by every operation.
context_pageObtain bounded decision-specific cognition. Returns an explicit empty result when nothing safe applies.
ParameterTypeDescription
budgetnumber
query *stringThe current decision or question.
sessionIdstring
taskIdstring
triggerstring
context_receipt_verifyVerify that one adapter-delivered context receipt and its correction trace to authenticated external grader evidence.
ParameterTypeDescription
deliveryEventId *stringThe delivery receipt ID supplied by the host adapter.
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).
ParameterTypeDescription
modelNamestringModel name (e.g. gpt-4, claude-opus-4-7, gemini-2.5-flash). Defaults to the server-configured model when omitted.
text *stringText to count tokens for
decompress_textDecompress base64-encoded Brotli-compressed text.
ParameterTypeDescription
compressed *stringBase64-encoded compressed text
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.
ParameterTypeDescription
endDatestringOptional end date filter in ISO 8601 format (e.g., 2025-12-31T23:59:59Z)
format *stringOutput format: json or csv
hookPhasestringOptional filter by hook phase
mcpServerstringOptional filter by MCP server name
startDatestringOptional start date filter in ISO 8601 format (e.g., 2025-01-01T00:00:00Z)
toolNamestringOptional filter by tool/action name
fleet_auditLook across every project on this machine at once: which projects hold the cost (ranked with dollar figures), which fixes proven in one project apply to others containing the SAME FILE CONTENTS, and how enforcing clients compare with directive ones as a natural experiment (reported with its confound). Reads transcripts and graphs locally, uploads nothing, and names every directory it opened. Use dryRun=true to see what it would read before it reads anything; mode="explicit" with `projects` to scan only what you name.
ParameterTypeDescription
dryRunbooleanList what would be read, and read nothing
excludearraySubstrings to skip
limitnumberMaximum projects in enumerate mode
modestringenumerate (default, bounded), all (no cap), explicit (only what you list)
projectsarrayProject directories, for explicit mode
sessionsPerMonthnumberAssumption behind monthly figures. Default 60
tierstringPricing tier for dollar figures. Default opus
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.
ParameterTypeDescription
endDatestringOptional end date filter in ISO 8601 format (e.g., 2025-12-31T23:59:59Z)
startDatestringOptional start date filter in ISO 8601 format (e.g., 2025-01-01T00:00:00Z)
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.
ParameterTypeDescription
key *stringCache key to retrieve
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.
ParameterTypeDescription
endDatestringOptional end date filter in ISO 8601 format (e.g., 2025-12-31T23:59:59Z)
startDatestringOptional start date filter in ISO 8601 format (e.g., 2025-01-01T00:00:00Z)
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.
ParameterTypeDescription
endDatestringOptional end date filter in ISO 8601 format (e.g., 2025-12-31T23:59:59Z)
startDatestringOptional start date filter in ISO 8601 format (e.g., 2025-01-01T00:00:00Z)
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.
ParameterTypeDescription
endDatestringOptional end date filter in ISO 8601 format (e.g., 2025-12-31T23:59:59Z)
sessionIdstringOptional session ID to scope the report to a single session.
startDatestringOptional start date filter in ISO 8601 format (e.g., 2025-01-01T00:00:00Z)
topNintegerLimit each breakdown to the top N rows by tokens saved (default: 10).
get_session_statsGet comprehensive statistics from the PowerShell wrapper session tracker including system reminders, tool operations, and total tokens with accurate tiktoken-based counting.
ParameterTypeDescription
sessionIdstringOptional session ID to query. If not provided, uses current session.
install_doctorCheck that this installation actually works. Runs the real hook binaries with synthetic payloads and asserts a large read is refused and a small one is not, that session-start emits the policy, and that the graph directory is writable and private -- rather than checking that config files exist, which can pass while the plugin saves nothing. Every failure names its fix. Pass uninstallPlan=true to see exactly what a removal would delete and what it would refuse to touch.
ParameterTypeDescription
clientstringDiagnose this client instead of the one that opened the session (for example "codex"). Defaults to the client named in the MCP handshake.
uninstallPlanbooleanShow what uninstall would remove, changing nothing
model_routingWhich model tier this project's work actually goes better on, measured from episode outcomes in the client transcript rather than guessed from task size. Reports expected cost per tier including retries, and prices BOTH mistakes: what an overpowered model wastes and what an underpowered one costs in retries. Pass `shape` (multi-file-change, single-file-change, investigation, build-or-test, conversation) and `currentModel` for a decision note that also states what switching would cost in discarded prompt cache.
ParameterTypeDescription
currentModelstringThe model in use now, e.g. claude-sonnet-5
shapestringThe kind of work about to be done
optimization_storagePersist and retrieve brotli-compressed optimization results keyed by text hash. Operations: store, retrieve.
ParameterTypeDescription
operation *stringstore: persist an optimization result. retrieve: read one back by hash.
optimizedTextstringThe optimized text to store. Required for store.
optimizedTokensnumberToken count after optimization. Required for store.
originalTextHash *stringStable hash of the original uncompressed text. Required by both operations.
originalTokensnumberToken count of the original text. Required for store.
tokensSavednumberTokens saved by optimization. Required for store.
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.
ParameterTypeDescription
min_token_thresholdnumberMinimum token count for a file operation to be considered for compression. Defaults to 30.
sessionIdstringOptional session ID to optimize. If not provided, uses the current active session.
optimize_textCompress and cache text to reduce token usage. Returns compressed version and saves to cache for future use.
ParameterTypeDescription
key *stringCache key for storing the optimized text
qualitynumberCompression quality (0-11, default 11)
text *stringText to optimize
outcome_reportRecord correctness-first task outcome and deterministic grader evidence.
ParameterTypeDescription
episodeId *string
graderReceipt *object
outcome *object
sessionIdstring
taskIdstring
predictive_cacheML-based predictive caching with an unmeasured design target of 91%+ token reduction using ARIMA, exponential smoothing, LSTM, and collaborative filtering
ParameterTypeDescription
cacheTTLnumberCache TTL in seconds (default: 300)
compressbooleanCompress model export (default: true)
confidencenumberMinimum confidence threshold (default: 0.7)
epochsnumberNumber of training epochs (default: 10)
horizonnumberPrediction horizon in seconds (default: 60)
keystringCache key (for record-access and get-patterns)
learningRatenumberLearning rate for training (default: 0.01)
maxPredictionsnumberMaximum predictions to return (default: 100)
metadataobjectArbitrary key/value context stored alongside the entry and available to the predictor
modelFormatstringModel export format (default: json)
modelPathstringPath to model file (for export/import)
modelTypestringModel type (default: hybrid)
operation *stringThe predictive cache operation to perform
timestampnumberAccess timestamp (for record-access)
trainDataarrayTraining data (for train operation)
useCachebooleanEnable result caching (default: true)
warmBatchSizenumberNumber of keys to warm (default: 50)
warmStrategystringCache warming strategy (default: adaptive)
smart_api_fetchExecute 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 output formatting Token Reduction Strategy: - Cached responses: 95% reduction (summary only) - Error responses: 90% reduction (error details only) - Retried requests: 85% reduction (success summary with retry info) - First requests: 80% reduction (compact summary) Perfect for: - API integration and testing - Webhook handling - External service communication - Data fetching with resilience
ParameterTypeDescription
bodyanyRequest body for POST/PUT/PATCH (optional)
followRedirectsbooleanFollow HTTP redirects (default: true)
forcebooleanForce fresh request, ignore cache (default: false)
headersobjectRequest headers (optional)
includeFullResponsebooleanReturn the full response body alongside the compacted summary (default: false)
maxRetriesnumberMaximum retry attempts (default: 3)
method *stringHTTP method
parseJsonbooleanParse response as JSON (default: true)
timeoutnumberRequest timeout in milliseconds (default: 30000)
ttlnumberCache TTL in seconds (default: 300)
url *stringRequest URL
smart_cacheAdvanced multi-tier cache with an unmeasured design target of 90%+ token reduction, 6 eviction strategies, stampede prevention, and automatic tier management
ParameterTypeDescription
cacheTTLnumberCache TTL in seconds (default: 300)
compressionEnabledbooleanCompress entries before storing them
defaultTTLnumberDefault TTL in milliseconds (for configure operation)
evictionStrategystringEviction strategy (for configure operation)
exportDeltabooleanExport only changes since last snapshot (for export operation)
importDatastringJSON data to import (for import operation)
keystringCache key (for get/set/delete/promote/demote operations)
keysarrayArray of keys (for batch-get operation)
l1MaxSizenumberMaximum L1 cache size (for configure operation)
l2MaxSizenumberMaximum L2 cache size (for configure operation)
metadataobjectArbitrary key/value context stored alongside the entry
operation *stringThe cache operation to perform
targetTierstringTarget tier (for promote/demote operations)
tierstringCache tier (for set operation, default: L1)
ttlnumberTime-to-live in milliseconds
useCachebooleanEnable result caching (default: true)
valuestringValue to store (for set operation)
valuesarrayArray of key-value pairs (for batch-set operation)
writeModestringWrite mode (for configure operation)
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: Retrieve cached API response - set: Cache an API response - invalidate: Remove cached entries (pattern/tag/manual) - analyze: Get cache performance metrics - warm: Pre-cache specific endpoints Token Reduction: - Cache hit: ~95% (summary only) - Cache miss: 0% (full response) - Stale cache: ~95% (stale summary) - Invalidation: ~98% (count only) - Analysis: ~90% (statistics only) - Average: 83% reduction
ParameterTypeDescription
action *stringCache operation to perform
endpointsarrayEndpoints to warm (for warm action)
ignoreHeadersarrayHeaders to exclude from cache key
includeDetailsbooleanInclude per-entry detail rather than totals only
invalidationPatternstringInvalidation pattern to use
maxCacheSizenumberMaximum cache size in bytes
maxEntriesnumberMaximum number of cache entries
normalizeQuerybooleanNormalize query parameters (default: true)
patternstringURL pattern for invalidation (e.g., /api/users/*)
requestobjectAPI request data (for get/set)
responseanyAPI response data (for set)
sincestringOnly entries created or updated after this ISO-8601 timestamp
staleTimenumberTime before considering cache stale (seconds)
staleWhileRevalidatebooleanEnable stale-while-revalidate
strategystringCaching strategy to use
tagsarrayTags for grouping cached entries
ttlnumberTime-to-live in seconds (default: 3600)
smart_databaseDatabase query optimizer with connection pooling, circuit breaking, and an unmeasured design target of 83% token reduction. Supports query execution, EXPLAIN analysis, performance optimization, health monitoring, slow query detection, and batch operations.
ParameterTypeDescription
actionstringAction to perform (default: query)
analyzeIndexUsagebooleanReport which indexes the query used, and which were available but unused
batchSizenumberBatch size for batch operations (default: 100)
circuitBreakerThresholdnumberConsecutive failures before the breaker opens
circuitBreakerTimeoutnumberMilliseconds the breaker stays open before retrying
connectionStringstringFull connection string. Takes precedence over the individual host/port/database fields.
connectionTimeoutnumberMilliseconds to wait for a connection before failing
databasestringDatabase name
detectN1booleanFlag repeated similar queries that look like an N+1 pattern
enableCachebooleanEnable query result caching (default: true)
enableCircuitBreakerbooleanEnable circuit breaker pattern (default: true)
enableRetrybooleanEnable automatic retry on failure (default: true)
enginestringDatabase engine (default: generic)
explainbooleanAttach the query plan for a SELECT
forcebooleanForce fresh query, bypassing cache (default: false)
hoststringDatabase host
idleTimeoutnumberMilliseconds an idle connection is kept before being closed
includeMetadatabooleanInclude column types and row counts alongside the rows
limitnumberMaximum rows to return (default: 10)
maxPoolSizenumberMaximum pool size (default: 20)
maxRetriesnumberMaximum retry attempts (default: 3)
minPoolSizenumberConnections kept open even when idle
parallelBatchesnumberNumber of parallel batch operations (default: 4)
paramsarrayQuery parameters for prepared statements
passwordstringPassword. Prefer a connection string sourced from the environment over passing this in a tool call, which puts the secret in the transcript.
poolSizenumberConnection pool size (default: 10)
portnumberDatabase port
queriesarrayArray of queries for batch execution
querystringSQL query to execute (required for query/explain/analyze/optimize)
slowQueryThresholdnumberSlow query threshold in milliseconds (default: 1000)
timeoutnumberQuery timeout in milliseconds (default: 30000)
ttlnumberCache TTL in seconds (default: 300)
userstringUsername
smart_graphqlGraphQL query optimizer with complexity analysis and caching (unmeasured design target: 83% token reduction)
ParameterTypeDescription
analyzeComplexitybooleanEnable complexity analysis (default: true)
detectN1booleanDetect N+1 query problems (default: true)
endpointstringGraphQL endpoint for schema introspection (optional)
forcebooleanForce fresh analysis (bypass cache)
operationNamestringOperation name (optional)
query *stringGraphQL query to analyze
suggestOptimizationsbooleanSuggest query optimizations (default: true)
ttlnumberCache TTL in seconds (default: 300)
variablesobjectQuery variables (optional)
smart_migrationDatabase migration tracker with status monitoring and an unmeasured design target of 83% token reduction. Supports listing migrations, checking status, viewing history, rollback operations, and migration generation.
ParameterTypeDescription
actionstringAction to perform (default: list)
directionstringMigration direction for rollback (default: down)
forcebooleanForce fresh analysis, bypassing cache
limitnumberMaximum number of results (default: 20 for list/pending, 50 for history)
migrationIdstringMigration ID (required for rollback and generate actions)
ttlnumberCache TTL in seconds (default: 3600)
smart_ormORM query optimizer with N+1 detection (unmeasured design target: 83% token reduction)
ParameterTypeDescription
analyzeRelationshipsbooleanAnalyze relationship patterns (default: false)
detectN1booleanDetect N+1 query problems (default: true)
estimateQueriesbooleanEstimate generated SQL queries (default: false)
forcebooleanForce fresh analysis, bypass cache (default: false)
modelDefinitionsstringOptional schema/model definitions for enhanced analysis
ormCode *stringORM query code to analyze (Prisma, TypeORM, Sequelize, Mongoose)
ormType *stringORM framework type
suggestEagerLoadingbooleanSuggest eager loading optimizations (default: true)
ttlnumberCache TTL in seconds (default: 3600)
token_auditThe one thing to run. A single ranked queue of what is costing the most in this project -- waste detectors, prompt-cache invalidation attributed to a file and line, and model routing -- each priced per session and per month, each naming how to act on it. Reports what already-applied fixes actually saved, whether habits improved since the advice, and its own token cost; findings worth less than their printing cost are withheld unless full=true. Pass decline="<id>" to stop being told about something.
ParameterTypeDescription
declinestringA finding id you do not want raised again
fullbooleanShow every finding, including ones cheaper than printing them
sessionsPerMonthnumberAssumption behind the monthly figures. Default 60
tierstringPricing tier for the dollar figures (haiku, sonnet, opus). Default opus
waste_auditReport behavioural token waste in this project, ranked by cost per session and compared against the previous week. Detectors are a shipped floor plus patterns derived from this project's own history, each carrying what it has actually saved. Use action="apply" to put the fixes we own into force (reversible and measured), or action="revert" with an id to undo one. Changes to your own files are only ever proposed as a diff.
ParameterTypeDescription
actionstringDefault "report"
idstringRule id, required for revert and optional for apply

Security checks

Static checks derived from the repository 2 days ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository's README runs to about 2.6K words.
  • ✓License declaredThe repository declares the MIT license.
  • ✓Tests presentA test suite exists in the repository.
  • ✓Dependencies pinnedDependency versions are pinned by package-lock.json.
  • !No dynamic code executionScanned 1.5K source files and found 26 calls to eval or shell execution, in src/hooks-core/harvest.mjs:720, src/hooks-core/toolprune.mjs:749 and src/integrations/cline/hooks/token-optimizer/lib/harvest.mjs:722 among others. Review how tool inputs reach them before granting credentials.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

What the source scan found

Transport
stdiosrc/server/mcp-server.ts:9
Starts other programs
238 callssrc/cli-wrapper.mjs:118, src/hooks-core/ask.mjs:23, src/hooks-core/codexprune.mjs:366
Outbound network calls
33 callssrc/core/summarization.ts:130, src/core/summarization.ts:216, src/core/tokenizers/google-ai-tokenizer.ts:69
Writes or deletes files
12 callssrc/analytics/analytics-storage.ts:66, src/core/cache-engine.ts:260, src/core/cache-engine.ts:286
Lockfile
package-lock.json

Pattern matches on the source text of 1516 files: places to read, not proof of what the code does at run time.

Releases

v7.11.0v7.11.0 · 14 Nov 20267.11.0 (2026-11-14) Features make agents cheap - cache ttl, agent overhead, spawn costs (#567) (#568) (6a7b75e) Documentation shorten the readme and tidy the repository root (#562) (e7e29ad) tidy the root, compare competitors like for…
v7.10.0v7.10.0 · 11 Nov 20267.10.0 (2026-11-11) Features hooks: learned cost control - tool pruning, loop guard, context holdout, quota pacing (#559) (9149834) Bug Fixes plugin: run hooks without a shell and fail open, so a missing node or Git Bash cannot lock the…
v7.9.0v7.9.0 · 4 Nov 20267.9.0 (2026-11-04) Features cli,hooks: add CLI subcommand dispatcher, Subscription Usage Maximizer stop-hook continuation, and project-level MSBuild/NuGet diagnostic deduplication (#556) (5b2fa0b) hooks: add Antigravity CLI (agy) camelCase…
v7.8.0v7.8.0 · 31 Oct 20267.8.0 (2026-10-31) Features hooks: measured multi-agent token waste and the top three compaction fixes (#535) (9be0782) hooks: schema-gated switch to the installed runtime mid-session (#536) (7c2396d) store: maintenance mode, migration and…
v7.7.1v7.7.1 · 26 Oct 20267.7.1 (2026-10-26) Bug Fixes validation: build and refuse unknown arguments under zod 4 (#531) (070ce1b)

README

The repository's README runs to about 2.6K words, fetched 2 days ago. The original in the repository is authoritative.

Read full README
Questions

About ooples/token-optimizer-mcp

How do I install ooples/token-optimizer-mcp?

In Claude Code, run claude mcp add token-optimizer-mcp -- npx -y @ooples/token-optimizer-mcp@latest. Other MCP clients take the command after "--" in their server configuration.

Is ooples/token-optimizer-mcp safe to use with an AI agent?

Its trust score is 82 out of 100 (strong). It passes 4 of the 6 static checks Conduid ran on the repository; it does not pass No dynamic code execution and Scoped permissions. Conduid's scan of 1.5K source files found that it serves MCP over stdio, starts other programs (238 calls), makes outbound network calls (33 calls) and writes or deletes files (12 calls). Its dependencies are pinned by package-lock.json. It has no ConduID identity yet, so agent calls to it are not receipted.

Is ooples/token-optimizer-mcp still maintained?

Yes — the latest release is v7.11.0 (14 Nov 2026), and the last commit was yesterday. The repository has 598 stars and 16 open issues.

What tools does ooples/token-optimizer-mcp provide?

Conduid read 45 tools from the source: analyze_optimization, analyze_project_tokens, cache_analytics, cache_audit, cache_benchmark, cache_compression, cache_invalidation, cache_optimizer and 37 more. 43 of them publish their parameters, listed under Tools above.

What license is ooples/token-optimizer-mcp released under?

The repository declares the MIT license. That applies to the latest release, v7.11.0, as well.