token-lens MCP Server
Context window token analysis and budget management
token-lens scores 44 (Fair), with no SPDX license recorded and written in JavaScript. It installs as a local process. It declares 6 tools. Filed under AI and memory. GitHub shows 0 stars. Package registries report about 61 downloads a week. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.
Fair trust
44 of 100 from six public signals. Nobody can buy a point.
- Listed in the official MCP registry.
- No license recorded.
License, quality and maintenance
Quality: Grade B
83/100 for listing completeness. Lost points: short README, 2 of 6 tools barely described, short summary.
How quality is graded
Where the 44 comes from
22 + 5 + 3 + 0 + 4 + 10 = 44. Each factor is capped, so no single signal can carry a listing.
Active in the official MCP registry, plus a known vendor namespace.
Registry: 22 of 30 points.How recently the repository saw a commit or release.
Maintenance: 5 of 20 points.GitHub stars and weekly downloads, on a log scale.
Popularity: 3 of 20 points.A clear, OSI-style open-source license.
License: 0 of 10 points.Not archived, a secure install path, a pinned version.
Security: 4 of 10 points.A real summary, a README with depth, listed tools.
Docs: 10 of 10 points.Install
Pick your client, copy the config, paste it in.
Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.
{ "mcpServers": { "mdfifty50-boop-token-lens-mcp": { "command": "npx", "args": [ "-y", "token-lens-mcp@0.1.2" ] } }}
Environment variables
This server does not declare environment variables.
Tools6Tool docs quality grade D
All capabilitiesavailable_toolstoolArray of {name, description, category?}
session_idtoolUnique session identifier
task_descriptiontoolWhat you're trying to accomplish
tool_nametoolName of the tool
tool_tokenstoolToken cost (for registertool, default 50)
usage_historytoolArray of {toolname, callcount, lastuseddaysago}
About
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 accomplishavailable_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 toolschema— JSON Schema object to compresslevel—"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 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.
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 definitionsusage_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
Frequently asked questions
What is token-lens MCP Server?
Context window token analysis and budget management
How do I install token-lens MCP Server in Claude Desktop, Cursor, or VS Code?
Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. token-lens MCP Server runs locally from the npm package token-lens-mcp with the command npx -y token-lens-mcp@0.1.2.
Does token-lens MCP Server support remote (HTTP) connections?
No remote endpoint is listed for token-lens MCP Server. It runs locally on your machine over stdio, started by your MCP client.
What tools does token-lens MCP Server provide?
token-lens MCP Server provides 6 tools, including available_tools, session_id, task_description, and tool_name. See the full tool list for descriptions and parameters.
How is token-lens MCP Server's trust score calculated?
token-lens MCP Server scores 44 out of 100 (Fair). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.
Reviews
No reviews yet—Be the first to review
No published reviews yet. Used it? Tell the next person how it went.
Sign inA verified email is required to review this server.
Add badge to your README
Paste either snippet into the repository README. The image links to this listing.