
Mcp Cost Tracker Router
Tracks LLM API costs locally without proxying your traffic through a third party. Uses js-tiktoken to count tokens offline and stores session data in SQLite. Exposes tools to check current spend, get per-tool breakdowns, set budget alerts at custom thresholds, and suggest cheaper model alternatives based on task type. Works across Claude, OpenAI, and Gemini with a built-in pricing table you can override. Supports project tagging for chargeback reports and exports HTML summaries with charts. Reach for this when you need cost visibility without sending prompts to an external tracking service, or when you want routing suggestions baked into your agent workflow instead of bolted on afterward.
- tools
- 15
- auth
- Secret needed
- transport
- STDIO
- env var
- 1
- last updated
- Nov 4, 2026
Tools
15 toolsPublic tool metadata for what this MCP can expose to an agent.
get_session_costReturns token totals and USD cost estimates for the current session. Read-only.
Returns token totals and USD cost estimates for the current session. Read-only.
No parameter schema in public metadata yet.
get_tool_costsReturns per-tool cost breakdown for the session, sorted by cost descending. Read-only.
Returns per-tool cost breakdown for the session, sorted by cost descending. Read-only.
No parameter schema in public metadata yet.
reset_sessionStart a new cost-tracking session. Previous session data is retained in history.
Start a new cost-tracking session. Previous session data is retained in history.
No parameter schema in public metadata yet.
record_usageRecord token usage for a tool call. Takes tool_name, model (optional), input_tokens, and output_tokens. Emits a budget warning notification if 80% of threshold is reached.
Record token usage for a tool call. Takes tool_name, model (optional), input_tokens, and output_tokens. Emits a budget warning notification if 80% of threshold is reached.
No parameter schema in public metadata yet.
set_budget_alertSet a budget threshold in USD (threshold_usd). Warns at 80% and 100% of the threshold. Use with --enforce-budget to block calls beyond the limit.
Set a budget threshold in USD (threshold_usd). Warns at 80% and 100% of the threshold. Use with --enforce-budget to block calls beyond the limit.
No parameter schema in public metadata yet.
suggest_model_routingHeuristic model recommendation by task type. Takes task_description and optional constraints.max_cost_usd. Returns recommended model with reasoning and estimated cost.
Heuristic model recommendation by task type. Takes task_description and optional constraints.max_cost_usd. Returns recommended model with reasoning and estimated cost.
No parameter schema in public metadata yet.
check_routing_policyCheck whether a model is allowed for a given task type under the routing policy. Takes task_type and model.
Check whether a model is allowed for a given task type under the routing policy. Takes task_type and model.
No parameter schema in public metadata yet.
get_spend_historyQuery historical spend aggregated by period (day/week/month). Returns breakdown by model and tool. Read-only.
Query historical spend aggregated by period (day/week/month). Returns breakdown by model and tool. Read-only.
No parameter schema in public metadata yet.
estimate_workflow_costPre-run cost estimation for a multi-step workflow. Takes a steps array with tool_name, estimated_input_tokens, estimated_output_tokens, and optional model. Read-only.
Pre-run cost estimation for a multi-step workflow. Takes a steps array with tool_name, estimated_input_tokens, estimated_output_tokens, and optional model. Read-only.
No parameter schema in public metadata yet.
export_spend_reportGenerate a single-file HTML spend report with session breakdown, historical spend, model cost comparison, and budget status. Read-only.
Generate a single-file HTML spend report with session breakdown, historical spend, model cost comparison, and budget status. Read-only.
No parameter schema in public metadata yet.
export_budget_auditExport the audit log of budget enforcement decisions. Accepts optional from_date, to_date, and format (json/csv). Read-only.
Export the audit log of budget enforcement decisions. Accepts optional from_date, to_date, and format (json/csv). Read-only.
No parameter schema in public metadata yet.
set_projectCreate or update a project with an optional budget_usd. Takes project_name.
Create or update a project with an optional budget_usd. Takes project_name.
No parameter schema in public metadata yet.
tag_sessionTag the current session with a project_name for cost allocation.
Tag the current session with a project_name for cost allocation.
No parameter schema in public metadata yet.
get_project_costsGet cost report for a project. Takes project_name and optional since (ISO date). Read-only.
Get cost report for a project. Takes project_name and optional since (ISO date). Read-only.
No parameter schema in public metadata yet.
export_chargebackGenerate a chargeback report for internal billing. Takes from_date, to_date, optional group_by (project/session), and optional format (json/csv). Read-only.
Generate a chargeback report for internal billing. Takes from_date, to_date, optional group_by (project/session), and optional format (json/csv). Read-only.
No parameter schema in public metadata yet.
Sponsors
Configuration
YOUR_API_KEY*secretYour API key for the service
Readme
MCP Cost Tracker & Router
npm mcp-cost-tracker-router package
Local-first cost awareness for MCP agent workflows. Token counts are calculated offline using js-tiktoken — no proxy, no API round-trip, no spend data leaving your machine. When costs climb, routing suggestions point you to cheaper models before the invoice arrives.
Tool reference | Configuration | Contributing | Troubleshooting
Key features
Details
- Repository
- github.com/dbsectrainer/mcp-cost-tracker-router
- Category
- AI & LLM Tools
- Package
mcp-cost-tracker-router- Transport
- STDIO
- Auth
- Required
- Registry
- MCP registry, active