# Token Lens (npm · @kunal_dutt/token-lens)

Count and cut tokens in prompts, chats and agents for any model. Runs locally, collects no data.

- Trust score: 66/100 (medium)
- Registry status: active
- Liveness: live
- Owner verified: no
- Last scored: 2026-10-17

## Components

- npm · `@kunal_dutt/token-lens`: 66/100 (this document), [markdown](https://verifymcp.io/servers/duttkunal101-lab-token-lens/kunal-dutt-token-lens.md), [page](https://verifymcp.io/servers/duttkunal101-lab-token-lens/kunal-dutt-token-lens)

## Channel facts

- Registry: `npm`
- Package: `@kunal_dutt/token-lens`
- Version: `0.2.31`
- Transport: `stdio`

## Trust breakdown

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. Scores are 0–100 per category. Scoring method: https://verifymcp.io/docs/scoring (what has changed: https://verifymcp.io/docs/scoring/changelog)

Scored 2026-10-17.

- **Supply Chain Security**: 100/100
  - No malware found by supply-chain analysis.
  - No known CVEs affecting this package version or its production dependencies.
  - No install/post-install scripts declared.
  - No production dependencies, so there is no dependency health to assess.
- **Provenance & Transparency**: 19/100
  - Repository check failed: no source repository is declared.
  - Provenance check failed: no build-provenance attestation is published.
  - Clear OSI-approved license (MIT).
  - Actively maintained (last published 0 days ago).
  - Security-disclosure policy not yet verified: we couldn't inspect the source repository.
- **Schema Quality & AI Usability**: 77/100
  - 100% of prompts and resources have a non-trivial description (not blank, and not just the item's name).
  - AI-judged instruction clarity (good).
  - 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.
  - Usage-examples check failed: none of the tools include examples.
- **Stability & Change Management**: 7/100
  - Stability observed for 2 of 30 days with no destabilising changes; credit accrues until the full window elapses.
- **Tool Coverage**: 95/100
  - 100% of tools have a non-trivial description (not blank, and not just the tool's name).
  - 86% of tool parameters carry a description.
- **Tool Safety**: 100/100
  - No prompt-injection markers were found in the server instructions, tool names or descriptions we captured.
  - We read all 11 captured tool definition(s), and no name or description among them implies an irreversible operation.
  - An AI judge read all 11 captured unit(s) of tool text and found none that tries to manipulate the model reading it.
- **Capabilities**: 100/100
  - Implements a supported MCP spec version (2025-11-25); the latest is 2026-07-28.

## Install

### 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.

### Claude

```bash
claude mcp add duttkunal101-lab-token-lens -- npx -y @kunal_dutt/token-lens
```

### Cursor

```json
{
  "mcpServers": {
    "duttkunal101-lab-token-lens": {
      "command": "npx",
      "args": [
        "-y",
        "@kunal_dutt/token-lens"
      ]
    }
  }
}
```

### VS Code

```json
{
  "servers": {
    "duttkunal101-lab-token-lens": {
      "command": "npx",
      "args": [
        "-y",
        "@kunal_dutt/token-lens"
      ]
    }
  }
}
```

### Codex

```bash
codex mcp add duttkunal101-lab-token-lens -- npx -y @kunal_dutt/token-lens
```

### opencode

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "duttkunal101-lab-token-lens": {
      "type": "local",
      "command": [
        "npx",
        "-y",
        "@kunal_dutt/token-lens"
      ],
      "enabled": true
    }
  }
}
```

### OpenClaw

```bash
openclaw mcp add duttkunal101-lab-token-lens --command npx --arg -y --arg @kunal_dutt/token-lens
```

### Hermes

```yaml
mcp_servers:
  duttkunal101-lab-token-lens:
    command: "npx"
    args: ["-y", "@kunal_dutt/token-lens"]
```

### Netclaw

```json
{
  "McpServers": {
    "duttkunal101-lab-token-lens": {
      "Transport": "stdio",
      "Command": "npx",
      "Arguments": [
        "-y",
        "@kunal_dutt/token-lens"
      ]
    }
  }
}
```

### Vellum

```bash
assistant mcp add duttkunal101-lab-token-lens -t stdio -c npx -a -y @kunal_dutt/token-lens
```

### Other

```json
{
  "mcpServers": {
    "duttkunal101-lab-token-lens": {
      "command": "npx",
      "args": [
        "-y",
        "@kunal_dutt/token-lens"
      ]
    }
  }
}
```

## Changelog

Every change recorded for this component, newest first. Days that predate change tracking, or that we cannot explain, say so: "we were watching and nothing happened" and "we were not watching" are different claims.

### 2026-10-17 (score 66, +32)

- [security improvement] Injection markers: unverified → pass
- [functional regression] Tool coverage: 96% → 86%
- [functional improvement] Schema quality: 225 → 163
- [functional improvement] Tool coverage: unverified → 100
- [functional improvement] Schema quality: unverified → 100
- [functional improvement] Stability: unverified → 0.07
- [functional improvement] MCP protocol: unverified → pass

### 2026-10-16 (score 34, −20)

- [security regression] Tool safety: pass → unverified
- [security improvement] 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.
- [functional regression] Tool coverage: 96% → 86%
- [functional regression] Capabilities: pass → unverified
- [functional regression] Tool coverage: 100 → unverified
- [functional regression] Schema quality: 100 → unverified
- [functional improvement] Schema quality: 225 → 163
- [functional improvement] Stability: unverified → 0.03
- [functional improvement] Dependency health: unverified → pass
- [functional] Package version: 0.2.25 → 0.2.31
- [functional] Package version: 0.2.25 → 0.2.30

### 2026-10-15 (score 54, +31)

- [security improvement] Injection markers: unverified → pass
- [security improvement] 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).
- [functional improvement] Schema quality: unverified → 100
- [functional improvement] Tool coverage: unverified → 100
- [functional improvement] MCP protocol: unverified → pass
- [functional improvement] 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

### 2026-10-14 (score 23)

First indexed and scored.

## MCP tools (11)

### `plan_coach` (~174 tokens)

Get the most out of your Claude plan

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.

Input parameters:

- `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)

