Skip to content
MCP server

Spend Guard

Budgets, payee allowlists and human approval for AI agents paying x402 paywalls

Runs locally

Spend Guard is an open-source MCP server for finance and payments. It runs locally on your machine and is started by your AI client.

Pricing
Open source
Platforms
CLI, Self-hosted
Runs
Locally
Version
0.2.0
Listing updated

Similar MCP servers

Install

Add with the CLI

Run in a terminal

claude mcp add spend-guard --env ARC_PRIVATE_KEY='<ARC_PRIVATE_KEY>' --env NEAR_PRIVATE_KEY='<NEAR_PRIVATE_KEY>' -- npx -y @vulinh1704/spend-guard

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

Or share it with your project

Add to .mcp.json

{
  "mcpServers": {
    "spend-guard": {
      "command": "npx",
      "args": [
        "-y",
        "@vulinh1704/spend-guard"
      ],
      "env": {
        "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
        "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
      }
    }
  }
}

Claude Code setup guide

Add to claude_desktop_config.json

{
  "mcpServers": {
    "spend-guard": {
      "command": "npx",
      "args": [
        "-y",
        "@vulinh1704/spend-guard"
      ],
      "env": {
        "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
        "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
      }
    }
  }
}

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

Claude Desktop setup guide

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "spend-guard": {
      "command": "npx",
      "args": [
        "-y",
        "@vulinh1704/spend-guard"
      ],
      "env": {
        "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
        "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
      }
    }
  }
}

Use .cursor/mcp.json in a project to share it with the project.

Cursor setup guide

Add to ~/.copilot/mcp-config.json

{
  "mcpServers": {
    "spend-guard": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@vulinh1704/spend-guard"
      ],
      "env": {
        "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
        "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
      }
    }
  }
}

Or put the same entry in .mcp.json at your workspace root to share it.

VS Code setup guide

Add with the CLI

Run in a terminal

codex mcp add spend-guard --env ARC_PRIVATE_KEY='<ARC_PRIVATE_KEY>' --env NEAR_PRIVATE_KEY='<NEAR_PRIVATE_KEY>' -- npx -y @vulinh1704/spend-guard

Or add to config.toml

Add to ~/.codex/config.toml

[mcp_servers.spend-guard]
command = "npx"
args = ["-y", "@vulinh1704/spend-guard"]
env = { ARC_PRIVATE_KEY = "<ARC_PRIVATE_KEY>", NEAR_PRIVATE_KEY = "<NEAR_PRIVATE_KEY>" }

Codex setup guide

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "spend-guard": {
      "command": "npx",
      "args": [
        "-y",
        "@vulinh1704/spend-guard"
      ],
      "env": {
        "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
        "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
      }
    }
  }
}
  • Gemini CLI and Antigravity

    Gemini CLI

    Add to ~/.gemini/settings.json

    {
      "mcpServers": {
        "spend-guard": {
          "command": "npx",
          "args": [
            "-y",
            "@vulinh1704/spend-guard"
          ],
          "env": {
            "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
            "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
          }
        }
      }
    }

    Or run: gemini mcp add -s user -e ARC_PRIVATE_KEY='<ARC_PRIVATE_KEY>' -e NEAR_PRIVATE_KEY='<NEAR_PRIVATE_KEY>' spend-guard npx -- -y @vulinh1704/spend-guard

    Antigravity

    Add to ~/.gemini/config/mcp_config.json

    {
      "mcpServers": {
        "spend-guard": {
          "command": "npx",
          "args": [
            "-y",
            "@vulinh1704/spend-guard"
          ],
          "env": {
            "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
            "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
          }
        }
      }
    }

    Use .agents/mcp_config.json to add it to one workspace only.

    Gemini CLI and Antigravity setup guide

  • Devin Desktop (formerly Windsurf)

    Add to ~/.config/devin/mcp_config.json

    {
      "mcpServers": {
        "spend-guard": {
          "command": "npx",
          "args": [
            "-y",
            "@vulinh1704/spend-guard"
          ],
          "env": {
            "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
            "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
          }
        }
      }
    }

    On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

    Devin Desktop setup guide

  • Cline

    Add to cline_mcp_settings.json

    {
      "mcpServers": {
        "spend-guard": {
          "command": "npx",
          "args": [
            "-y",
            "@vulinh1704/spend-guard"
          ],
          "env": {
            "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
            "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
          }
        }
      }
    }

    Open it from the MCP Servers icon → Configure → Configure MCP Servers.

    Cline setup guide

  • Zed

    Add to Zed settings.json

    {
      "context_servers": {
        "spend-guard": {
          "command": "npx",
          "args": [
            "-y",
            "@vulinh1704/spend-guard"
          ],
          "env": {
            "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
            "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
          }
        }
      }
    }

    Open it with zed: open settings file. Merge context_servers into the settings you already have.

    Zed setup guide

  • JetBrains AI Assistant and Junie

    AI Assistant

    Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add

    {
      "mcpServers": {
        "spend-guard": {
          "command": "npx",
          "args": [
            "-y",
            "@vulinh1704/spend-guard"
          ],
          "env": {
            "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
            "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
          }
        }
      }
    }

    The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

    Junie

    Add to ~/.junie/mcp/mcp.json

    {
      "mcpServers": {
        "spend-guard": {
          "command": "npx",
          "args": [
            "-y",
            "@vulinh1704/spend-guard"
          ],
          "env": {
            "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
            "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
          }
        }
      }
    }

    Use .junie/mcp/mcp.json to share it with a project.

    JetBrains AI Assistant and Junie setup guide

  • Kiro

    Add to ~/.kiro/settings/mcp.json

    {
      "mcpServers": {
        "spend-guard": {
          "command": "npx",
          "args": [
            "-y",
            "@vulinh1704/spend-guard"
          ],
          "env": {
            "ARC_PRIVATE_KEY": "<ARC_PRIVATE_KEY>",
            "NEAR_PRIVATE_KEY": "<NEAR_PRIVATE_KEY>"
          }
        }
      }
    }

    Use .kiro/settings/mcp.json to add it to one workspace only.

    Kiro setup guide

