# x402 Wallet

Let an AI agent find x402 services, check prices, and pay for calls in USDC from a Solana wallet. Set a wallet key to enable payments.

- 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/packages/x402-mcp
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/x402-wallet

## What it does

x402 Wallet gives an agent tools to search the x402 service directory, inspect an endpoint’s payment terms, and call a paid service. Named tools cover tasks such as weather forecasts, research and book searches, news, transit, and places. The server can also show wallet balances and payment totals.

Payments require `SOLANA_SECRET_KEY`; service discovery and endpoint inspection do not. The server settles only Solana `exact`-scheme payments and checks the price before funds move. It rejects amounts above `MAX_PAY_USD`, which defaults to $1. With `REQUIRE_CONFIRM` enabled, a payment call also needs `confirm: true`. Your key signs the payment.

For Claude Code, add the server with `npx -y @three-ws/x402-mcp`. You can configure `SOLANA_RPC_URL`, a spending cap, and confirmation requirements. Setup commands are also provided for Codex and other supported editors.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `SOLANA_SECRET_KEY`, `SOLANA_RPC_URL`, `MAX_PAY_USD`, `REQUIRE_CONFIRM`, `THREE_WS_BASE` — 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 SOLANA_SECRET_KEY=<SOLANA_SECRET_KEY> --env SOLANA_RPC_URL=<SOLANA_RPC_URL> --env MAX_PAY_USD=<MAX_PAY_USD> --env REQUIRE_CONFIRM=<REQUIRE_CONFIRM> --env THREE_WS_BASE=<THREE_WS_BASE> --transport stdio x402-mcp -- npx -y @three-ws/x402-mcp
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add x402-mcp --env SOLANA_SECRET_KEY=<SOLANA_SECRET_KEY> --env SOLANA_RPC_URL=<SOLANA_RPC_URL> --env MAX_PAY_USD=<MAX_PAY_USD> --env REQUIRE_CONFIRM=<REQUIRE_CONFIRM> --env THREE_WS_BASE=<THREE_WS_BASE> -- npx -y @three-ws/x402-mcp
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "x402-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@three-ws/x402-mcp"
            ],
            "env": {
                "SOLANA_SECRET_KEY": "<SOLANA_SECRET_KEY>",
                "SOLANA_RPC_URL": "<SOLANA_RPC_URL>",
                "MAX_PAY_USD": "<MAX_PAY_USD>",
                "REQUIRE_CONFIRM": "<REQUIRE_CONFIRM>",
                "THREE_WS_BASE": "<THREE_WS_BASE>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "x402-mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@three-ws/x402-mcp"
            ],
            "env": {
                "SOLANA_SECRET_KEY": "<SOLANA_SECRET_KEY>",
                "SOLANA_RPC_URL": "<SOLANA_RPC_URL>",
                "MAX_PAY_USD": "<MAX_PAY_USD>",
                "REQUIRE_CONFIRM": "<REQUIRE_CONFIRM>",
                "THREE_WS_BASE": "<THREE_WS_BASE>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e SOLANA_SECRET_KEY=<SOLANA_SECRET_KEY> -e SOLANA_RPC_URL=<SOLANA_RPC_URL> -e MAX_PAY_USD=<MAX_PAY_USD> -e REQUIRE_CONFIRM=<REQUIRE_CONFIRM> -e THREE_WS_BASE=<THREE_WS_BASE> x402-mcp npx -y @three-ws/x402-mcp
```
Replace <…> with your own values

## When to use it
- search the x402 directory for paid HTTP and MCP services
- inspect an endpoint’s price before paying
- call a service and settle its fee in USDC
- check a wallet balance and review payment totals

## Example prompts
- Find x402 services that can search academic papers.
- Inspect this endpoint’s payment terms without paying.
- Call the weather forecast service and return its result.

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