Token Lens
NPM · @KUNAL_DUTT/TOKEN-LENS
Count and cut tokens in prompts, chats and agents for any model. Runs locally, collects no data.
Available components
Last scanned (2 hours ago)
Scores higher than 38% of npm servers
Category Developer Tools
How this component scores in each security and reliability category. Every signal is checked automatically from public evidence about the published package, including repeated runs of it in an isolated sandbox, and we only credit what we can confirm. How we score → Why this is hard to score →
Supply Chain Security100
- No malware found by supply-chain analysis.Pass
- No known CVEs affecting this package version or its production dependencies.Pass
- No install/post-install scripts declared.Pass
- No production dependencies, so there is no dependency health to assess. View diagnostics → Pass
Provenance & Transparency19
- Repository check failed: no source repository is declared. See how to fix → View diagnostics → Fail
- Provenance check failed: no build-provenance attestation is published. See how to fix → View diagnostics → Fail
- Clear OSI-approved license (MIT).Pass
- Actively maintained (last published 0 days ago).Pass
- Security-disclosure policy not yet verified: we couldn't inspect the source repository.Unverified
Schema Quality & AI Usability77
- 100% of prompts and resources have a non-trivial description (not blank, and not just the item's name).Pass
- AI-judged instruction clarity (good).Pass
- Context-footprint check failed: tool/resource definitions use about 1793 tokens (~163/item across 11 items; 11 tools + 0 resources), over budget; trim descriptions and params. See how to fix → Fail
- Usage-examples check failed: none of the tools include examples. See how to fix → Fail
Stability & Change Management7
- Stability observed for 2 of 30 days with no destabilising changes; credit accrues until the full window elapses.Partial
Tool Coverage95
- 100% of tools have a non-trivial description (not blank, and not just the tool's name).Pass
- 86% of tool parameters carry a description.Partial
Tool Safety100
- No prompt-injection markers were found in the server instructions, tool names or descriptions we captured.Pass
- We read all 11 captured tool definition(s), and no name or description among them implies an irreversible operation.Pass
- An AI judge read all 11 captured unit(s) of tool text and found none that tries to manipulate the model reading it.Pass
Capabilities100
- Implements a supported MCP spec version (2025-11-25); the latest is 2026-07-28.Pass
Every change we have recorded for this component, newest first. Security-relevant changes are always shown. ▲ marks a change for the better, ▼ a change for the worse; unmarked changes are neutral.
- 17 Oct 26 +32
- Injection markers: unverified → pass ▲ security
- Tool coverage: 96% → 86% ▼ functional
- Schema quality: 225 → 163 ▲ functional
- Tool coverage: unverified → 100 ▲ functional
- Schema quality: unverified → 100 ▲ functional
- Stability: unverified → 0.07 ▲ functional
- MCP protocol: unverified → pass ▲ functional
- 16 Oct 26 −20
- Tool safety: pass → unverified ▼ security
- Known CVEs: unverified → pass ▲ security
- Stability: Stability not yet verified: we do not have a sandbox capture of the MCP schema this version of the package serves yet. security
- Tool coverage: 96% → 86% ▼ functional
- Capabilities: pass → unverified ▼ functional
- Tool coverage: 100 → unverified ▼ functional
- Schema quality: 100 → unverified ▼ functional
- Schema quality: 225 → 163 ▲ functional
- Stability: unverified → 0.03 ▲ functional
- Dependency health: unverified → pass ▲ functional
- Package version: 0.2.25 → 0.2.31 functional
- Package version: 0.2.25 → 0.2.30 functional
- 15 Oct 26 +31
- Injection markers: unverified → pass ▲ security
- Known CVEs: unverified → pass ▲ security
- First check of Judged manipulation: pass security
- Stability: Stability not yet verified: not enough scan history yet (needs a 30-day window). security
- Schema quality: unverified → 100 ▲ functional
- Tool coverage: unverified → 100 ▲ functional
- MCP protocol: unverified → pass ▲ functional
- Dependency health: unverified → pass ▲ functional
- First check of Schema quality: fail functional
- First check of Tool coverage: 96 functional
- First check of Destructive annotations: pass functional
- First check of Schema quality: fail functional
- First check of Schema quality: good functional
- Package version: 0.2.21 → 0.2.25 functional
- Package version: 0.2.21 → 0.2.23 functional
- 14 Oct 26 23
First indexed and scored.
Diagnostic detail from the automated scan of this channel: what the scanner observed at each step, so you can see exactly where a check passed or failed. It is informational only and never changes the trust score.
Captured 17 Oct 2026 · Analysed npm/@kunal_dutt/token-lens@0.2.31
Provenance No attestation
The registry publishes no build provenance for this version, so there is nothing to verify.
| Result | No attestation |
|---|---|
| Ecosystem | npm |
Background: How many MCP packages publish verified provenance →
Dependencies 0 packages
| Packages resolved | 0 |
|---|---|
| Tree resolution | Complete |
Background: SBOMs and build attestations, explained →
The tools this component advertises to a client, with an estimated token cost for each. Expand a tool to see its parameters and schema. The per-tool counts are indicative and are not scored directly; the schema's total context footprint is one signal in Schema Quality & AI Usability. A tool's description is untrusted text the model reads on every call, which is what makes this list a security surface and not just an inventory: how tool poisoning works →
audit_agent_rules Trim coding-agent rule files ~241
Audit the instruction files a coding agent re-sends on every turn (CLAUDE.md, AGENTS.md, .cursorrules, .github/copilot-instructions.md, GEMINI.md and the like) and return trimmed versions ready to paste. Removes exact repeats within and across the files and tightens wording only where every number, negation, constraint and instruction word is kept, so the agent gets the same instructions. Lines that mention files missing from the repo are listed, never removed. Reports the tokens and dollars saved per turn and per 1,000 turns. Use when the user shares agent rule files or asks why a coding agent uses so many tokens.
| Name | Type | Req | Description |
|---|---|---|---|
| files | array | yes | Each rule file: its path and full text. |
| model | string | yes | Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure. |
| pricing | object | – | USD per 1M tokens, only if not the list price. |
| repo_paths | array | – | Optional: the repo's file paths, to flag rules that mention files that no longer exist. |
No output schema declared.
No examples provided.
check_conversation Check conversation token budget ~213
Estimate how full the context window is for a conversation and whether to hand off to a new chat. Pass the conversation text or a token count. When the chat is long, also offers an optional handoff request that produces a compact brief to continue in a fresh chat; this can change later answers, because the new chat only knows what the brief keeps, so present it as optional and never as same-output. Use when the user asks about chat length, usage limits, or the model forgetting earlier context.
| Name | Type | Req | Description |
|---|---|---|---|
| conversation | string | – | The conversation so far, as text. |
| conversation_tokens | integer | – | Or: its size in tokens. |
| latest_request | string | – | The user's latest message, to tailor the handoff to the task. |
| model | string | yes | Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure. |
| pricing | object | – | USD per 1M tokens, only if not the list price. |
No output schema declared.
No examples provided.
compact_data Shrink pasted data without changing it ~98
Shrink pasted JSON, API responses or logs with the data unchanged (removes only whitespace outside strings; proven by parsing). Returns paste-ready text and savings. Use when the user pastes large data.
| Name | Type | Req | Description |
|---|---|---|---|
| model | string | yes | Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure. |
| text | string | yes | Text with the pasted data, as written. |
No output schema declared.
No examples provided.
compare_prompts Check a shortened prompt against the original ~94
Check a prompt the user shortened against the original: savings, and any number, negation, constraint or instruction word lost. Use when asked if a shorter prompt is safe to send.
| Name | Type | Req | Description |
|---|---|---|---|
| edited | string | yes | – |
| model | string | yes | Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure. |
| original | string | yes | – |
No output schema declared.
No examples provided.
count_tokens Count tokens ~151
Count the tokens in a text for a given model. Exact for OpenAI models (o200k tokenizer); for Claude and Gemini exact when the server runs with your own ANTHROPIC_API_KEY or GEMINI_API_KEY (it then asks the provider's free token-count endpoint), otherwise a per-family estimate. Use when the user asks how many tokens something is, or before pasting a large document.
| Name | Type | Req | Description |
|---|---|---|---|
| model | string | yes | Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure. |
| pricing | object | – | USD per 1M tokens, only if not the list price. |
| text | string | yes | – |
No output schema declared.
No examples provided.
estimate_cost Forecast monthly cost and same-answer savings ~175
Monthly cost of an app or agent on its model (input, output, long-context rates) and what same-answer prompt caching and half-price batch save. Use for budgets and cutting an LLM bill.
| Name | Type | Req | Description |
|---|---|---|---|
| calls_per_day | number | yes | – |
| can_wait_share | number | – | Share of calls that can wait 24h. |
| input_tokens | integer | yes | Per call. |
| model | string | yes | Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure. |
| output_tokens | integer | yes | Per call, incl. reasoning. |
| pricing | object | – | USD per 1M tokens, only if not the list price. |
| repeated_prefix_tokens | integer | – | Unchanging start of each call: system, tools, examples. |
No output schema declared.
No examples provided.
list_model_profiles List model profiles ~37
List the model families Token Lens adapts to, with their context windows, whether counts are exact, and the price used for cost figures.
Input schema present but exposes no named parameters.
No output schema declared.
No examples provided.
optimize_agent Find token hotspots and optimize an agent or conversation ~333
Break down where tokens go in an agent or chat (system prompt, tool definitions, examples, conversation history, next prompt), find what is large or growing, and fix it. Safe fixes that keep the meaning (tighter wording with every number, negation and constraint kept; duplicate history removed) are applied and returned as an optimized spec. Returns the optimized system prompt, tool definitions and next prompt ready to paste. Every applied change is verified (facts and constraints kept, every instruction word kept, tool interface and conversation unchanged, same model) and the checks are returned as evidence. Fixes that could change the output (trimming history or tool results, fewer examples, length caps) are only listed, for the user to opt into. Also flags prompt-caching opportunities. Use when the user is building an agent or workflow, shares a system prompt or tool list, or asks why a chat or agent uses so many tokens.
| Name | Type | Req | Description |
|---|---|---|---|
| calls_per_month | integer | – | How many calls this agent makes per month, if known, to show the monthly saving. |
| examples | array | – | Few-shot examples. |
| messages | array | – | Conversation history, oldest first. |
| model | string | yes | Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure. |
| pricing | object | – | USD per 1M tokens, only if not the list price. |
| prompt | string | – | The next user message. |
| system | string | – | System prompt / instructions. |
| tools | array | – | Tool definitions (parameters = JSON schema). |
No output schema declared.
No examples provided.
optimize_prompt Optimize a prompt for fewer tokens ~245
Rewrite a prompt to use fewer tokens for a given model, keeping its meaning. Detects the task (coding, debugging, writing, editing, summarizing, translation, research, analysis, brainstorming, chat), leaves code, quotes and pasted source text untouched, trims logs when debugging, and drops step-by-step instructions for reasoning models. Never suggests switching models. Returns the best prompt to paste (same answer, fewer tokens, with what it kept), the savings in tokens and dollars, and model- and task-specific tips. Use when the user asks to shorten, tighten or save tokens on a prompt.
| Name | Type | Req | Description |
|---|---|---|---|
| conversation_tokens | integer | – | Tokens already in the conversation, if known. |
| level | string | – | light: wording only; balanced: + politeness and filler; aggressive: + hedges. Default auto. |
| model | string | yes | Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure. |
| pricing | object | – | USD per 1M tokens, only if not the list price. |
| prompt | string | yes | The prompt to optimize, exactly as the user wrote it. |
No output schema declared.
No examples provided.
plan_coach Get the most out of your Claude plan ~174
How much of the user's Claude plan (Free, Pro, Max, Team) is used and left, how many more messages fit this session in the open chat versus a new one, what is draining it, and what to do before it runs out or resets unused. Never switches the model or changes answers. Use when the user asks about usage, limits, their plan or subscription, or how to make it last.
| Name | Type | Req | Description |
|---|---|---|---|
| chat_tokens | integer | – | Your best estimate of this chat's size in tokens. |
| plan | string | – | The user's plan, if they said; saved for next time. |
| session_pct_used | number | – | Session usage % from Claude's Settings > Usage, if the user gave it. |
| session_resets_in_minutes | number | – | – |
| week_pct_used | number | – | – |
No output schema declared.
No examples provided.
savings_report Show total tokens and money saved ~32
Tokens and money Token Lens has saved: today, 7 and 30 days, total, by action and model.
Input schema present but exposes no named parameters.
No output schema declared.
No examples provided.
How do I install the Token Lens MCP server?
Token Lens runs locally as an npm package, launched with npx -y @kunal_dutt/token-lens. Ready-made configuration for Claude, Cursor, VS Code, Codex and 5 more is on this page, copied from each client's own documentation.
npm · @kunal_dutt/token-lens
claude mcp add duttkunal101-lab-token-lens -- npx -y @kunal_dutt/token-lens
What is the Token Lens MCP server?
Token Lens is an MCP server listed in the public MCP registry as io.github.duttkunal101-lab/token-lens. Count and cut tokens in prompts, chats and agents for any model. Runs locally, collects no data. This page covers its npm package (@kunal_dutt/token-lens).
Is the Token Lens MCP server safe to use?
Token Lens scores 66 out of 100 on VerifyMCP. We found no known CVEs affecting it as of 17 October 2026. It declares no install or post-install scripts. That is a record of what we were able to check automatically, not an endorsement. The category breakdown on this page shows every signal behind the number, including the ones we could not confirm.
What tools does the Token Lens MCP server expose?
Token Lens exposes 11 tools: plan_coach, optimize_prompt, count_tokens, check_conversation, optimize_agent, and 6 more. Their descriptions and schemas cost roughly 1,793 tokens of context every time the server is loaded.
Is the Token Lens MCP server still maintained?
Token Lens is still listed as active in the MCP registry. We last reached this channel on 17 October 2026. Those dates come from our own scans of the registry and the channel itself, not from anything the publisher announced.
What licence is the Token Lens MCP server under?
Token Lens declares the MIT licence, which is OSI-approved. That covers the source only, and says nothing about the cost of any service it calls.