AI expense tracker for MCP

If your product calls AI agents on behalf of customers, you need to know which customer cost you how much. MCPSpend is an AI expense tracker built around the MCP tool-call as the unit of attribution.

Why per-tool-call attribution beats per-LLM-call

LLM observability tools (Helicone, Langfuse) track the chat completion. In an agentic workload, the chat completion is 15-25% of total cost. The other 75-85% is MCP tool calls — and they're what actually varies between customers.

Customer A asks: "What's in this CSV?" — one filesystem call, one chat completion. ~$0.02 total.

Customer B asks: "Audit our entire codebase for security issues." — 80 filesystem reads, 15 github calls, 5 web searches, 10 LLM round trips. ~$1.80 total.

Same product, 90× cost difference. You can't see that on an Anthropic invoice. You can't see it with LLM-only observability. You need per-tool-call attribution.

How attribution works in MCPSpend

Every tool call carries three identifiers we can index on:

The dashboard then slices spend by any combination. Example: "show me the top 10 customers by last-7-days agent cost, filtered to agents named onboarding_*".

Wiring it into a multi-tenant product

If you spawn agent sessions per customer request, pass tenant identifiers as env vars when launching the MCP proxy subprocess:

MCPSPEND_API_KEY=mcps_live_xxx \
MCPSPEND_PROJECT_ID="$CUSTOMER_ID" \
MCPSPEND_AGENT_NAME="$AGENT_KIND" \
npx -y @mcpspend/proxy wrap -- npx -y @modelcontextprotocol/server-filesystem /data

Spend now flows tagged in real-time. You can showback, alert, or bill from it.

What teams build with this

  1. Customer-level showback. Internal Looker / Metabase dashboard fed from MCPSpend's public stats API. "Customer ACME spent $312 on agent activity this month."
  2. Per-feature unit economics. Tag agent sessions with the product feature that spawned them. "Our AI summarizer feature costs $0.04/query — at $4/month it's profitable above 10 queries."
  3. Anomaly detection. A Slack alert when a customer's agent cost is 3× their 14-day baseline. Almost always means a runaway loop or new heavy workflow.
  4. Margin guardrails. Block agent sessions for customers who've exceeded their plan's included AI budget for the month. Hard cap before negative-margin events.

What MCPSpend doesn't do

Start tracking

npx --yes @mcpspend/proxy@latest init --key mcps_live_xxx

25,000 calls / month free. For teams crossing that, Pro at $29/mo covers 500K calls and Team at $99/mo covers 2.5M. See pricing →

Enterprise (custom volume, dedicated infra, signed DPA, audit log retention > 12 months) — see /enterprise.

Track your own MCP spend — free

One command wraps every MCP client on your machine. 25,000 tool calls/month on the free tier. No card.

Related guides