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:
- Project ID — tag the proxy with
MCPSPEND_PROJECT_ID=customer_acme - Agent name — tag with
MCPSPEND_AGENT_NAME=onboarding_bot - Session ID — auto-generated per MCP client process start
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
- Customer-level showback. Internal Looker / Metabase dashboard fed from MCPSpend's public stats API. "Customer ACME spent $312 on agent activity this month."
- 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."
- 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.
- 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
- We don't see your customer's data — only the tool envelope (which server, which tool, latency, byte counts).
- We don't bill your customers — that's your Stripe / billing stack. We give you the cost numbers.
- We're not a tracing tool. For full agent traces, pair with Langfuse or your own OpenTelemetry stack.
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.