ooples avatar

Token Optimizer Mcp

ooples/token-optimizer-mcp

This is a token reduction layer that sits between Claude and your file system, API calls, and development tools. It replaces standard MCP tools like read_file and grep with cached, compressed alternatives that store content in SQLite and return only diffs on subsequent calls. The 80+ tools cover file operations, API fetching with TTL-based caching, database queries, test runners, and multi-tier cache management with LRU/LFU eviction. Real production data shows 60-90% token reduction across operations. You'd reach for this when you're hitting context limits on large codebases or repeatedly fetching the same API responses, and you want automatic optimization without changing your workflow.

GitHub stars
578
tools
7
transport
STDIO
env var
1
last updated
Nov 11, 2026

Tools

7 tools

Public tool metadata for what this MCP can expose to an agent.

proxy_chatSend a chat completion request through PromptThin's cost-saving proxy. Five optimization routes are applied automatically: (A) semantic cache, (B) prompt compression via LLMLingua 2, (C) model routing to cheaper models, (D) context pruning at 8K tokens, (E) thinking budget cap...4 params

Send a chat completion request through PromptThin's cost-saving proxy. Five optimization routes are applied automatically: (A) semantic cache, (B) prompt compression via LLMLingua 2, (C) model routing to cheaper models, (D) context pruning at 8K tokens, (E) thinking budget cap...

Parameters* required
max_tokensinteger
Maximum tokens to generate. Higher values allow longer responses but cost more.default: 1000
messagesarray
Conversation messages in OpenAI chat format. Each message needs a 'role' and 'content'.
modelstring
The LLM model to use. Examples: 'gpt-4o', 'gpt-4o-mini' (OpenAI), 'claude-sonnet-4-6' (Anthropic), 'gemini-2.5-flash' (Gemini), 'llama-3.1-8b-instant' (Groq).
temperaturenumber
Controls randomness (0.0 = deterministic, 2.0 = very random). Lower for factual tasks, higher for creative.default: 0.7
proxy_predictEstimate cost savings BEFORE making a real LLM call — completely free, no tokens consumed. Returns original token count, estimated tokens after savings, cost comparison, saving percentage, applicable methods, and a recommendation.3 params

Estimate cost savings BEFORE making a real LLM call — completely free, no tokens consumed. Returns original token count, estimated tokens after savings, cost comparison, saving percentage, applicable methods, and a recommendation.

Parameters* required
messagesarray
Conversation messages to analyze for savings estimation. Same format as chat_completion.
modelstring
The target LLM model to estimate costs for. Examples: 'gpt-4o', 'claude-sonnet-4-6', 'gemini-2.5-flash'.
providerstring
The LLM provider. Must match the model — e.g. 'openai' for gpt-4o, 'anthropic' for claude models.one of openai · anthropic · gemini · groq
billing_start_trialStart a 7-day free Pro trial. Returns a Stripe checkout URL. No charge for 7 days. Pro plan: $4.99 first month, then $11.99/month. 10,000 requests/month. Cancel anytime.1 params

Start a 7-day free Pro trial. Returns a Stripe checkout URL. No charge for 7 days. Pro plan: $4.99 first month, then $11.99/month. 10,000 requests/month. Cancel anytime.

Parameters* required
formatstring
Response format: 'text' for a human-readable message with the checkout URL, 'json' for machine-parseable output.one of text · jsondefault: text
usage_summaryRetrieve complete usage summary: total requests, cache hit rate, total tokens saved, estimated cost saved in USD, and requests routed to cheaper models.1 params

Retrieve complete usage summary: total requests, cache hit rate, total tokens saved, estimated cost saved in USD, and requests routed to cheaper models.

Parameters* required
formatstring
Response format: 'text' for a human-readable summary, 'json' for structured data.one of text · jsondefault: text
billing_statusRetrieve current plan, monthly request limit, requests used this month, remaining requests, and usage percentage. Warns when usage exceeds 80%.1 params

Retrieve current plan, monthly request limit, requests used this month, remaining requests, and usage percentage. Warns when usage exceeds 80%.

Parameters* required
formatstring
Response format: 'text' for a human-readable status, 'json' for structured data.one of text · jsondefault: text
cache_flushMark all cached responses as stale, forcing fresh LLM calls. Use after updating a knowledge base or changing system prompts.1 params

Mark all cached responses as stale, forcing fresh LLM calls. Use after updating a knowledge base or changing system prompts.

Parameters* required
confirmboolean
Safety flag to confirm the flush operation. Must be true to proceed. Prevents accidental cache invalidation.default: true
usage_recentRetrieve recent proxied API requests with timestamp, provider, model, token counts, cache hit status, routing info, and tokens saved.1 params

Retrieve recent proxied API requests with timestamp, provider, model, token counts, cache hit status, routing info, and tokens saved.

Parameters* required
limitinteger
Number of recent requests to return. Defaults to 10. Maximum is 50.default: 10

Sponsors

Configuration

TOKEN_OPTIMIZER_CACHE_DIR

Directory path for cache storage (optional, defaults to ~/.token-optimizer-cache)

Readme

MCP Toplist

Token Optimizer

Token Optimizer MCP

Cut what your AI coding agent costs without cutting what it gets done.
Hooks, a proxy, and an MCP server for Claude Code, Codex, Copilot, Gemini and 12 more clients.


View the full README on GitHub

Details

Repository
github.com/ooples/token-optimizer-mcp
Package
@ooples/token-optimizer-mcp
Transport
STDIO
Registry
MCP registry, active

More from ooples