Skip to content
ooples avatar

Token Optimizer Mcp

ooples/token-optimizer-mcp

Token-cost savings and cache controls for MCP clients, backed by a prompt-compression proxy and usage billing.

CCM score
78 of 100
GitHub stars
595
tools
7
transport
STDIO
env var
1
last updated
Nov 14, 2026
View on GitHub

Own this MCP server? Claim it

What it does

  • Routes chat through the proxy with proxy_chat, applying semantic caching, LLMLingua 2 prompt compression, and model routing automatically
  • Estimates savings before any paid call with proxy_predict, and reports usage_summary, usage_recent, and billing_status for tokens saved and quota
  • Manages billing and cache with billing_start_trial (7-day free Pro trial, then $4.99 first month and $11.99 monthly) and cache_flush to force fresh responses
  • Designed for teams tracking LLM spend, or for anyone who wants to cut token use before calling a model

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

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
Categories
Memory & Context, AI Agents & LLM Apps
Package
@ooples/token-optimizer-mcp
Transport
STDIO
Registry
MCP registry, active

Questions

What does the Token Optimizer MCP server do for an agent?

It optimizes the context window through caching, prompt compression and smart file tools, which the listing says can cut tokens by 60-90%. Its proxy_chat tool sends chat completion requests through a cost-saving proxy that applies a semantic cache, LLMLingua 2 prompt compression and model routing automatically.

Which tools does the Token Optimizer MCP server provide?

The server exposes 7 tools: proxy_chat, proxy_predict, billing_start_trial, usage_summary, billing_status, cache_flush and usage_recent. proxy_predict estimates cost savings before a real LLM call and consumes no tokens, while cache_flush marks cached responses as stale after a knowledge base or system prompt changes.

How do I install the Token Optimizer MCP server in Claude Code?

The repository recommends installing the plugin rather than the bare MCP server, using the commands /plugin marketplace add ooples/token-optimizer-mcp, then /plugin install token-optimizer@token-optimizer, then /reload-plugins. The plugin's hooks do the saving, while the server alone only offers tools the model can ignore.

Does the Token Optimizer MCP server need an account or API key?

The README says everything runs locally with no account and no hosted service. The only environment variable listed is TOKEN_OPTIMIZER_CACHE_DIR, which is optional and sets the cache storage directory. The billing tools mention a paid Pro plan through a Stripe checkout for the proxy features.

Where does the Token Optimizer MCP server rank in its category?

It is in the Memory & Context category on Claude Marketplaces and ranks in the top 25 there. Other servers listed alongside it in that category include Headroom, Basic Memory, obsidian-wiki and Deja Vu, and it differs from them by focusing on cutting token cost through caching and compression.

More from ooples

All 2

Similar to Token Optimizer Mcp

More Memory & Context