MCP server for analyzing and optimizing context window token usage — audit tool definitions, compres
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"io-github-mdfifty50-boop-token-lens": {
"command": "<see-readme>",
"args": []
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
MCP server for analyzing and optimizing context window token usage — audit tool definitions, compres
No automated test available for this server. Check the GitHub README for setup instructions.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
No package registry to scan.
This server is missing a description. Tools and install config are also missing.If you've used it, help the community.
Add informationBe the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in legal
An MCP (Model Context Protocol) server for performing accessibility audits on webpages using axe-core. Use the results in an agentic loop with your favorite AI assistants (Amp/Cline/Cursor/GH Copilot) and let them fix a11y issues for you!
MCP server for French e-invoicing (XP Z12-013). Manages invoices, validation and compliance.
956k Swiss court decisions: full-text search, citation graph, statute lookup (DE/FR/IT)
API governance for AI coding assistants. Breaking changes, policies, cross-model context.
MCP Security Weekly
Get CVE alerts and security updates for io.github.mdfifty50-boop/token-lens and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
MCP server for analyzing and optimizing context window token usage. MCP tool definitions consume 40-72% of context windows before any user work begins — this server helps you measure, compress, and eliminate that waste.
npx token-lens-mcp
Add to claude_desktop_config.json:
{
"mcpServers": {
"token-lens": {
"command": "npx",
"args": ["token-lens-mcp"]
}
}
}
claude mcp add token-lens -- npx token-lens-mcp
Analyze the token cost of your MCP tool definitions. Estimates tokens per tool using chars/4 approximation on the full JSON definition.
Params:
tools — Array of {name, description, schema} objectsReturns: Per-tool token cost (sorted by cost), total tokens, percentage of 128K/200K/1M context windows.
Given a task description, recommend the minimal set of tools needed. Uses keyword matching and category relevance scoring.
Params:
task_description — What you're trying to accomplishavailable_tools — Array of {name, description, category?}Returns: Recommended tools sorted by relevance, excluded tools, estimated tokens saved.
Compress verbose tool schemas to reduce token usage.
Params:
tool_name — Name of the toolschema — JSON Schema object to compresslevel — "light" | "medium" | "aggressive"Levels:
Returns: Compressed schema, original/compressed token counts, savings percentage.
Track which tools are actually called vs loaded during a session.
Params:
session_id — Unique session identifieraction — "register_tool" | "log_call" | "report"tool_name — Tool name (required for register_tool/log_call)tool_tokens — Token cost (for register_tool, default 50)Report returns: Loaded vs used counts, waste percentage, unused tools ranked by token cost.
Identify tools that can be safely removed based on usage patterns.
Params:
usage_history — Array of {tool_name, call_count, last_used_days_ago}Scoring: never_used (priority 3) > not_used_30_days (priority 2) > rarely_used (priority 1)
Returns: Removal candidates with reasons and estimated token savings.
Full context window health check combining audit, removal suggestions, and compression recommendations.
Params:
tools — Array of tool definitionsusage_history — Optional usage history arrayReturns: Executive summary with health grade (excellent/good/fair/poor), audit results, removal suggestions, compression opportunities, and actionable recommendations.
Best practices guide for reducing MCP context window bloat, including schema design tips, token budget guidelines, and dynamic tool loading strategies.
npm install
npm test
npm run dev # watch mode
MIT