Claude Code MCP
The StackSpend MCP server exposes your cost data inside Claude Code. Query spend, rollups, and anomalies in natural language without leaving your terminal.
What it does
The StackSpend MCP server implements the Model Context Protocol so that Claude Code can read your StackSpend data as context. Once configured, you can ask Claude about your cloud costs — by provider, service, date range, or anomaly status — and get answers grounded in your actual spend data.
The server exposes three resource types: line items (individual cost records), rollups (aggregated spend by provider or service), and anomalies (detected spend spikes).
Setup
Install the MCP server
Install the package globally with npm:
npm install -g @stackspend/mcp-serverCreate an API key
Go to Settings → API → API Keys and click Create key. Give it a name like "Claude Code MCP" and enable the following scopes:
line_items:readrollups:readanomalies:read
Copy the key — it is shown once. Store it somewhere safe.
Add to Claude Code MCP config
Open your Claude Code settings file (typically ~/.claude/settings.json) and add the StackSpend entry under mcp_servers:
{
"mcp_servers": {
"stackspend": {
"command": "npx",
"args": ["@stackspend/mcp-server"],
"env": {
"STACKSPEND_API_KEY": "your_api_key_here"
}
}
}
}npm install -g, you can also set "command": "stackspend-mcp" directly instead of using npx.Restart Claude Code
Quit and reopen Claude Code. The StackSpend MCP server will start automatically. You should see it listed in /mcp status output.
What you can ask
Once connected, ask Claude anything about your spend data in plain language:
- "What's my AWS spend this month?"
- "Which OpenAI models are most expensive?"
- "Are there any open anomalies?"
- "Show me yesterday's spend by provider."
- "Which service had the biggest cost increase last week?"
- "What's my total AI spend across all providers this quarter?"
