Skip to main content
X4

x402

v0.1.3API Key

Micropagos HTTP-native de Coinbase. USDC en Base y Solana. Pagos máquina-a-máquina con HTTP 402.

10 herramientas1 env vars🌐 GLOBALestable en npm

Qué puede hacer tu agente

x402 le da a tu agente 10 tools que llama directo — elegí las que necesite, en Claude, Cursor o cualquier cliente MCP.

  • pay_requestPay for a 402-protected resource. Sends USDC payment via x402 protocol and returns the resource content. The agent automatically handles the 402 handshake.
  • verify_paymentVerify if a x402 payment was received and settled on-chain
  • create_paywallCreate a x402 paywall configuration for an endpoint. When requests hit this endpoint, they receive HTTP 402 with payment instructions.
Ejemplo de llamada
// Your agent calls a tool directly — no glue code.
// CodeSpar's managed tier handles OAuth2, token rotation and rate limits.
const result = await session.call("pay_request", { /* ... */ });

Instalar

terminal
$ npm install @codespar/mcp-x402

Quickstart

Agregá esta entrada a tu claude_desktop_config.json (o a la config de cualquier cliente compatible con MCP).

claude_desktop_config.json
{
  "mcpServers": {
    "x402": {
      "command": "npx",
      "args": [
        "-y",
        "@codespar/mcp-x402"
      ],
      "env": {
        "X402_API_KEY": "<your_x402_api_key>"
      }
    }
  }
}

Después de reiniciar, tu agente puede llamar cualquiera de las 10 herramientas de abajo — probá pay_request primero.

Variables de entorno · 1

Necesarias para autenticar el server. Almacenadas cifradas al usar el hosting gestionado de CodeSpar.

X402_API_KEY
obligatoriosecret

API key for x402

Herramientas disponibles · 10

Cada herramienta es independiente — tu agente carga solo lo que necesita para reducir contexto y tiempo de respuesta.

WRITEpay_request
Pay for a 402-protected resource. Sends USDC payment via x402 protocol and returns the resource content. The agent automatically handles the 402 handshake.
WRITEverify_payment
Verify if a x402 payment was received and settled on-chain
WRITEcreate_paywall
Create a x402 paywall configuration for an endpoint. When requests hit this endpoint, they receive HTTP 402 with payment instructions.
WRITEget_paywall
Get paywall configuration for a specific URL
WRITElist_paywalls
List all configured x402 paywalls
DELETEdelete_paywall
Remove a x402 paywall from an endpoint
READget_balance
Get available USDC balance for x402 payments
WRITElist_payments
List x402 payment history with optional filters

Frameworks compatibles

MCP es un protocolo — cualquier framework que lo hable puede montar este server.

Claude Agent SDKAnthropic
OpenAI AgentsOpenAI
Vercel AI SDKVercel
LangChainLangChain
LlamaIndexLlamaIndex
CrewAICrewAI
MastraMastra
Cualquier cliente MCPProtocolo

Preguntas frecuentes

Corré `npx -y @codespar/mcp-x402` y agregá el bloque de config de arriba a tu cliente MCP — Claude, Cursor, VS Code o cualquier cliente compatible con MCP. Sin build, sin SDK. ¿Preferís hosted? El tier gestionado de CodeSpar lo corre por vos, con la auth resuelta.
x402 — MCP server · 10 tools | CodeSpar