# x402 Universal Payer

An MCP server that settles x402 payments for your agent: it signs, retries and returns the response with a settlement receipt, under spending caps.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 249
- Author: nirholas
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/nirholas/three.ws/tree/HEAD/mcp-bridge
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/x402-universal-payer

## What it does

Point your agent at a URL that answers `402 Payment Required`. The bridge signs the payment, retries the request and hands back the response plus a parsed settlement. EVM exact, EVM batch-settlement and Solana exact are all supported.

Four tools ship with it. `call_paid_endpoint` is the fallback: any URL, auto-pay on 402. `list_bazaar_tools` returns the cached Bazaar list and `refresh_bazaar` re-queries the feed and re-registers tools without a restart — both free. On top of that you get one tool per discovered Bazaar resource, up to `MCP_BRIDGE_DISCOVER_LIMIT`. Anything priced above the per-call cap is dropped at discovery time.

The server holds private keys and spends real USDC, so use a dedicated wallet with a small balance. At least one of `MCP_BRIDGE_EVM_PRIVATE_KEY` or `MCP_BRIDGE_SVM_PRIVATE_KEY` is required. `MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC` caps a single payment, `MCP_BRIDGE_MAX_TOTAL_ATOMIC` caps the whole session — once hit, further payments abort until restart. Payee and host allowlists are available, and outbound URLs are checked against private and loopback addresses. Retrying a paid call is a new charge.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `MCP_BRIDGE_EVM_PRIVATE_KEY`, `MCP_BRIDGE_SVM_PRIVATE_KEY`, `MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC`, `MCP_BRIDGE_MAX_TOTAL_ATOMIC`, `MCP_BRIDGE_ALLOWED_PAYTO`, `MCP_BRIDGE_ALLOWED_HOSTS`, `MCP_BRIDGE_ALLOW_HTTP`, `MCP_BRIDGE_DISCOVER_LIMIT`, `MCP_BRIDGE_BAZAAR_URL`, `MCP_BRIDGE_BATCH_DEPOSIT_MULTIPLIER` — 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 MCP_BRIDGE_EVM_PRIVATE_KEY=<MCP_BRIDGE_EVM_PRIVATE_KEY> --env MCP_BRIDGE_SVM_PRIVATE_KEY=<MCP_BRIDGE_SVM_PRIVATE_KEY> --env MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC=<MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC> --env MCP_BRIDGE_MAX_TOTAL_ATOMIC=<MCP_BRIDGE_MAX_TOTAL_ATOMIC> --env MCP_BRIDGE_ALLOWED_PAYTO=<MCP_BRIDGE_ALLOWED_PAYTO> --transport stdio mcp-bridge -- npx -y @three-ws/mcp-bridge
```
Replace <…> with your own values. 8 more environment variables are in the server README

### Codex

**Platform CLI**
```bash
codex mcp add mcp-bridge --env MCP_BRIDGE_EVM_PRIVATE_KEY=<MCP_BRIDGE_EVM_PRIVATE_KEY> --env MCP_BRIDGE_SVM_PRIVATE_KEY=<MCP_BRIDGE_SVM_PRIVATE_KEY> --env MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC=<MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC> --env MCP_BRIDGE_MAX_TOTAL_ATOMIC=<MCP_BRIDGE_MAX_TOTAL_ATOMIC> --env MCP_BRIDGE_ALLOWED_PAYTO=<MCP_BRIDGE_ALLOWED_PAYTO> -- npx -y @three-ws/mcp-bridge
```
Replace <…> with your own values. 8 more environment variables are in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "mcp-bridge": {
            "command": "npx",
            "args": [
                "-y",
                "@three-ws/mcp-bridge"
            ],
            "env": {
                "MCP_BRIDGE_EVM_PRIVATE_KEY": "<MCP_BRIDGE_EVM_PRIVATE_KEY>",
                "MCP_BRIDGE_SVM_PRIVATE_KEY": "<MCP_BRIDGE_SVM_PRIVATE_KEY>",
                "MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC": "<MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC>",
                "MCP_BRIDGE_MAX_TOTAL_ATOMIC": "<MCP_BRIDGE_MAX_TOTAL_ATOMIC>",
                "MCP_BRIDGE_ALLOWED_PAYTO": "<MCP_BRIDGE_ALLOWED_PAYTO>"
            }
        }
    }
}
```
Replace <…> with your own values. 8 more environment variables are in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "mcp-bridge": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@three-ws/mcp-bridge"
            ],
            "env": {
                "MCP_BRIDGE_EVM_PRIVATE_KEY": "<MCP_BRIDGE_EVM_PRIVATE_KEY>",
                "MCP_BRIDGE_SVM_PRIVATE_KEY": "<MCP_BRIDGE_SVM_PRIVATE_KEY>",
                "MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC": "<MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC>",
                "MCP_BRIDGE_MAX_TOTAL_ATOMIC": "<MCP_BRIDGE_MAX_TOTAL_ATOMIC>",
                "MCP_BRIDGE_ALLOWED_PAYTO": "<MCP_BRIDGE_ALLOWED_PAYTO>"
            }
        }
    }
}
```
Replace <…> with your own values. 8 more environment variables are in the server README

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e MCP_BRIDGE_EVM_PRIVATE_KEY=<MCP_BRIDGE_EVM_PRIVATE_KEY> -e MCP_BRIDGE_SVM_PRIVATE_KEY=<MCP_BRIDGE_SVM_PRIVATE_KEY> -e MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC=<MCP_BRIDGE_MAX_PRICE_PER_CALL_ATOMIC> -e MCP_BRIDGE_MAX_TOTAL_ATOMIC=<MCP_BRIDGE_MAX_TOTAL_ATOMIC> -e MCP_BRIDGE_ALLOWED_PAYTO=<MCP_BRIDGE_ALLOWED_PAYTO> mcp-bridge npx -y @three-ws/mcp-bridge
```
Replace <…> with your own values. 8 more environment variables are in the server README

## When to use it
- pay a paid API from inside the agent without a manual invoice
- get the response and settlement receipt from an x402 endpoint
- cap agent spending per call and per session
- expose x402 Bazaar services as ready-made tools
- block payments to untrusted addresses and hosts

## Example prompts
- Pay $0.01 on Base for a weather report and show me the receipt
- Refresh the Bazaar tool list with `refresh_bazaar`
- Call `call_paid_endpoint` on this URL and return the response

## 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

From the same set: [nirholas/three.ws](https://affpapa.org/en/nevibecode/by/nirholas/three.ws.md) — 43 cards

---
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