### `optimize_prompt` (~245 tokens)

Optimize a prompt for fewer tokens

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.

Input parameters:

- `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, required): 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, required): The prompt to optimize, exactly as the user wrote it.

### `count_tokens` (~151 tokens)

Count tokens

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.

Input parameters:

- `model` (string, required): 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, required)

### `check_conversation` (~213 tokens)

Check conversation token budget

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.

Input parameters:

- `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, required): 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.

### `optimize_agent` (~333 tokens)

Find token hotspots and optimize an agent or conversation

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.

Input parameters:

- `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, required): 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).

### `audit_agent_rules` (~241 tokens)

Trim coding-agent rule files

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.

Input parameters:

- `files` (array, required): Each rule file: its path and full text.
- `model` (string, required): 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.

### `list_model_profiles` (~37 tokens)

List model profiles

List the model families Token Lens adapts to, with their context windows, whether counts are exact, and the price used for cost figures.

### `compact_data` (~98 tokens)

Shrink pasted data without changing it

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.

Input parameters:

- `model` (string, required): Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure.
- `text` (string, required): Text with the pasted data, as written.

### `compare_prompts` (~94 tokens)

Check a shortened prompt against the original

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.

Input parameters:

- `edited` (string, required)
- `model` (string, required): Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure.
- `original` (string, required)

### `estimate_cost` (~175 tokens)

Forecast monthly cost and same-answer savings

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.

Input parameters:

- `calls_per_day` (number, required)
- `can_wait_share` (number): Share of calls that can wait 24h.
- `input_tokens` (integer, required): Per call.
- `model` (string, required): Model in use, e.g. "gpt-5", "claude-sonnet-4-5"; your own if unsure.
- `output_tokens` (integer, required): 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.

### `savings_report` (~32 tokens)

Show total tokens and money saved

Tokens and money Token Lens has saved: today, 7 and 30 days, total, by action and model.

## Diagnostics

Captured diagnostic sections: Provenance, Dependencies. The full working is on the page: https://verifymcp.io/servers/duttkunal101-lab-token-lens/kunal-dutt-token-lens#diagnostics

## Score history

- 2026-10-17: 66
- 2026-10-16: 34
- 2026-10-15: 54
- 2026-10-14: 23

## Common questions

### 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.

## Links

- npm package: https://www.npmjs.com/package/@kunal_dutt/token-lens
- Socket report: https://socket.dev/npm/package/@kunal_dutt/token-lens
- Changelog RSS feed: https://verifymcp.io/servers/duttkunal101-lab-token-lens/kunal-dutt-token-lens.xml
- Changelog JSON feed: https://verifymcp.io/servers/duttkunal101-lab-token-lens/kunal-dutt-token-lens.json
- HTML version of this page: https://verifymcp.io/servers/duttkunal101-lab-token-lens/kunal-dutt-token-lens
