@vk0/agent Cost Mcp
@vk0dev
关于 @vk0/agent Cost Mcp
Local-first Claude Code cost analyzer. Parses JSONL session logs to surface per-tool spend, daily trends, and optimization hints.
基本信息
配置
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"agent-cost": {
"command": "npx",
"args": [
"-y",
"@vk0/agent-cost-mcp"
]
}
}
}工具
9Parse 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.
概览
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.
AI 与智能体 分类下的更多 MCP 服务器
Perplexity MCP Server
DaInfernalCoderA Model Context Protocol (MCP) server for research and documentation assistance using Perplexity AI. Won 1st @ Cline Hackathon
🛡️ A.I.G(AI-Infra-Guard)
TencentA full-stack AI Red Teaming platform securing AI ecosystems via OpenClaw Security Scan, Agent Scan, Skills Scan, MCP scan, AI Infra scan and LLM jailbreak evaluation.
🔎 GPT Researcher
assafelovicAn autonomous agent that conducts deep research on any data using any LLM providers
meGPT - upload an author's content into an LLM
adriancoCode to process many kinds of content by an author into an MCP server
Intervals.icu MCP Server
mvilanovaModel Context Protocol (MCP) server for connecting Claude and ChatGPT with the Intervals.icu API.
评论