mcpField
X
X402 Mcp

X402 Mcp

Local
github.com/x402nodeFinance1Updated 15w ago

About X402 Mcp

X402 Mcp exposes x402-paid APIs to AI agents through MCP. It discovers endpoints from CDP Bazaar, refreshes their metadata periodically, and handles USDC payments on Base and Solana.

Key features

  1. 01Discovers endpoints from CDP Bazaar
  2. 02Reads endpoint metadata and pricing
  3. 03Refreshes endpoints every five minutes
  4. 04Automates HTTP 402 payments
  5. 05Supports USDC on Base and Solana

Use cases

  1. 01Find newly listed x402 API tools
  2. 02Call paid APIs with automatic USDC payment
  3. 03Limit per-call spending with a price cap

MCP support

It exposes discovered x402-paid APIs as tools to MCP clients. The server handles HTTP 402 payment flows and returns API responses.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"x402-mcp-x402node": {
"command": "npx",
"args": [
"-y",
"x402node-mcp"
],
"env": {
"X402_PRIVATE_KEY": "<X402_PRIVATE_KEY>"
}
}
}
}
Run commandnpx -y x402node-mcp
Environment variables to set
X402_PRIVATE_KEYSecretBase EOA private key (hex, 0x-prefixed) with USDC for signing x402 payments

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmx402node-mcp1.0.4

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

x402-mcp

MCP server bringing hundreds of x402-paid APIs to AI agents (Claude, Cursor, MCP-aware clients). Auto-discovers tools from CDP Bazaar; handles USDC micropayments on Base + Solana.

Features

  • Auto-discovers x402 endpoints from CDP Bazaar (no hard-coded list)
  • Reads metadata directly from Bazaar (description, schema, pricing)
  • Refreshes every 5 min — new endpoints appear without restart
  • Handles HTTP 402 + USDC payment automatically
  • Multi-chain: Base + Solana mainnet live (USDC on both); Polygon/BNB/EVM expandable

Install (Claude Desktop)

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "x402-mcp": {
      "command": "npx",
      "args": ["-y", "x402node-mcp"],
      "env": { "X402_PRIVATE_KEY": "0xYOUR_BASE_PRIVATE_KEY" }
    }
  }
}

Set X402_PRIVATE_KEY to a Base EOA private key (hex, 0x-prefixed) with USDC on Base mainnet (Solana payment via SPL USDC also supported). Restart Claude Desktop. The server auto-discovers ~117 tools on first run.

Cost Safety

  • Each tool call costs $0.0001-$0.10 USDC depending on endpoint
  • Hard cap: MAX_PRICE_USD env var (default $0.10/call); calls above are blocked
  • Use a fresh burner wallet, not your main wallet

How it works

Agent calls tool -> HTTP 402 -> x402-fetch signs EIP-3009 -> CDP Facilitator settles on Base or Solana -> response returned. Buyer pays no gas.

Development

git clone https://github.com/x402node/x402-mcp
cd x402-mcp
npm install
cp .env.example .env  # edit X402_PRIVATE_KEY
node mcp-server.js

Links

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.