# agentpay MCP server

> Enforces spend policies and budgets for AI agents by acting as a payment gateway between agents and paid APIs.

- Repository: https://github.com/Hellotravisss/agentpay
- Page: https://hostedmcp.org/servers/hellotravisss/agentpay
- Transport: stdio
- Stars: 0
- License: MIT
- Latest version: 0.9.0

## Install

### Claude Code

```sh
claude mcp add --env 'AGENTPAY_API_KEY=<YOUR_AGENTPAY_API_KEY>' agentpay -- npx -y agentpay-gateway
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "agentpay": {
      "command": "npx",
      "args": [
        "-y",
        "agentpay-gateway"
      ],
      "env": {
        "AGENTPAY_API_KEY": "<YOUR_AGENTPAY_API_KEY>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "agentpay": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "agentpay-gateway"
      ],
      "env": {
        "AGENTPAY_API_KEY": "<YOUR_AGENTPAY_API_KEY>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"agentpay","type":"stdio","command":"npx","args":["-y","agentpay-gateway"],"env":{"AGENTPAY_API_KEY":"<YOUR_AGENTPAY_API_KEY>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "agentpay": {
      "command": "npx",
      "args": [
        "-y",
        "agentpay-gateway"
      ],
      "env": {
        "AGENTPAY_API_KEY": "<YOUR_AGENTPAY_API_KEY>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add agentpay --env 'AGENTPAY_API_KEY=<YOUR_AGENTPAY_API_KEY>' -- npx -y agentpay-gateway
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.agentpay]
command = "npx"
args = ["-y", "agentpay-gateway"]

[mcp_servers.agentpay.env]
AGENTPAY_API_KEY = "<YOUR_AGENTPAY_API_KEY>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'AGENTPAY_API_KEY=<YOUR_AGENTPAY_API_KEY>' agentpay npx -- -y agentpay-gateway
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "agentpay": {
      "command": "npx",
      "args": [
        "-y",
        "agentpay-gateway"
      ],
      "env": {
        "AGENTPAY_API_KEY": "<YOUR_AGENTPAY_API_KEY>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `AGENTPAY_API_KEY` | no | yes | Agent key from POST /admin/keys |
| `AGENTPAY_URL` | no | no | agentpay gateway URL |
| `LEDGER_FILE` | no | no |  |
| `X402_PRIVATE_KEY` | no | no |  |

## FAQ

### How does agentpay protect my wallet?

Agents never hold payment credentials or wallets; they call paid resources through the gateway which holds the credentials and enforces policies.

### Can I set limits on how much an agent spends?

Yes, you can define per-transaction maximums, daily budgets, and monthly budgets in a base currency that are enforced across all payment rails.

### What happens if a payment exceeds a certain amount?

You can configure a threshold where payments are held for human review instead of being executed automatically.

### Does it support different currencies?

Yes, it supports multiple payment rails and currencies, using FX conversion to enforce a single base-currency budget.
