StackSpendDocs

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).

Business plan required.The MCP server uses the StackSpend public API, which requires a Business plan subscription.

Setup

1

Install the MCP server

Install the package globally with npm:

npm install -g @stackspend/mcp-server
2

Create 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:read
  • rollups:read
  • anomalies:read

Copy the key — it is shown once. Store it somewhere safe.

3

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"
      }
    }
  }
}
Tip.If you installed globally with npm install -g, you can also set "command": "stackspend-mcp" directly instead of using npx.
4

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?"
Direct API access.The MCP server uses the same public API endpoints that are available to all Business plan subscribers. You can also call those endpoints directly for custom integrations, scripts, or dashboards.
Claude Code MCP — StackSpend Docs — StackSpend Docs