mcp-cost-tracker-router

v1.0.1
io.github.dbsectrainer/mcp-cost-tracker-router Checked 3 days ago Published 1 month ago

Real-time cost awareness for MCP agent workflows

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_session_cost

Returns token totals and USD cost estimates for the current session. All costs are estimates; verify with your LLM provider's billing dashboard.

get_tool_costs

Returns per-tool cost breakdown for the current session, sorted by cost descending. Useful for identifying the most expensive operations. All costs are estimates.

set_budget_alert

Set a budget threshold in USD. A warning is emitted when session costs reach 80% or 100% of this threshold. Use with --enforce-budget to block calls beyond the limit.

ParameterTypeDescription
threshold_usd *numberBudget threshold in USD (must be > 0)

reset_session

Start a new cost-tracking session. Previous session data is retained in history and accessible via get_spend_history.

get_spend_history

Query historical spend aggregated by time period (day/week/month). Returns breakdown by model and tool across all sessions. All costs are estimates.

ParameterTypeDescription
periodstringTime period to aggregate. Defaults to "week".

record_usage

Record token usage for a tool call. Logs LLM API cost estimates into the tracker. Emits a budget warning (notifications/message) if 80% of threshold is reached. Pricing table versions are tracked in CHANGELOG.md.

ParameterTypeDescription
input_tokens *numberNumber of input/prompt tokens (estimate)
output_tokens *numberNumber of output/completion tokens (estimate)
tool_name *stringName of the tool or operation being recorded
modelstringModel used (e.g. claude-sonnet-4-6). Defaults to server default model.

suggest_model_routing

Heuristic model recommendation by task type. Analyzes the task description and returns a recommended model with reasoning and estimated cost per 1K tokens. Optionally factors in cost constraints.

ParameterTypeDescription
task_description *stringDescription of the task (e.g. 'classify this tweet', 'generate a REST API', 'analyze this 50-page document')
constraintsobject

estimate_workflow_cost

Pre-run cost estimation for a multi-step workflow. Provide a list of tool steps with estimated token counts and models to get total and per-step cost estimates. Output is clearly labeled as ESTIMATE.

ParameterTypeDescription
steps *arrayList of workflow steps to estimate

export_spend_report

Generate a single-file HTML spend report with session cost breakdown, historical spend by period, model cost comparison chart (CSS bars), and budget status. No external CDN dependencies.

export_budget_audit

Export audit log of budget enforcement decisions. Optionally filter by date range and format as JSON or CSV.

ParameterTypeDescription
formatstringOutput format. Defaults to "json".
from_datestringISO date start filter
to_datestringISO date end filter

set_project

Create or update a project with an optional budget in USD.

ParameterTypeDescription
project_name *stringUnique project name
budget_usdnumberOptional budget in USD for the project

get_project_costs

Get cost report for a project, optionally filtered by a since date.

ParameterTypeDescription
project_name *stringProject name
sincestringISO date to filter from

tag_session

Tag the current session with a project name for cost allocation.

ParameterTypeDescription
project_name *stringProject name to associate with this session

export_chargeback

Generate a chargeback report for internal team billing, grouped by project or session.

ParameterTypeDescription
from_date *stringISO date start of period
to_date *stringISO date end of period
formatstringOutput format. Defaults to "json".
group_bystringGroup by "project" or "session". Defaults to "project".

check_routing_policy

Check whether a model is allowed for a given task type under the routing policy.

ParameterTypeDescription
model *stringModel name to check
task_type *stringTask type (e.g. summarization, reasoning)