Spend Guard
v0.2.0Budgets, payee allowlists, price-spike checks and human approval for agents paying x402 paywalls
Values you need
| Variable | What it is | |
|---|---|---|
SPEND_GUARD_POLICY | optional | Policy JSON file: networks, budgets, approval amount, spike ratio, known services and their payees. Without one, every payment waits for your approval. |
SPEND_GUARD_RAILS | optional | How 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. Default: mock |
SPEND_GUARD_LEDGER | optional | Decisions 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_PORT | optional | Port 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. Default: 4400 |
SPEND_GUARD_APPROVAL_TIMEOUT | optional | Seconds a payment waits for your answer before it is declined. Raise it together with your client's tool timeout. Default: 55 |
SPEND_GUARD_MOCK_NETWORK | optional | Network the mock rail pretends to pay on. Default: near-testnet |
ARC_PRIVATE_KEY | optional secret | Agent key for the arc and gateway rails. Testnet keys only. |
NEAR_ACCOUNT_ID | optional | Agent account for the near rail (testnet). |
NEAR_PRIVATE_KEY | optional secret | Agent key for the near rail. Testnet keys only. |
npm (npx) discovery passed
Requires Node.js 18+
Run in a terminal
claude mcp add spend-guard -- npx -y @vulinh1704/spend-guard@0.2.0 mcpAdd to
claude_desktop_config.json{
"mcpServers": {
"spend-guard": {
"args": [
"-y",
"@vulinh1704/spend-guard@0.2.0",
"mcp"
],
"command": "npx"
}
}
}Add to
~/.cursor/mcp.json{
"mcpServers": {
"spend-guard": {
"args": [
"-y",
"@vulinh1704/spend-guard@0.2.0",
"mcp"
],
"command": "npx"
}
}
}Add to
.vscode/mcp.json{
"servers": {
"spend-guard": {
"args": [
"-y",
"@vulinh1704/spend-guard@0.2.0",
"mcp"
],
"command": "npx",
"type": "stdio"
}
}
}Add to
~/.codex/config.toml[mcp_servers.spend-guard]
command = "npx"
args = ["-y", "@vulinh1704/spend-guard@0.2.0", "mcp"]For AI agents
- Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
- Restart or reload the client so it starts the server.
- Verify: the server should expose these tools: pay_and_fetch, spending_status, spending_policy.
- If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.
Machine-readable: install.md · manifest.json