mdfifty50-boop avatar

Token Lens

mdfifty50-boop/token-lens-mcp

If you're burning 40-72% of your context window on MCP tool definitions before writing a single line of code, this helps you find the waste. It audits token costs per tool using character approximation, recommends minimal tool sets based on task descriptions, and compresses verbose JSON schemas at three aggression levels. The analyze_session_usage tool tracks which tools actually get called versus just loaded, and suggest_removals scores candidates for removal based on usage patterns. The get_optimization_report combines everything into a health check with an executive summary. Helpful when you're hitting context limits or want to understand what's consuming tokens before user work begins.

tools
6
transport
STDIO
last updated
Apr 24, 2026

Tools

6 tools

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

audit_context_budgetAnalyze the token cost of your MCP tool definitions. Estimates tokens per tool using chars/4 approximation on the full JSON definition.

Analyze the token cost of your MCP tool definitions. Estimates tokens per tool using chars/4 approximation on the full JSON definition.

No parameter schema in public metadata yet.

optimize_tool_loadingGiven a task description, recommend the minimal set of tools needed. Uses keyword matching and category relevance scoring.

Given a task description, recommend the minimal set of tools needed. Uses keyword matching and category relevance scoring.

No parameter schema in public metadata yet.

compress_schemaCompress verbose tool schemas to reduce token usage.

Compress verbose tool schemas to reduce token usage.

No parameter schema in public metadata yet.

analyze_session_usageTrack which tools are actually called vs loaded during a session.

Track which tools are actually called vs loaded during a session.

No parameter schema in public metadata yet.

suggest_removalsIdentify tools that can be safely removed based on usage patterns.

Identify tools that can be safely removed based on usage patterns.

No parameter schema in public metadata yet.

get_optimization_reportFull context window health check combining audit, removal suggestions, and compression recommendations.

Full context window health check combining audit, removal suggestions, and compression recommendations.

No parameter schema in public metadata yet.

Sponsors

Readme

token-lens-mcp

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.

Install

npx token-lens-mcp

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "token-lens": {
      "command": "npx",
      "args": ["token-lens-mcp"]
    }
  }
}

Claude Code

claude mcp add token-lens -- npx token-lens-mcp

Tools

audit_context_budget

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} objects

Returns: Per-tool token cost (sorted by cost), total tokens, percentage of 128K/200K/1M context windows.

optimize_tool_loading

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 accomplish
  • available_tools — Array of {name, description, category?}

View the full README on GitHub

Details

Repository
github.com/mdfifty50-boop/token-lens-mcp
Package
token-lens-mcp
Transport
STDIO
Registry
MCP registry, active

More from mdfifty50-boop