MCP.so
Sign In

@vk0/agent Cost Mcp

@vk0dev

About @vk0/agent Cost Mcp

Local-first Claude Code cost analyzer. Parses JSONL session logs to surface per-tool spend, daily trends, and optimization hints.

Basic information

Category

AI & Agents

License

MIT

Runtime

node

Transports

stdio

Publisher

vk0dev

Submitted by

vk0dev

Config

Add this server to your MCP-compatible client using the configuration below.

{
  "mcpServers": {
    "agent-cost": {
      "command": "npx",
      "args": [
        "-y",
        "@vk0/agent-cost-mcp"
      ]
    }
  }
}

Tools

9

Parse a single Claude Code session and return token totals, turn count, cache usage, and estimated USD cost so an agent can anchor every later Cost Guard question in one concrete run summary.

Aggregate tool invocations across one session or a filtered project log directory, reporting per-tool call counts and context-share percentages so you can see which tool patterns are actually driving spend.

Roll session logs into a day-by-day local cost trend, with per-day sessions, tokens, and estimated spend so anomalies and rising burn patterns are visible before they feel like guesswork.

Return a parent-plus-subagent session tree for one local Claude Code run, with cost summed per branch, so you can see which branch or delegated path actually consumed the budget.

Rank tools by a bounded ROI heuristic using cost share, linked results, and context share, so repeated calls with weak payoff surface quickly as the classic low-efficiency or runaway-loop signature, while productive same-tool refinement is less likely to be flagged too aggressively after `2.3.1`.

Generate lightweight optimization suggestions from a parsed session log, including cache-read ratios, abandoned tool calls, and heaviest turns, when you want the next fix to be more concrete than a raw metric table.

Flag unusually high or low daily cost spikes against the recent local baseline so sudden burn jumps, suspicious drops, and unstable usage patterns stand out without a separate monitoring stack.

Project a bounded local cost forecast from recent daily trend data so an operator can ask where spend is heading next, not just where it already went; `forecast_confidence` is a quartile-based local heuristic, not certainty, and it degrades gracefully when history is still short.

Set daily or per-session budget caps with tiered alert thresholds, so the next cost-query tool can return a machine-readable warning before an agent quietly runs past a soft or hard spending boundary.

Overview

What is @vk0/agent Cost Mcp?

Local Cost Guard and runtime guardrails for AI agents in Claude Code. It reads your local JSONL session logs to show where spend is coming from, forecast where it is heading, attribute cost by provider/model/tool, roll up subagent trees, and let operators push signed monitor-webhook alerts—all without a hosted control plane, cloud, or API key.

How to use @vk0/agent Cost Mcp?

Install by adding an npx-based MCP server to your client configuration (Claude Desktop, Claude Code CLI, Cursor, or Cline). No global install required. Once configured, ask the agent “What tools does agent-cost expose?” to see the eleven available tools. Operates on existing session logs at ~/.claude/projects/.

Key features of @vk0/agent Cost Mcp

  • Cost queries: get_session_cost, get_tool_usage, get_cost_trend, get_subagent_tree
  • Optimization analytics: get_tool_roi, suggest_optimizations, detect_cost_anomalies
  • Predictive tools: get_cost_forecast, estimate_run_cost
  • Configuration tools: configure_budget, set_monitor_webhook
  • Operates entirely locally on JSONL session logs from Claude Code
  • Privacy-preserving with zero cloud dependencies

Use cases of @vk0/agent Cost Mcp

  • Identify which tool, subagent, or branch burned the budget in a Claude Code session
  • Catch retry loops and runaway patterns before costs compound silently
  • Set budget thresholds and route monitor alerts for pre-spend guardrails
  • Attribute cost across parent/subagent session trees with get_subagent_tree
  • Detect daily cost anomalies against a local baseline

FAQ from @vk0/agent Cost Mcp

What does @vk0/agent Cost Mcp do that native /cost does not?

Native /cost gives quick current-session totals and statusline numbers. @vk0/agent Cost Mcp provides per-tool cost share, ROI ranking, anomaly detection, cost forecasts, and agent-readable budget guardrails—all machine-readable from local JSONL logs.

How do I install @vk0/agent Cost Mcp?

Use npx -y @vk0/agent-cost-mcp as the command in your MCP client’s server configuration (e.g., claude_desktop_config.json, .mcp.json, or .cursor/mcp.json). No global installation needed.

Where does the data come from?

The tool reads session logs stored locally at ~/.claude/projects/<project>/. No data leaves your machine.

Is this a replacement for billing dashboards or org-wide spend tracking?

No. It is for developers and operators who want Cost Guard–style answers from local Claude Code logs, not for chargeback reporting, company-wide spend accounting, or live runtime introspection.

What transports and authentication are supported?

The server communicates over stdio MCP transport. No authentication or API keys are required.

Comments

More AI & Agents MCP servers