token-optimization-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| REDIS_URL | No | Redis connection URL | redis://localhost:6379/1 |
| USE_REDIS | No | Enable Redis backend | false |
| AUDIT_LOG_ENABLED | No | Print audit log to stdout | true |
| CACHE_TTL_SECONDS | No | Default cache TTL (1 day) | 86400 |
| RATE_LIMIT_PER_MIN | No | Requests/min per client | 120 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| 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
| Name | Description |
|---|---|
| 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
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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