Using several servers? Build one config file with the MCP config generator.

Configuration

  • SPEND_GUARD_POLICYPolicy JSON file: networks, budgets, approval amount, spike ratio, known services and their payees. Without one, every payment waits for your approval.
  • SPEND_GUARD_RAILSHow to pay: mock (pays nothing), near, arc, gateway, or a comma list. arc and gateway need ARC_PRIVATE_KEY, near needs NEAR_ACCOUNT_ID and NEAR_PRIVATE_KEY.
  • SPEND_GUARD_LEDGERDecisions file, read back on start so a restart keeps today's spend; servers on one file share one budget. Default ~/.spend-guard/ledger.jsonl; off keeps it in memory.
  • SPEND_GUARD_DASHBOARD_PORTPort of the approval dashboard on 127.0.0.1. 0 picks a free one; off means no dashboard, and payments that need approval are declined.
  • SPEND_GUARD_APPROVAL_TIMEOUTSeconds a payment waits for your answer before it is declined. Raise it together with your client's tool timeout.
  • SPEND_GUARD_MOCK_NETWORKNetwork the mock rail pretends to pay on.
  • ARC_PRIVATE_KEYAgent key for the arc and gateway rails. Testnet keys only.
  • NEAR_ACCOUNT_IDAgent account for the near rail (testnet).
  • NEAR_PRIVATE_KEYAgent key for the near rail. Testnet keys only.

About Spend Guard

An agent that can pay per call over HTTP 402 can also be talked into overpaying. Spend Guard sits in front of the payment and decides before anything is signed: per-payment limits, a daily budget, a per-service cap, a payee allowlist, a price-spike check against an endpoint's usual price, and human approval above a threshold or for unknown hosts.

In the README demo it refuses a 40x price spike and a swapped payout address, and holds a $0.30 payment for Approve or Deny on a local dashboard, declining after 120 seconds. Every decision is logged with its reasons.

It supports USDC and NEAR rails, including x402 exact on Arc testnet. The README labels it testnet-only and not audited; it is MIT licensed and needs Node 22.22.2 or later.

What it does

Spending limits
Per-payment, daily and per-service caps.
Payee allowlist
Blocks a paywall that asks to be paid elsewhere.
Price-spike check
Flags jumps from an endpoint's usual price.
Human approval
Dashboard approval above a threshold.
Decision ledger
Every decision recorded with reasons.

Good for

  • Cap what an agent can spend on paid APIs
  • Stop payments after a prompt injection redirects an agent
  • Review large payments before they are signed

Pricing

Open source

MIT licensed, free

Spend Guard FAQ

Is Spend Guard production ready?

No. The README says testnet only and not audited.

Which licence?

MIT.

Do I need keys to try Spend Guard?

No. The quickstart demo uses mocked payments.

What if nobody answers an approval?

The demo declines it after 120 seconds.

Is Spend Guard free?

Yes. Spend Guard is open source, so you can use and self-host it for free.

How do I add Spend Guard to Claude Code?

Run this command in your terminal: claude mcp add spend-guard --env ARC_PRIVATE_KEY='<ARC_PRIVATE_KEY>' --env NEAR_PRIVATE_KEY='<NEAR_PRIVATE_KEY>' -- npx -y @vulinh1704/spend-guard

What are the best alternatives to Spend Guard?

The closest alternatives to Spend Guard are REA, Solana MCP by Vybe, AiSOC, x64dbg-mcp-server and redamon.

Where this comes from

  • Description: written from the project's README.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers