@yawlabs/tokenmeter-mcp
v0.3.1
Published
MCP server for LLM spend tracking, cost estimation, and provider comparison
Maintainers
Readme
Token Meter
Open-source MCP server for LLM spend tracking, cost estimation, and provider comparison.
tokenmeter.sh | Docs | Dashboard
What it does
Token Meter tracks your LLM API costs across 10+ providers. Compare model pricing, estimate costs before you spend, set budget alerts, and route requests to the cheapest provider — all from your AI editor.
Works as a local MCP server (open source), remote MCP server (hosted), API gateway, and dashboard.
Quick Start
Local MCP Server (no account needed)
npx @yawlabs/tokenmeter-mcpThis runs the MCP server locally with in-memory storage. All Community tier tools are available immediately — no API key, no sign-up.
Add to Claude Code
claude mcp add tokenmeter -- npx @yawlabs/tokenmeter-mcpAdd to Cursor / VS Code
Add to your MCP client config:
{
"mcpServers": {
"tokenmeter": {
"command": "npx",
"args": ["@yawlabs/tokenmeter-mcp"]
}
}
}Remote MCP (hosted, no install)
Sign up at tokenmeter.sh and add to your MCP config:
{
"mcpServers": {
"tokenmeter": {
"url": "https://mcp.tokenmeter.sh",
"headers": {
"Authorization": "Bearer tm_your_api_key"
}
}
}
}API Gateway
Swap your provider base URL for smart routing and automatic failover:
OPENAI_BASE_URL=https://gateway.tokenmeter.sh/v1Tools
Community (Free, Open Source)
Available locally with no account:
| Tool | Description |
|------|-------------|
| get_spend_summary | Total spend for today, this week, and this month by provider |
| get_session_cost | Cost of the current conversation/session |
| get_model_pricing | Per-token pricing for any model or provider |
| get_cost_estimate | Estimate cost for a workload across multiple models |
| compare_models | Side-by-side cost comparison for a specific workload |
| get_budget_status | Check spend against configured budget limits |
| get_providers | List supported LLM providers |
Pro ($12/mo)
Requires a tokenmeter.sh account:
| Tool | Description |
|------|-------------|
| get_spend_breakdown | Detailed spend by provider, model, and project |
| get_cost_trend | Daily spend over time with trend analysis |
| get_top_models | Rank models by spend or token volume |
| get_anomalies | Flag unusual spend spikes |
| set_budget_alert | Create spend threshold notifications |
| set_budget_cap | Set hard spending caps that block requests |
| delete_budget_alert | Delete a budget alert by name or ID |
| tag_session | Label sessions by project for cost attribution |
| export_report | Generate spend reports (JSON/CSV) |
| get_rate_limits | Rate limit status per provider |
| get_routing_status | Provider health and routing status |
| set_routing_rule | Configure smart routing (cheapest, fastest) |
| set_fallback_chain | Define provider failover order |
| set_project_quota | Set per-project spend caps |
| get_latency_report | P50/P95/P99 latency per provider |
| set_model_alias | Map friendly names to provider/model pairs |
| get_cache_stats | Semantic cache hit rate and cost savings |
| set_cache_config | Enable/disable caching, adjust TTL |
Team ($39/mo per seat)
| Tool | Description |
|------|-------------|
| get_team_spend | Aggregated spend across all team members |
| set_team_budget | Organization-level budget caps |
Supported Providers
Anthropic (Claude), OpenAI (GPT, o-series), Google (Gemini), Groq, DeepSeek, Mistral, Cohere, Ollama, Azure OpenAI, AWS Bedrock
Development
# Install dependencies
npm install
# Run locally (stdio MCP server)
npm run dev
# Run tests
npm test
# Build
npm run buildArchitecture
src/
index.ts # Local MCP entry point (stdio)
mcp/server.ts # Tool definitions and handlers
db/memory.ts # In-memory data store (local)
db/postgres.ts # PostgreSQL store (cloud)
pricing/ # Model pricing engine + YAML data
tools/ # Tool handler implementations
gateway/ # API gateway + smart routing
api/ # REST API server (cloud)
billing/ # LemonSqueezy integration
auth/ # Auth + team managementThe local MCP server (src/index.ts) uses MemoryStore and requires zero external infrastructure — no database, no Redis, no API keys. Data is ephemeral (in-process memory).
The cloud service adds persistent storage (PostgreSQL), caching (Valkey), authentication, billing, and the web dashboard.
Part of the Yaw Labs ecosystem
- Yaw Terminal — Multi-provider AI terminal
- mcp.hosting — Deploy MCP servers in one click
- ctxlint — Lint context to reduce token waste
- tailscale-mcp — MCP servers over private tailnets
- Token Limit News — Weekly AI tooling newsletter
License
Copyright (c) 2026 Yaw Labs LLC. All rights reserved.
