x402 MCP server
✓ VerifiedEnables AI agents to access hundreds of paid APIs via automatic USDC micropayments on Base and Solana.
Also known as x402node/x402-mcp, x402node-mcp
- Stars
- 1
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- 1.0.4
- Last commit
- Jul 18, 2026
- License
- MIT
What is x402 MCP?
x402 enables AI agents to access hundreds of paid APIs via automatic USDC micropayments on Base and Solana.
Summary generated from the project's README
About x402 MCP server
Providing AI agents with instant access to hundreds of paid APIs through automatic USDC micropayments is the primary function of x402-mcp. Developers using Claude Desktop or Cursor can connect their agents to a wide range of tools discovered from the CDP Bazaar without needing to hard-code individual endpoints. The server automatically handles HTTP 402 errors by signing payments via EIP-3009, allowing the agent to receive API responses after settling transactions on the Base or Solana mainnets.
Setting up the server requires adding it to your configuration file using npx and providing a Base EOA private key through the X402_PRIVATE_KEY environment variable. To manage spending, you can set a MAX_PRICE_USD variable to block any tool calls that exceed a specific cost. Each individual tool call typically ranges from $0.0001 to $0.10 USDC. Because the server refreshes its tool list every five minutes, new capabilities from the Bazaar appear automatically without requiring a manual restart.
What you can do with it
- 1Accessing paid API toolsAn AI agent can automatically discover and use hundreds of different paid endpoints from the CDP Bazaar.
- 2Automating micro-transactionsThe server manages the entire payment process for API calls using USDC on Base or Solana.
- 3Controlling API expenditureDevelopers can prevent expensive API calls by setting a maximum price limit per request.
Written from the project's README. Every use case is checked against a quote from it.
How to install x402 MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall x402 MCP in Claude Code
$ claude mcp add --env 'X402_PRIVATE_KEY=<YOUR_X402_PRIVATE_KEY>' x402-mcp -- npx -y x402node-mcpInstall x402 MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"x402-mcp": {
"command": "npx",
"args": [
"-y",
"x402node-mcp"
],
"env": {
"X402_PRIVATE_KEY": "<YOUR_X402_PRIVATE_KEY>"
}
}
}
}Install x402 MCP in VS Code
.vscode/mcp.json
{
"servers": {
"x402-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"x402node-mcp"
],
"env": {
"X402_PRIVATE_KEY": "<YOUR_X402_PRIVATE_KEY>"
}
}
}
}Install x402 MCP in VS Code CLI
$ code --add-mcp '{"name":"x402-mcp","type":"stdio","command":"npx","args":["-y","x402node-mcp"],"env":{"X402_PRIVATE_KEY":"<YOUR_X402_PRIVATE_KEY>"}}'Install x402 MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"x402-mcp": {
"command": "npx",
"args": [
"-y",
"x402node-mcp"
],
"env": {
"X402_PRIVATE_KEY": "<YOUR_X402_PRIVATE_KEY>"
}
}
}
}Install x402 MCP in Codex
$ codex mcp add x402-mcp --env 'X402_PRIVATE_KEY=<YOUR_X402_PRIVATE_KEY>' -- npx -y x402node-mcpInstall x402 MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.x402-mcp] command = "npx" args = ["-y", "x402node-mcp"] [mcp_servers.x402-mcp.env] X402_PRIVATE_KEY = "<YOUR_X402_PRIVATE_KEY>"
Install x402 MCP in Gemini CLI
$ gemini mcp add -s user -e 'X402_PRIVATE_KEY=<YOUR_X402_PRIVATE_KEY>' x402-mcp npx -- -y x402node-mcpInstall x402 MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"x402-mcp": {
"command": "npx",
"args": [
"-y",
"x402node-mcp"
],
"env": {
"X402_PRIVATE_KEY": "<YOUR_X402_PRIVATE_KEY>"
}
}
}
}Configuration
X402_PRIVATE_KEYRequiredSecretBase EOA private key (hex, 0x-prefixed) with USDC for signing x402 payments
| Name | Description | |
|---|---|---|
| X402_PRIVATE_KEY | Base EOA private key (hex, 0x-prefixed) with USDC for signing x402 payments | RequiredSecret |
Automated checks
Ran Nov 15, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachablex402node/x402-mcp is public and reachablegithub.com/x402node/x402-mcp ↗Pass
- Package names this repository as its sourcex402node-mcp names x402node/x402-mcp as sourcenpmjs.com/package/x402node-mcp ↗Pass
- Build provenance (Sigstore attestation)Sigstore attestation for x402node-mcpnpmjs.com/package/x402node-mcp/v/1.0.4#provenance ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-07-18github.com/x402node/x402-mcp ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from x402node-mcpPass
- No critical advisory in the package or its dependencies400 resolved dependencies checked; no critical advisoryosv.dev ↗Pass
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubx402-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_USDenv 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
- x402 protocol: https://x402.org
- CDP Bazaar: https://docs.cdp.coinbase.com/x402/bazaar
- MCP: https://modelcontextprotocol.io
- npm: https://www.npmjs.com/package/x402node-mcp
- Glama: https://glama.ai/mcp/servers/x402node/x402-mcp
License
MIT
x402 MCP questions
How do I add x402 MCP to Claude Code?
Run claude mcp add --env 'X402_PRIVATE_KEY=<YOUR_X402_PRIVATE_KEY>' x402-mcp -- npx -y x402node-mcp in your terminal. Add --scope user to make it available in every project.
How do I add x402 MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
How much does each tool call cost?
Tool calls typically cost between $0.0001 and $0.10 USDC, depending on the specific endpoint.
Can I set a limit on how much is spent per call?
Yes, you can use the MAX_PRICE_USD environment variable to set a hard cap on tool call costs.
Which blockchains are supported?
Base and Solana mainnets are currently live with USDC support.