TokenLens MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TokenLens MCP Serverrecommend plan for coding 3h/day on claude-sonnet"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TokenLens MCP Server
MCP server that exposes TokenLens pricing data as tools for AI agents (Claude Code, Cursor, Windsurf, Claude Desktop, etc.).
Tools
Tool | Description |
| Rank all plans by effective cost/1M tokens for a given model |
| Calculate API vs subscription cost for a usage pattern |
| Find the daily hours where API cost equals a subscription price |
| Single best-value plan for your usage profile |
Related MCP server: ohmytoken
Setup
1. Install
git clone https://github.com/flikQ/tokenlens-mcp.git
cd tokenlens-mcp
npm install # or: bun install
npm run build # or: bun run build2. Connect to your editor
Claude Code (one command):
claude mcp add tokenlens -- node /path/to/tokenlens-mcp/dist/index.jsTo always use live pricing data from tokenlens.flikq.dev:
claude mcp add tokenlens -- env TOKENLENS_DATA_URL=https://tokenlens.flikq.dev/api/data node /path/to/tokenlens-mcp/dist/index.jsCursor · Windsurf · Claude Desktop — add to config JSON:
Cursor:
~/.cursor/mcp.jsonWindsurf:
~/.codeium/windsurf/mcp_config.jsonClaude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"tokenlens": {
"command": "node",
"args": ["/path/to/tokenlens-mcp/dist/index.js"],
"env": {
"TOKENLENS_DATA_URL": "https://tokenlens.flikq.dev/api/data"
}
}
}
}3. Verify
Restart your editor, then ask your agent:
Use the tokenlens recommend_plan tool. I code 3h/day on claude-sonnet.Data source
By default the server reads bundled data/*.json files from the repo. To always use the latest live pricing data, set:
TOKENLENS_DATA_URL=https://tokenlens.flikq.dev/api/dataThe server fetches all data at startup and caches it in memory. If the URL is unreachable it automatically falls back to the bundled local files.
You can also point at a custom data directory:
TOKENLENS_DATA_DIR=/path/to/custom/dataLicense
MIT
Available Tools
4 toolsbreak_evenA
Find the daily usage hours at which API cost equals a subscription price. Below this threshold, the API is cheaper; above it, the subscription wins.
| Name | Required | Description | Default |
|---|---|---|---|
| plan_id | Yes | The plan to find break-even for (e.g. 'cursor-pro', 'claude-code-pro'). | |
| model_id | No | Model to price API usage against. Default 'claude-sonnet'. | claude-sonnet |
| output_ratio | No | Fraction of tokens that are output. Default 0.35. | |
| days_per_month | No | Working days per month. Default 22. | |
| tokens_per_hour | No | Tokens consumed per hour of active use. Default 800,000. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Since no annotations are provided, the description carries the full burden of behavioral disclosure. It does explain the result interpretation (below/above threshold), but lacks details on underlying pricing assumptions, computation side effects, or any state changes. For a calculation tool, this is minimally adequate but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, well-structured sentence that states the core function and its result interpretation with zero unnecessary words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple calculation tool with no output schema, the description adequately conveys the purpose and the meaning of the result. However, it does not detail the response format or specify when to choose this over sibling tools, leaving a minor gap in context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, and each parameter has a clear description with defaults and ranges. The tool description adds no extra parameter-specific meaning, but the schema already handles this dimension, warranting the baseline score of 3.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb 'Find' and clearly identifies the resource: 'daily usage hours at which API cost equals a subscription price'. It distinctly differentiates from siblings like compare_plans and recommend_plan by focusing on the break-even threshold calculation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus the listed siblings (compare_plans, run_scenario, recommend_plan). The description explains the threshold outcome but omits any exclusions or alternative tool references, leaving the agent to infer usage context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
compare_plansA
Rank all TokenLens plans by effective cost per 1M tokens. Useful when choosing between subscriptions and API access for a given model.
| Name | Required | Description | Default |
|---|---|---|---|
| model_id | No | Filter to plans that include this model (e.g. 'claude-sonnet', 'gpt-4o'). If omitted, all plans are returned. | |
| output_ratio | No | Fraction of tokens that are output (0–1). Default 0.35. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description itself must convey behavior. It states the comparison is based on effective cost and that all plans are ranked, but doesn't disclose sort order, whether it returns a list with cost details, or any read-only/external-call behavior. Reasonably transparent for a non-mutating comparison but leaves some behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences with no filler. The core action is front-loaded, and the use case is stated in the second sentence.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With only 2 optional flat params and no output schema, the description provides the essential action and use case. It could mention the return format or exact sort order, but the tool's purpose is simple and the schema covers parameters well – not quite a 5.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema covers 100% of parameters with descriptions, so baseline is 3. The tool description adds 'effective cost per 1M tokens' and 'for a given model,' which align with output_ratio and model_id but don't materially extend the schema's parameter docs.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description opens with 'Rank all TokenLens plans by effective cost per 1M tokens' – a specific verb (rank), resource (TokenLens plans), and metric. This clearly distinguishes it from siblings like recommend_plan or run_scenario.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly states 'Useful when choosing between subscriptions and API access for a given model,' giving a clear use case. However, it does not mention when to avoid it or point to specific sibling alternatives such as break_even or recommend_plan.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
recommend_planA
Get a single best-value plan recommendation for your usage profile. Considers whether a subscription or API access is cheaper, and whether token caps are sufficient.
| Name | Required | Description | Default |
|---|---|---|---|
| model_id | No | Primary model you use. Default 'claude-sonnet'. | claude-sonnet |
| output_ratio | No | Fraction of output tokens. Default 0.35. | |
| hours_per_day | Yes | Average hours per day you use AI coding tools. | |
| days_per_month | No | Working days per month. Default 22. | |
| max_budget_usd | No | Maximum monthly budget in USD. If set, excludes plans above this price. | |
| tokens_per_hour | No | Tokens per hour. Default 800,000. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden. It explains the tool considers subscription vs API cost and token caps, which is useful. However, it does not disclose output format, edge cases (e.g., no plan fits, budget exclusions), or any side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, front-loaded with the primary purpose, and every clause adds value. The second sentence explains the decision logic without unnecessary detail. Ideal conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is relatively simple, but with no output schema, the description does not clarify what the returned recommendation looks like (e.g., plan ID, estimated cost). It also does not reference sibling tools, leaving the decision context incomplete for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description does not mention any parameters or add meaning beyond the schema, so it neither adds nor detracts from the schema's thorough documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Get') and resource ('best-value plan recommendation'), clearly stating it returns a single recommendation based on usage profile. It distinguishes from siblings like compare_plans by emphasizing 'single' and 'best-value'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage context is implied: when you want a single recommendation for a usage profile. However, it does not explicitly contrast with sibling tools (e.g., when to use compare_plans) or state exclusions, so no when-not guidance is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
run_scenarioA
Calculate total monthly token usage and cost (API vs subscription) for a given usage pattern. Returns costs for all matching plans side-by-side.
| Name | Required | Description | Default |
|---|---|---|---|
| model_id | No | Model to price API usage against. Default 'claude-sonnet'. | claude-sonnet |
| output_ratio | No | Fraction of tokens that are output. Default 0.35. | |
| hours_per_day | Yes | Average hours per day you use AI coding tools. | |
| days_per_month | No | Working days per month. Default 22. | |
| tokens_per_hour | No | Tokens consumed per hour of active use. Default 800,000. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the tool returns side-by-side costs for matching plans, which is useful behavioral context. However, it does not explain what determines 'matching' plans, assumptions, or any side effects, leaving moderate gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence that front-loads the verb and object. There is no filler or redundant information; it efficiently communicates purpose and output.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a five-parameter calculator with no output schema, the description covers purpose, usage pattern, and output shape ('side-by-side' costs). It could be more complete by clarifying differences from sibling tools, but the core scenario is adequately described.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so all five parameters are already documented in the input schema. The description adds no parameter-level information beyond the schema, so the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Calculate') and identifies the resource ('total monthly token usage and cost') as well as the output behavior ('Returns costs for all matching plans side-by-side'). It clearly conveys the tool's function, though it does not explicitly distinguish itself from sibling tools like compare_plans.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for a 'given usage pattern' and provides context about what it calculates. However, it offers no explicit guidance on when to use this tool versus siblings like compare_plans, break_even, or recommend_plan, and does not mention any exclusions or alternative tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
break_even - First observed
compare_plans - First observed
recommend_plan - First observed
run_scenario
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: comparing plan costs, simulating usage scenarios, computing break-even thresholds, and generating personalized recommendations. Their descriptions make the boundary between them obvious.
All tool names follow a consistent verb_noun pattern in snake_case: compare_plans, run_scenario, break_even, recommend_plan. No mixed styles or vague verbs.
With 4 tools, the server is well-scoped for its purpose of analyzing TokenLens plans. Each tool contributes a distinct analysis capability without redundancy.
The tool set covers all key aspects of plan selection: cost comparison, usage simulation, break-even analysis, and final recommendation. There are no obvious missing operations for the stated domain.
Maintenance
Related MCP Connectors
Compare up-to-date pricing for 40+ LLMs (incl. Chinese) & estimate cost from tokens. EN/zh.
Live LLM API pricing: token prices, comparisons, cheapest-model lookups. No key required.
AI inference pricing for agents: live and historical model prices, provider comparison.
Loan & mortgage calculator, compound interest, ROI, crypto prices, FX conversion for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides real-time AI model pricing, cost estimation, and budget management tools to help agents understand and optimize their spending. It enables agents to compare costs across multiple providers and select the most cost-effective models for specific tasks.1-
- FlicenseNot gradedqualityDmaintenanceProvides real-time token pricing for AI models, model comparison, cost calculation, and token usage tracking for agents and developers.-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to calculate, compare, and recommend AI API costs from multiple providers, with support for currency conversion and platform fee analysis.1MIT
- FlicenseNot gradedqualityCmaintenanceEnables precise financial analysis of AI agent costs, including token pricing, multi-step run estimates, model comparison, and ROI versus human labor, with deterministic decimal math.-