Skip to main content
X4

x402

v0.1.3API Key

Micropagamentos HTTP-native da Coinbase. USDC na Base e Solana. Pagamentos máquina-a-máquina com HTTP 402.

10 ferramentas1 env vars🌐 GLOBALestável no npm

O que seu agente faz

O x402 dá ao seu agente 10 tools que ele chama direto — escolha as que precisar, no Claude, Cursor ou qualquer 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.
Exemplo de chamada
// 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

Adicione esta entrada ao seu claude_desktop_config.json (ou a config de qualquer cliente compatível com MCP).

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

Depois de reiniciar, seu agente pode chamar qualquer uma das 10 ferramentas abaixo — teste pay_request primeiro.

Variáveis de ambiente · 1

Necessárias pra autenticar o server. Armazenadas criptografadas ao usar a hospedagem gerenciada da CodeSpar.

X402_API_KEY
obrigatóriosecret

API key for x402

Ferramentas disponíveis · 10

Cada ferramenta é independente — seu agente carrega só o que precisa pra reduzir contexto e tempo de resposta.

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 compatíveis

MCP é um protocolo — qualquer framework que o fale pode montar este server.

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

Perguntas frequentes

Rode `npx -y @codespar/mcp-x402` e adicione o bloco de config acima ao seu cliente MCP — Claude, Cursor, VS Code ou qualquer cliente compatível com MCP. Sem build, sem SDK. Prefere hospedado? O tier gerenciado da CodeSpar roda pra você, com a auth resolvida.
x402 — MCP server · 10 tools | CodeSpar