MCP Cost Tracker Router MCP Server

Real-time cost awareness for MCP agent workflows

Local serverstdio

What is the MCP Cost Tracker Router MCP Server?

Real-time cost awareness for MCP agent workflows

The short version

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.

  • Per-tool cost breakdown — See exactly which tool calls are consuming the most tokens and budget
  • Budget alerts — Set a session spend threshold and get warned at 80% and 100% before you exceed it
  • Offline token counting — Uses js-tiktoken for accurate counts — no API calls required
  • Model routing suggestions — Recommends cheaper models for the current task type (advisory, never enforced without opt-in)
  • Multi-provider pricing — Tracks costs across Claude, OpenAI, and Gemini models from a single configurable pricing table
  • Spend history — Query daily, weekly, and monthly totals by model or tool

The tools it exposes

The server publishes 14 tools. What each one is for:

  • get_session_cost — Returns token totals and USD cost estimates for the current session. Read-only
  • get_tool_costs — Returns per-tool cost breakdown for the session, sorted by cost descending. Read-only
  • reset_session — Start a new cost-tracking session. Previous session data is retained in history
  • record_usage — 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
  • set_budget_alert — 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
  • suggest_model_routing — Heuristic model recommendation by task type. Takes task_description and optional constraints.max_cost_usd. Returns recommended model with reasoning
  • check_routing_policy — Check whether a model is allowed for a given task type under the routing policy. Takes task_type and model
  • get_spend_history — Query historical spend aggregated by period (day/week/month). Returns breakdown by model and tool. Read-only
  • estimate_workflow_cost — Pre-run cost estimation for a multi-step workflow. Takes a steps array with tool_name, estimated_input_tokens, estimated_output_tokens, and optional
  • export_spend_report — Generate a single-file HTML spend report with session breakdown, historical spend, model cost comparison, and budget status. Read-only
  • export_budget_audit — Export the audit log of budget enforcement decisions. Accepts optional from_date, to_date, and format (json/csv). Read-only
  • set_project — Create or update a project with an optional budget_usd. Takes project_name

What it needs from you

  • Node.js v20.19 or newer. - npm.

Recorded tools

  • get_session_cost — Returns token totals and USD cost estimates for the current session. Read-only.
  • get_tool_costs — Returns per-tool cost breakdown for the session, sorted by cost descending. Read-only.
  • reset_session — Start a new cost-tracking session. Previous session data is retained in history.
  • record_usage — 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.
  • set_budget_alert — 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.
  • suggest_model_routing — Heuristic model recommendation by task type. Takes task_description and optional constraints.max_cost_usd. Returns recommended model with reasoning and estimated cost.
  • check_routing_policy — Check whether a model is allowed for a given task type under the routing policy. Takes task_type and model.
  • get_spend_history — Query historical spend aggregated by period (day/week/month). Returns breakdown by model and tool. Read-only.
  • estimate_workflow_cost — 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.
  • export_spend_report — Generate a single-file HTML spend report with session breakdown, historical spend, model cost comparison, and budget status. Read-only.
  • export_budget_audit — Export the audit log of budget enforcement decisions. Accepts optional from_date, to_date, and format (json/csv). Read-only.
  • set_project — Create or update a project with an optional budget_usd. Takes project_name.
  • tag_session — Tag the current session with a project_name for cost allocation.
  • get_project_costs — Get cost report for a project. Takes project_name and optional since (ISO date). Read-only.

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
get_session_costReturns token totals and USD cost estimates for the current session. Read-only.
get_tool_costsReturns per-tool cost breakdown for the session, sorted by cost descending. Read-only.
reset_sessionStart a new cost-tracking session. Previous session data is retained in history.
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.
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.
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.
check_routing_policyCheck whether a model is allowed for a given task type under the routing policy. Takes task_type and model.
get_spend_historyQuery historical spend aggregated by period (day/week/month). Returns breakdown by model and tool. Read-only.
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.
export_spend_reportGenerate a single-file HTML spend report with session breakdown, historical spend, model cost comparison, and budget status. Read-only.
export_budget_auditExport the audit log of budget enforcement decisions. Accepts optional from_date, to_date, and format (json/csv). Read-only.
set_projectCreate or update a project with an optional budget_usd. Takes project_name.
tag_sessionTag the current session with a project_name for cost allocation.
get_project_costsGet cost report for a project. Takes project_name and optional since (ISO date). Read-only.

How to install the MCP Cost Tracker Router MCP Server

{
  "mcpServers": {
    "cost-tracker": {
      "command": "npx",
      "args": ["-y", "mcp-cost-tracker-router@latest"]
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Node.js v20.19 or newer. - npm.

Example prompts to try

  • “Use MCP Cost Tracker Router to get session cost.”
  • “Use MCP Cost Tracker Router to get tool costs.”
  • “Use MCP Cost Tracker Router to reset session.”

Frequently asked questions

Real-time cost awareness for MCP agent workflows Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.