Skip to main content
Glama
DCx7C5

token-optimization-mcp

by DCx7C5

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
REDIS_URLNoRedis connection URLredis://localhost:6379/1
USE_REDISNoEnable Redis backendfalse
AUDIT_LOG_ENABLEDNoPrint audit log to stdouttrue
CACHE_TTL_SECONDSNoDefault cache TTL (1 day)86400
RATE_LIMIT_PER_MINNoRequests/min per client120

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
extensions
{
  "io.modelcontextprotocol/ui": {}
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
estimate_tokensA

Estimate token count for a text string. Uses calibrated chars/token ratios per model. Example: estimate_tokens(text='Hello world', model='gpt-4o') → {tokens: 2, ...}

compress_promptB

Compress a prompt to reduce token usage. strategy: 'trim' (whitespace/blanks), 'summarize_hint' (mark long sections), 'aggressive' (strip comments, examples, filler). Returns compressed text + savings stats.

route_modelA

Recommend the cheapest capable model for a task. Filter by min_quality (1-10, default 7) and max_cost_per_1k USD. Returns ranked candidates with per-call cost estimate.

cache_lookupA

Look up a cached result by prompt text or pre-computed cache key. Returns {hit: true, result, tokens_saved} or {hit: false}.

cache_storeA

Store a prompt+result in the cache. Provide prompt (auto-hashed), result text, tokens_saved estimate, optional TTL override and metadata dict.

cache_invalidateA

Invalidate one or all cache entries. Pass cache_key to remove one entry, or flush_all=true to wipe everything.

analyze_contextA

Analyze a list of chat messages ({role, content}) for token usage and issues. Detects bloated system prompts, near-full context windows, and repeated content. Returns per-role breakdown, issues list, and recommendations.

savings_reportB

Token savings dashboard for the current session. Shows cache hits, tokens saved, and estimated USD savings per client.

deduplicate_messagesB

Remove duplicate messages from a conversation (keeps last occurrence). Returns deduplicated list + tokens saved.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DCx7C5/token-optimization-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server