Mcpspend
About
MCPSpend is the first cost-observability platform built natively for MCP. One CLI command wraps yourexisting MCP servers across Claude Desktop, Cursor, Windsurf, VS Code, and Claude Code — zero SDKchanges. Per-tool / per-project cost attribution, $ budget alerts via email + Slack
Details
- Author
- andreisirbu91-lab
- Downloads
- 234
- Categories
- Developer Tools
Jump to
- Transparent stdio proxy intercepting every tools/call
- Auto-detects MCP clients on the machine (Claude Desktop, Cursor, Windsurf, etc.)
- Dashboard shows top-N tools by cost with gradient bars
- Sessions view with drill-down into specific agent runs
- Budget projections with Slack alerts at 50/80/100%
- Per-project cost allocation by labeling MCP servers
- Privacy-by-design: never sends tool arguments, responses, or file contents
- 25,000 calls/month on the free tier
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
McpspendCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Run the single command npx @mcpspend/proxy add in the terminal. The CLI auto-detects every MCP client on the machine, lists the servers it found, asks for confirmation, then rewrites the configuration files in-place (with .mcpspend.bak backups) to wrap each server with the transparent proxy. The proxy then streams metadata to api.mcpspend.com/v1/ingest authenticated with your API key.
get_today_cost
Get total tool-call cost and call count for the current day (UTC). Returns a human-readable summary plus structured data.
get_usage_this_month
Returns calls used this month, plan limit, percentage used, and a projection for the rest of the month based on the current daily average. Use this to spot when an org is about to hit the cap.
list_top_tools
Top tools by total cost over the past N days. Optionally limit how many entries to return. Useful for finding "what is the most expensive thing my agents do".
list_recent_sessions
Recent agent sessions (each MCP-client process start = one session) with model, total cost, tool call count, and duration.
get_session_details
Drill into a single session by ID: returns the session summary plus every tool call (up to 500) with timing, cost, and success.
estimate_cost
Estimate the USD cost of an MCP tool call BEFORE invoking it. Returns expected cost based on the historical average for this (server, tool, model) combo in this org over the last 30 days. Use this to make spend-aware decisions — e.g. confirm with the user before calling tools that would cost more than $0.10. Returns 0 + isUnknown=true when no history exists yet.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"mcpspend": {
"mcpspend": {
"command": "npx",
"args": [
"-y",
"@mcpspend/mcp-server@latest"
],
"env": {
"MCPSPEND_API_KEY": "<YOUR_MCPSPEND_API_KEY>"
}
}
}
}
}
McpServers
{
"mcpspend": {
"command": "npx",
"args": [
"-y",
"@mcpspend/mcp-server@latest"
],
"env": {
"MCPSPEND_API_KEY": "<YOUR_MCPSPEND_API_KEY>"
}
}
}
I built MCPSpend because Claude Desktop kept eating my money — here's what I learned
An honest writeup of building the first cost-observability tool for the Model Context Protocol — what worked, what surprised me, and the numbers nobody talks about.
The problem nobody was solving
It's late 2025. I'm running 4 agents in parallel — Claude Desktop, Cursor, Windsurf, plus a few custom MCP servers I wrote for client work. Bills from Anthropic and OpenAI keep climbing. I check the dashboards and see the totals, but I have zero idea which tool call, which server, which project is actually expensive.
Existing AI observability tools fall in two buckets:
LLM-layer: Helicone, Langfuse, Portkey. They see every chat completion. Brilliant. But invisible to the MCP tool layer — they only see "Claude answered the prompt", not "Claude called read_file 47 times to answer it".
Generic analytics: PostHog, Mixpanel. Powerful, but you build the schema yourself. By the time you've instrumented every tools/call, you've shipped half of MCPSpend.
I had two options: stitch something together in spreadsheets every month, or build it.
I built it. Here's what 3 weeks of nights-and-weekends produced.
How MCPSpend works (60 seconds)
npx @mcpspend/proxy add
That's it. One command. The CLI auto-detects Claude Desktop, Cursor, Windsurf, VS Code, and Claude Code on your machine, finds every MCP server you've configured, and rewrites the config to wrap each one with a transparent proxy.
The proxy sits between your MCP client and your MCP server — same stdio protocol, same JSON-RPC messages going through unchanged. But on every tools/call, the proxy records:
Server name + tool name
Latency
Success / error
Approximate payload size (bytes → tokens via per-model estimates)
Then it streams that metadata to api.mcpspend.com/v1/ingest over HTTPS, authenticated with your API key.
What the proxy does not send: the actual tool arguments, the actual tool responses, your file contents, your prompts. Privacy-by-design, not as marketing copy.
The dashboard answers the questions I had
"Which tool is eating my budget?" — top-N tools by cost, with gradient bars showing the relative ratios. The top 3 get amber dots so my eye goes there first.
"How much is each agent run actually costing?" — sessions view with drill-down. I can see one Claude Code session that spent 47 cents over 2 hours, mostly on Playwright browser_navigate.
"Will I hit my budget this month?" — linear projection from the daily average. With Slack alerts at 50/80/100% so I don't get surprised.
"Which customer / project drove this month's bill?" — projects assign each MCP server to a label. Per-project totals. Eventually CSV export for the CFO.
The 3 things that surprised me building this
1. MCP tool calls happen ~30x more than LLM calls
A single prompt to Claude Desktop with "find all the React components that import this hook" triggers maybe one LLM round-trip — but 50-80 MCP tool calls (filesystem reads, greps, etc.). Existing tools that count "requests" undercount AI agent activity by an order of magnitude.
This was the entire reason MCPSpend's free tier is 25,000 calls/month instead of 10K. The unit is fundamentally different.
2. Closed IDEs are a moat, not a limitation
Cursor and Claude Desktop don't expose hooks. You can't wrap the SDK. The only way to observe what they're doing is from outside — by intercepting the MCP protocol.
This is bad news for tools that work via SDK instrumentation (Helicone, Langfuse). It's great news for a transparent stdio proxy — the proxy doesn't care if the consumer is closed source. MCPSpend works in IDEs where every other observability tool is blind. I didn't fully appreciate this until 2 weeks in.
3. Auto-detect saves the product
The first version required users to manually edit JSON config files. Setup took 10 minutes per IDE. Drop-off was brutal.
V2 added add mode that auto-detects every MCP client on your machine, lists the servers it found, asks for confirmation, then rewrites the configs in-place (with .mcpspend.bak backups). Setup is now under 60 seconds. Conversion to "first tool call observed" went from ~30% to ~80%.
If your product depends on config-file editing, autodetect is not nice-to-have — it's the difference between shipping and not shipping.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





