Skip to content
MCP server

A402 Pay MCP

MCP server that pays x402 APIs on Solana from your own wallet under strict spending rules

Runs locally
Install

A402 Pay MCP is an open-source MCP server for agent payments. It runs locally on your machine and is started by your AI client.

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

Similar MCP servers

Install

Run in a terminal

claude mcp add a402-pay-mcp --env X402_RPC_URL='<X402_RPC_URL>' -- npx -y @agent402-dev/pay-mcp

Add to claude_desktop_config.json

{
  "mcpServers": {
    "a402-pay-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@agent402-dev/pay-mcp"
      ],
      "env": {
        "X402_RPC_URL": "<X402_RPC_URL>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "a402-pay-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@agent402-dev/pay-mcp"
      ],
      "env": {
        "X402_RPC_URL": "<X402_RPC_URL>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "a402-pay-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@agent402-dev/pay-mcp"
      ],
      "env": {
        "X402_RPC_URL": "<X402_RPC_URL>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "a402-pay-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@agent402-dev/pay-mcp"
      ],
      "env": {
        "X402_RPC_URL": "<X402_RPC_URL>"
      }
    }
  }
}

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

{
  "mcpServers": {
    "a402-pay-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@agent402-dev/pay-mcp"
      ],
      "env": {
        "X402_RPC_URL": "<X402_RPC_URL>"
      }
    }
  }
}

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

Configuration

  • X402_KEYPAIR_PATHPath to the payment wallet key file (Solana CLI JSON). Without it nothing is paid.
  • X402_ALLOWED_DOMAINSAllowed domains, comma-separated. Empty: every payment refused.
  • X402_TRUSTED_PAY_TOTrusted recipient addresses, comma-separated. Empty: every payment refused.
  • X402_ALLOWED_ASSETSUSDC (default) or USDC,A402
  • X402_MAX_USDMax USDC per payment in USD (default 0.05)
  • X402_MAX_USD_PER_DAYMax USDC per UTC day in USD (default 1)
  • X402_MAX_PAYMENTS_PER_DAYMax payments per UTC day (default 20)
  • X402_MAX_A402_ATOMICMax A402 per payment, in A402 smallest units (1 A402 = 1,000,000). Not set: A402 refused.
  • X402_MAX_A402_PER_DAY_ATOMICMax A402 per UTC day, in A402 smallest units (1 A402 = 1,000,000). Not set: A402 refused.
  • X402_CONFIRM_ABOVE_USDAsk a human at or above this USDC amount (USD). Default off.
  • X402_CONFIRM_ABOVE_A402_ATOMICAsk a human at or above this A402 amount (A402 smallest units). Default off.
  • X402_NETWORKmainnet or devnet
  • X402_RPC_URLSolana RPC URL used to build payment transactions
  • X402_PAY_WITHPreferred asset: USDC or A402
  • X402_HISTORY_PATHLocal payment log (JSONL). Daily limits are counted from this file.

About A402 Pay MCP

The README says this server lets an AI agent call x402 paid HTTP APIs on Solana and settle in USDC, or in A402 if you explicitly enable it. Payments are signed from a wallet key file on your own machine, and nothing is signed unless every configured rule passes. Out of the box, with no allowlists set, every payment is refused.

Each request is checked against allowed domains, trusted recipient addresses, per-payment and per-day USDC caps, a daily payment count, and optional human confirmation through MCP elicitation. A402 has its own two limits, both of which must be set before any A402 payment is made. The server also keeps a local JSONL payment log, and daily totals are counted from that file.

It suits developers and operators who want an agent to buy API access without giving it an open-ended wallet. The project's documentation stresses using a small, dedicated wallet, since the server does not hold funds, run a facilitator, or exchange currencies.

Tools this server provides (4)

Taken from the project documentation; the running server may differ.

x402_fetch
Fetch a URL and pay only if the rules pass.
x402_quote
Show payment requirements and which rules pass; never signs; returns quoteId.
wallet_status
Show address, balances, today's usage, limits and allowlists.
payment_history
Show the local payment log.

What it does

Rules checked before signing
Every payment must pass domain, recipient, asset and amount rules before a transaction is signed.
Default-deny configuration
With no allowlists configured, all payments are refused until the user sets them.
Spending caps
Per-payment and per-UTC-day USDC limits, plus a daily payment count, bound total exposure.
Human confirmation option
Payments at or above a set amount can require approval via MCP elicitation.
Quote binding
Passing a quoteId from x402_quote refuses payment if the amount, asset or recipient changed.
Local payment history
A payment_history tool reads a local log that never stores keys or signed payloads.

Good for

  • Let an agent pay small per-call fees for x402-protected APIs within a fixed daily budget
  • Check payment requirements for a URL with x402_quote before deciding whether to pay
  • Review recent agent payments and settlement transaction IDs from a local log
  • Restrict an agent to a short list of approved API domains and recipient addresses

Pricing

Open source

Free and open source under Apache-2.0; pays x402 API fees from the user's own wallet.

A402 Pay MCP FAQ

What happens if I do not configure any limits or allowlists?

Every payment is refused. The README says the allowed domains and trusted recipient variables must be set, and without them nothing is paid.

Can A402 Pay MCP pay in A402 as well as USDC?

Yes, but only if A402 is listed in the allowed assets and both A402 limits are set. Otherwise A402 payments are refused.

Does the server hold funds or evaluate the APIs A402 Pay MCP pays?

No. The README states it does not hold funds, operate a facilitator, or judge tokens or APIs, and it signs from the user's own wallet.

How do I install A402 Pay MCP?

The README gives Claude Code and Claude Desktop examples that run the npm package with npx, and requires Node 20 or newer.

Is A402 Pay MCP free?

Yes. A402 Pay MCP is open source, so you can use and self-host it for free.

How do I add A402 Pay MCP to Claude Code?

Run this command in your terminal: claude mcp add a402-pay-mcp --env X402_RPC_URL='<X402_RPC_URL>' -- npx -y @agent402-dev/pay-mcp

What are the best alternatives to A402 Pay MCP?

The closest alternatives to A402 Pay MCP are X402 Payagent MCP, X402engine MCP, Hilt Pay Agent Commerce, AgnicPay and Clawpay.

Where this comes from

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

How AIPoweredBot checks servers