Skip to main content

Documentation Index

Fetch the complete documentation index at: https://spendguard.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

SpendGuard includes an MCP (Model Context Protocol) server that lets AI agents like Claude check financial actions, create policies, and inspect violations through natural conversation. Instead of writing code to call the API, your AI agent discovers SpendGuard’s tools automatically and uses them when relevant.

What You Get

The MCP server exposes 5 tools:
ToolWhat It DoesAPI Endpoint
check_financial_actionCheck if an action is allowedPOST /v1/checks
create_policyCreate or update a policyPOST /v1/policies
get_policyRetrieve a policy and its rulesGET /v1/policies/{id}
simulate_actionsTest actions with no side effectsPOST /v1/simulate
list_violationsView blocked/escalated audit logGET /v1/violations

Setup for Claude Desktop

1. Find the config file

On macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
On Windows:
%APPDATA%\Claude\claude_desktop_config.json

2. Add the SpendGuard server

{
  "mcpServers": {
    "spendguard": {
      "command": "/path/to/your/.venv/bin/python",
      "args": ["/path/to/mcp/server.py"],
      "env": {
        "SPENDGUARD_API_URL": "https://spendguardapi.com",
        "SPENDGUARD_API_KEY": "sg_live_your_key_here"
      }
    }
  }
}
Replace /path/to/your/.venv/bin/python with the actual path to your Python environment that has the mcp and httpx packages installed. Replace /path/to/mcp/server.py with the actual path to the SpendGuard MCP server file.

3. Restart Claude Desktop

After saving the config, fully quit and reopen Claude Desktop. The SpendGuard tools will appear in the tools menu.

Setup for Claude Code

Add to your project’s MCP settings (.claude/settings.json):
{
  "mcpServers": {
    "spendguard": {
      "command": "/path/to/your/.venv/bin/python",
      "args": ["/path/to/mcp/server.py"],
      "env": {
        "SPENDGUARD_API_URL": "https://spendguardapi.com",
        "SPENDGUARD_API_KEY": "sg_live_your_key_here"
      }
    }
  }
}

Example Conversations

Once connected, you can talk to Claude naturally and it will use SpendGuard tools when relevant:

Checking an action

You: “Can our support agent refund $350 to customer_7821? The order is 12 days old.” Claude: uses check_financial_action “The refund requires human approval — 350exceedsthe350 exceeds the 200 auto-approve threshold. The order is within the 30-day window, so it’s eligible once a manager approves.”

Testing a policy

You: “Simulate what would happen if we tried to refund $750 to customer_456 using the support refund policy.” Claude: uses simulate_actions “That refund would be blocked — 750exceedsthe750 exceeds the 500 maximum amount limit. The customer would need to contact a manager for a refund that large.”

Reviewing violations

You: “Show me what our support agent has been blocked on recently.” Claude: uses list_violations “In the last 24 hours, support-agent-v1 had 3 blocks: two for exceeding the $500 refund limit and one duplicate action detection.”

Environment Variables

VariableRequiredDescription
SPENDGUARD_API_URLYesYour SpendGuard API URL (e.g., https://spendguardapi.com)
SPENDGUARD_API_KEYYes*Your API key. *Not needed for simulate_actions in demo mode.

Requirements

The MCP server requires these Python packages:
mcp
httpx
Install them in your Python environment:
pip install mcp httpx

Running Manually (for Testing)

You can run the MCP server directly to verify it starts:
SPENDGUARD_API_URL=https://spendguardapi.com \
SPENDGUARD_API_KEY=sg_live_your_key_here \
python mcp/server.py
The server communicates over stdio (stdin/stdout) per the MCP protocol. You won’t see output in the terminal — it’s designed to be called by an AI client like Claude.