x402-pay is an MCP server that lets AI agents autonomously discover, pay for, and fetch HTTP 402 paywalled resources using Solana. No human in the loop.
The "autonomous agent economy" has no payment rail. When an agent hits a paywall, it stops and asks a human.
AI agents can reason, write code, search the web, and call APIs. But the moment a resource costs money, autonomy ends. The agent stalls, escalates to a human, and waits. Every paid API is a dead end.
0 MCP serversimplement autonomous x402 payments
x402-pay gives any MCP-compatible agent a Solana wallet. When it encounters HTTP 402, it reads the price from response headers, sends SOL or USDC on-chain, attaches the tx signature, and fetches the content. Under 2 seconds, end to end.
< 2sdiscover, pay, and fetch -- fully autonomous
Install once, add a keypair, and your agent can pay for anything. Zero config beyond that.
Probe a URL for x402 payment requirements without paying. Returns paywall status, price, token, and recipient address.
read-onlySend a Solana payment to satisfy an x402 paywall. Auto-discovers requirements or accepts manual overrides for amount and recipient.
paymentOne-shot x402 flow: discover paywall, pay on Solana, fetch content. The primary tool for agents -- handles the full handshake.
primaryCheck the agent's Solana wallet balances. Returns SOL and USDC holdings so the agent can reason about what it can afford.
read-onlyQuery the local payment ledger. Shows past x402 payments with URLs, amounts, token types, and transaction signatures.
read-onlyRegister a resource behind an x402 paywall. Makes your agent a seller -- it responds with 402, verifies on-chain payment, then serves content.
sellerWorks with Claude, Cursor, Windsurf, or any MCP-compatible client.
{
"mcpServers": {
"x402-pay": {
"command": "npx",
"args": ["x402-pay"],
"env": {
"SOLANA_KEYPAIR_PATH": "~/.config/solana/id.json",
"SOLANA_RPC_URL": "https://api.devnet.solana.com"
}
}
}
}
npm install x402-pay or use npx directly -- no global install needed.SOLANA_KEYPAIR_PATH at a funded keypair. Create one with solana-keygen new and airdrop devnet SOL.x402_fetch, handles the 402, pays on-chain, and returns the data.Watch an AI agent discover a paywall, pay on Solana, and fetch the content — no human in the loop.