1. Conduid
  2. Blockchain
  3. io.github.mdfifty50-boop/token-lens
MCP server · Blockchain

io.github.mdfifty50-boop/token-lens

MCP server for analyzing and optimizing context window token usage — audit tool definitions, compres

Unclaimed last commit 6 months ago blockchain
37Low

Scored 6 months ago · breakdown

About io.github.mdfifty50-boop/token-lens

io.github.mdfifty50-boop/token-lens is an MCP server published by mdfifty50-boop in the Blockchain category: mCP server for analyzing and optimizing context window token usage — audit tool definitions, compres.

Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

Claude Code
claude mcp add io-github-mdfifty50-boop-token-lens -- npx -y token-lens-mcp
npx
npx -y token-lens-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Tools (7)

analyze_session_usageTrack which tools are actually called vs loaded in a session. Register tools, log calls, and generate waste reports showing unused tools ranked by token cost.

Parameters not published.

audit_context_budgetAnalyze the token cost of MCP tool definitions. Estimates tokens per tool using chars/4 on the full JSON definition. Returns per-tool costs and percentage of common context windows.

Parameters not published.

compress_schemaCompress a verbose tool schema to reduce token usage. Light: remove short descriptions. Medium: shorten descriptions, remove examples. Aggressive: strip all descriptions.

Parameters not published.

get_optimization_reportFull context window health check combining audit, removal suggestions, and compression recommendations. Returns an executive summary with health grade and projected savings.

Parameters not published.

health_checkReturns server health, uptime, version, and storage stats

Parameters not published.

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

Parameters not published.

suggest_removalsIdentify tools that can be removed based on usage history. Scores: never_used > not_used_30_days > rarely_used. Returns removal candidates with estimated token savings.

Parameters not published.

Ask AI

✦

Ask AI about io.github.mdfifty50-boop/token-lens

Powered by Claude · Grounded in docs

I know everything about io.github.mdfifty50-boop/token-lens. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ✓README presentThe repository ships documentation.

5 checks have not been run yet.

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

Returns: Recommended tools sorted by relevance, excluded tools, estimated tokens saved.

compress_schema

Compress verbose tool schemas to reduce token usage.

Params:

  • tool_name — Name of the tool
  • schema — JSON Schema object to compress
  • level — "light" | "medium" | "aggressive"

Levels:

  • light — Remove descriptions under 20 chars
  • medium — Shorten descriptions to 50 chars, remove examples
  • aggressive — Strip all descriptions, keep only types and required fields

Returns: Compressed schema, original/compressed token counts, savings percentage.

analyze_session_usage

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

Params:

  • session_id — Unique session identifier
  • action — "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.

suggest_removals

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.

get_optimization_report

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

Params:

  • tools — Array of tool definitions
  • usage_history — Optional usage history array

Returns: Executive summary with health grade (excellent/good/fair/poor), audit results, removal suggestions, compression opportunities, and actionable recommendations.

Resources

token-lens://tips

Best practices guide for reducing MCP context window bloat, including schema design tips, token budget guidelines, and dynamic tool loading strategies.

Development

npm install
npm test
npm run dev  # watch mode

License

MIT

README copy captured when this server was indexed; it may lag the repository. The original is authoritative.

Questions

About io.github.mdfifty50-boop/token-lens

How do I install io.github.mdfifty50-boop/token-lens?

Run claude mcp add io-github-mdfifty50-boop-token-lens -- npx -y token-lens-mcp, then add the server to your MCP client's configuration.

Is io.github.mdfifty50-boop/token-lens safe to use with an AI agent?

Its trust score is 37 out of 100 (low). It passes 1 of the 1 static security checks run so far. It has no ConduID identity yet, so agent calls to it are not receipted.

Is io.github.mdfifty50-boop/token-lens still maintained?

The last commit was 6 months ago. That's long enough that you should check whether the maintainer is responding to issues before depending on it.