# X402ai MCP

> X402ai MCP is an open-source MCP server for finance and payments. Pay-per-call embed, summarize and ask tools paid in USDC on Base, plus an x402 inspector. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Self-hosted, macOS, Windows, Linux
- **Repository:** https://github.com/ukenal/x402ai-mcp
- **MCP Registry name:** io.github.ukenal/x402ai-mcp
- **Categories:** [finance and payments](https://ai-powered.com/categories/finance-and-payments), [AI models and LLM tooling](https://ai-powered.com/categories/ai-and-llm)
- **Listing updated:** 2026-11-23

## About

Each paid call costs a few cents: embedding is $0.01, summarizing $0.02 and a short answer $0.04. The server answers an HTTP 402 payment challenge by signing a USDC authorization with a buyer key you supply, so there is no account and nothing hosted for you. Payments are gasless for the payer, so the wallet needs USDC but no ETH.

Because the key can spend money, the README pushes hard on safeguards. Use a dedicated wallet with a few dollars at most. Before signing, each tool checks the network, token, payment address and route, with a $0.04 per-payment limit, and a session cap defaults to $0.25. A dry-run mode quotes prices without signing, and authorizations expire within 300 seconds.

The free inspect tool takes a URL, decodes its 402 challenge and runs Coinbase's x402 validator, which means the URL is sent to Coinbase. The ask tool has no web access or memory and can be wrong. It needs Node.js 20 or later and is MIT licensed.

## Features

- **Text embeddings:** Returns 768-dimension embeddings from nomic-embed-text for $0.01.
- **Summaries and short answers:** Summarizes text for $0.02 or gives a two-to-three sentence answer for $0.04.
- **x402 endpoint inspector:** Decodes a URL's 402 challenge and runs a validator and merchant lookup for free.
- **Spending caps:** A per-session cap defaults to $0.25 and each payment is limited to $0.04.
- **Dry-run mode:** Quotes the price a paid tool would pay without signing anything.
- **Local signing:** The buyer key signs authorizations on your machine and redirects are refused.

## Good for

- Let an agent embed small texts and pay per call
- Try paid tools with dry run before funding a wallet
- Check whether a URL serves a valid x402 payment challenge
- Summarize short passages without an API subscription

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add x402ai-mcp --env X402AI_BUYER_PRIVATE_KEY='<X402AI_BUYER_PRIVATE_KEY>' -- npx -y x402ai-mcp
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

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

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add x402ai-mcp --env X402AI_BUYER_PRIVATE_KEY='<X402AI_BUYER_PRIVATE_KEY>' -- npx -y x402ai-mcp
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.x402ai-mcp]
command = "npx"
args = ["-y", "x402ai-mcp"]
env = { X402AI_BUYER_PRIVATE_KEY = "<X402AI_BUYER_PRIVATE_KEY>" }
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

Or run: gemini mcp add -s user -e X402AI_BUYER_PRIVATE_KEY='<X402AI_BUYER_PRIVATE_KEY>' x402ai-mcp npx -- -y x402ai-mcp

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "x402ai-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "x402ai-mcp"
      ],
      "env": {
        "X402AI_BUYER_PRIVATE_KEY": "<X402AI_BUYER_PRIVATE_KEY>"
      }
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, 2 of 5 tools read data; 3 names don't say. From the server's own tool labels and tool names; not verified by us.

- `embed`: 768-dimension text embedding using nomic-embed-text, $0.01.
- `summarize` (name suggests: reads): Summary of input text from a small local model, $0.02.
- `ask`: Short two-to-three sentence answer without web access, $0.04.
- `health`: Service status plus session spend and remaining cap.
- `inspect` (name suggests: reads): Decodes a URL's 402 challenge and runs Coinbase's x402 validator and a merchant lookup.

## FAQ

### How are calls paid for?

In USDC on Base through the x402 protocol, signed locally with your buyer key. No account is needed.

### Do I need ETH?

No. Payments are gasless for the payer, so the wallet only needs USDC.

### How do I test without spending?

Set X402AI_DRY_RUN=1 and paid tools return quotes without signing.

### How long do summarize and ask take?

About 5 to 15 seconds because of CPU inference; embed is usually under a second.

### How do I add X402ai MCP to Claude Code?

Run this command in your terminal: claude mcp add x402ai-mcp --env X402AI_BUYER_PRIVATE_KEY='<X402AI_BUYER_PRIVATE_KEY>' -- npx -y x402ai-mcp

### What are the best alternatives to X402ai MCP?

The closest alternatives to X402ai MCP are headroom, omniget, next-ai-draw-io, mcp-for-blender and Claude Code Ultimate Guide.

## Where this comes from

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

## Alternatives

- [headroom](https://ai-powered.com/mcp/headroom-3): headroom is an open-source MCP server for ai models and llm tooling.
- [omniget](https://ai-powered.com/mcp/omniget): omniget is an open-source MCP server for ai models and llm tooling.
- [next-ai-draw-io](https://ai-powered.com/mcp/next-ai-draw-io-2): next-ai-draw-io is an open-source MCP server for ai models and llm tooling.
- [mcp-for-blender](https://ai-powered.com/mcp/mcp-for-blender): mcp-for-blender is an open-source MCP server for design and media.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Solana MCP by Vybe](https://ai-powered.com/mcp/solana-mcp-by-vybe): Solana MCP by Vybe is an MCP server for finance and payments.
- [tyk](https://ai-powered.com/mcp/tyk): tyk is an open-source MCP server for developer tools.
- [unity-mcp](https://ai-powered.com/mcp/unity-mcp-2): unity-mcp is an open-source MCP server for ai models and llm tooling.

---
Source: https://ai-powered.com/mcp/x402ai-mcp
