# mcpspend

Tracks MCP tool call costs across your coding agents and lets you inspect spending directly in the chat. Useful for catching runaway token bills early.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 66
- Author: andreisirbu91-lab
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/andreisirbu91-lab/MCPSpend
- Updated: 2026-08-31
- HTML: https://affpapa.org/en/nevibecode/mcp/mcpspend

## What it does

This server connects your client to `mcpspend.com`, letting an assistant run queries like `get_today_cost` and `list_top_tools`. Data collection happens through the companion `@mcpspend/proxy`, which wraps existing tool configurations to record latency, tool names, models, and rough token counts based on payload length.

Tool arguments and raw output bodies stay on your local disk; only aggregated metadata reaches the ingestion endpoint. Running the server requires an `MCPSPEND_API_KEY`. The free plan covers 25,000 tool executions per month without entering payment details.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `MCPSPEND_API_KEY`, `MCPSPEND_ENDPOINT` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env MCPSPEND_API_KEY=<MCPSPEND_API_KEY> --env MCPSPEND_ENDPOINT=<MCPSPEND_ENDPOINT> --transport stdio mcpspend -- npx -y @mcpspend/mcp-server
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add mcpspend --env MCPSPEND_API_KEY=<MCPSPEND_API_KEY> --env MCPSPEND_ENDPOINT=<MCPSPEND_ENDPOINT> -- npx -y @mcpspend/mcp-server
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "mcpspend": {
            "command": "npx",
            "args": [
                "-y",
                "@mcpspend/mcp-server"
            ],
            "env": {
                "MCPSPEND_API_KEY": "<MCPSPEND_API_KEY>",
                "MCPSPEND_ENDPOINT": "<MCPSPEND_ENDPOINT>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "mcpspend": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@mcpspend/mcp-server"
            ],
            "env": {
                "MCPSPEND_API_KEY": "<MCPSPEND_API_KEY>",
                "MCPSPEND_ENDPOINT": "<MCPSPEND_ENDPOINT>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e MCPSPEND_API_KEY=<MCPSPEND_API_KEY> -e MCPSPEND_ENDPOINT=<MCPSPEND_ENDPOINT> mcpspend npx -y @mcpspend/mcp-server
```
Replace <…> with your own values

## When to use it
- check current day tool spending inside the agent conversation
- spot the most heavily invoked MCP tools across your setup
- forecast monthly budget usage before hitting billing limits
- inspect session activity without leaving the terminal

## Example prompts
- How much did my MCP tool calls cost today?
- List the top tools by invocation count from recent sessions.
- What is my projected spend for this month?

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
