"""x402 documentation endpoints — embedded docs site + sandbox mode.""" from __future__ import annotations import json import os import time from fastapi import APIRouter, HTTPException, Query, Request from fastapi.responses import HTMLResponse router = APIRouter(tags=["x402-Docs"]) DOCS_PAGE = """
Pay-per-call AI tools. Send USDC, get intelligence. No subscription. No commitment.
# 1. List available tools
curl https://mcp.rugmunch.io/mcp/x402 \\
-H "Content-Type: application/json" \\
-d '{"method":"tools/list"}'
# 2. Create invoice for a tool
curl https://mcp.rugmunch.io/mcp/x402 \\
-d '{"method":"tools/call","params":{"name":"x402_create_invoice","arguments":{"tool":"token_scan"}}}'
# 3. Pay with USDC (Base or Solana)
# Send the amount to the pay_to address from the invoice
# 4. Verify payment
curl https://mcp.rugmunch.io/mcp/x402 \\
-d '{"method":"tools/call","params":{"name":"x402_verify_payment","arguments":{"tx_hash":"0x...","tool":"token_scan"}}}'
Every major AI tool can discover and use x402 natively:
Add to claude.json: mcpServers.x402.url = "https://mcp.rugmunch.io/mcp/x402"
Add .cursor/mcp.json: @x402 list_tools in chat
Add opencode.json: mcp.x402.url = "https://mcp.rugmunch.io/mcp/x402"
Run with: aider --mcp-servers x402=https://mcp.rugmunch.io/mcp/x402
pip install x402-sdk from x402_sdk import x402 client = x402() tools = client.list_tools(category="intelligence") invoice = client.create_invoice(tool="token_scan") # Pay on-chain → verify result = client.verify_payment(tx_hash="0x...", tool="token_scan")
Base USDC: 0x833589fcd6edb6e08f35c603c69b1e1c4b8e7a8b Solana USDC: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v Ethereum USDC: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 BNB Chain USDC: 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d TRON USDC: TEkxiTehnzSmSe2XqrBj4w32RUN966rdz
Category Price Range Free Trials Intelligence $0.01-$0.15 2-3 per tool Premium $0.10-$0.30 1 per tool Monitoring $0.02-$0.05 2-3 per tool Analysis $0.05-$0.10 2 per tool Bundles $0.20-$0.35 1 per bundle
GET /.well-known/x402 → Returns service metadata, supported chains, pricing, facilitator list
x402 — Rug Munch Media LLC · Wyoming, USA · MIT License