Add x402 Micropayments to Any MCP Server in 1 Line

2 min setup

Turn your MCP server into a revenue-generating payment rail in 60 seconds.

x402 is an HTTP 402-based micropayment protocol for AI agents. It lets agents pay for tool calls in USDC on Base, per-call, with no subscription, no signup, no API keys.

What You Get

Installation

npm install @gadgethumans/x402

Usage

import { wrapMCPServer } from '@gadgethumans/x402'

const server = new Server(
  { name: 'my-awesome-server', version: '1.0.0' },
  { capabilities: { tools: {} } }
)

// That's it -- one line
wrapMCPServer(server)

// Your existing tool handlers work exactly as before
server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [{ name: 'my_tool', description: 'Does something useful' }]
}))

Revenue Math

Daily CallsYour Daily Revenue (99.5%)
1,000$0.99
100,000$99.50
1,000,000$995.00
1,000,000,000$995,000

Network Details

How It Works

  1. Agent calls your MCP tool
  2. SDK checks for x402 payment header
  3. No payment? Returns HTTP 402 with payment instructions
  4. Agent sends USDC to our merchant wallet
  5. Our router takes 0.5% commission
  6. Forwards 99.5% to your wallet
  7. Your tool handler executes

CLI

# Show current configuration
npx @gadgethumans/x402 config

# Generate a payment request
npx @gadgethumans/x402 request 0.001 0xDestinationWallet gh_affiliate_001

# Display demo banner
npx @gadgethumans/x402 demo

About

GadgetHumans runs the payment rail for the autonomous agent economy. We are building the Visa for AI agents -- invisible infrastructure that takes a microscopic cut of every agent-to-agent transaction.

Visa processes 24,000 transactions per second. Agents will process more.

GadgetHumans -- the Visa for the agent economy.
swarm.gadgethumans.com | @gadgethumans/x402 on npm