mcp-x402 — Claude Code MCP server
mcp-x402 was built for x402 payments, including protected-resource payments and paywall management. Its live endpoint is currently unavailable.
claude mcp add mcp-x402 -e X402_API_KEY=<X402_API_KEY> -- npx -y @codespar/mcp-x402What mcp-x402 does
mcp-x402 is intended to expose x402 payment operations through MCP. Its tools cover paying for a protected resource, checking settlement, managing paywalls, reading a USDC balance, reviewing payment records, and listing supported networks and facilitators.
The setup expects X402_API_KEY and X402_WALLET_ADDRESS; X402_NETWORK can select base or solana, with base listed as the default. The server currently cannot reach a service because api.x402.org fails DNS resolution, so installing the package does not provide a working payment connection.
What it helps with
- pay for an HTTP 402-protected resource
- verify that an x402 payment settled
- create or remove an x402 paywall
- check the USDC payment balance
- review payment records with filters
Example prompts for the agent
- Ask the agent to check the USDC balance with
get_balance. - Ask it to verify whether a payment was received and settled with
verify_payment. - Ask it to list supported networks, tokens, and facilitators with
get_supported_networks.
How to install mcp-x402
Platform CLI
claude mcp add mcp-x402 -e X402_API_KEY=<X402_API_KEY> -- npx -y @codespar/mcp-x402Replace <…> with your own values
Platform CLI
codex mcp add x402 --env X402_API_KEY=<X402_API_KEY> -- npx -y @codespar/mcp-x402Replace <…> with your own values
Config file
{
"mcpServers": {
"x402": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-x402"
],
"env": {
"X402_API_KEY": "<X402_API_KEY>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"x402": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@codespar/mcp-x402"
],
"env": {
"X402_API_KEY": "<X402_API_KEY>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e X402_API_KEY=<X402_API_KEY> x402 npx -y @codespar/mcp-x402Replace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about mcp-x402
How do I install mcp-x402 in Claude Code?
Run claude mcp add mcp-x402 -e X402_API_KEY=<X402_API_KEY> -- npx -y @codespar/mcp-x402. A wallet address is also required for the intended setup, while api.x402.org currently fails DNS resolution.
What does mcp-x402 do?
It is designed to expose x402 payment actions through MCP, including resource payments, settlement checks, paywall management, balance checks, and payment history.
What credentials does mcp-x402 need?
Set the facilitator key in X402_API_KEY and the wallet in X402_WALLET_ADDRESS. Choose base or solana with X402_NETWORK.