Skip to main content
ClaudeWave
dexl-io avatar
dexl-io

x402-agent-example

Ver en GitHub

Pay an API with x402 in ~10 lines: free tier needs no wallet, one signature for paid calls, plus MCP config.

MCP ServersRegistry oficial0 estrellas0 forksJavaScriptMITActualizado today
ClaudeWave Trust Score
95/100
Verified
Passed
  • Open-source license (MIT)
  • Actively maintained (<30d)
  • Clear description
  • Topics declared
  • Documented (README)
Last scanned: 9/18/2026
Install in Claude Code / Claude Desktop
Method: Manual
Claude Code CLI
git clone https://github.com/dexl-io/x402-agent-example
claude_desktop_config.json (Claude Desktop)
{
  "mcpServers": {
    "x402-agent-example": {
      "command": "node",
      "args": ["/path/to/x402-agent-example/dist/index.js"],
      "env": {
        "PRIVATE_KEY": "<private_key>"
      }
    }
  }
}
1. Run the command above in your terminal (Claude Code), or paste the JSON config into claude_desktop_config.json (Claude Desktop).
2. Replace any <placeholder> values with your API keys or paths.
3. Restart Claude. The MCP server and its tools appear automatically.
💡 Clone https://github.com/dexl-io/x402-agent-example and follow its README for install instructions.
Detected environment variables
PRIVATE_KEY
Casos de uso

Resumen de MCP Servers

# Pay an API with x402 — in about ten lines

[x402](https://x402.org) is HTTP 402 put to work: a server answers `402 Payment Required`
with the exact price, the client signs a stablecoin payment and repeats the same request.
No account, no API key, no invoice.

These examples call [DexL Agents](https://agents.dexl.io), an x402 gateway
(chat models, speech, web search and crawl, on-chain reads, FX rates, NLP tools).
Everything here works against any x402 server — only the URL changes.

## 1. Free: no wallet at all

```bash
npm install
npm run free
```

`free.mjs` does two things:

- calls the **free tier** (`model: "dexl-free"`) — no payment header, no wallet, no account;
- asks what a **paid** call would cost by sending it *without* payment and reading the 402.

Real output:

```
free answer: HTTP 402 (Payment Required) is a non-standardized status code reserved for future use...
web-search costs 0.01 USDC on eip155:8453 (HTTP 402)
```

## 2. Paid: one call, one signature

```bash
PRIVATE_KEY=0x... npm run paid
```

The payment is these three lines; after them it is ordinary `fetch`:

```js
const signer = toClientEvmSigner(wallet);
const client = new x402Client().register('eip155:8453', new ExactEvmScheme(signer));
const fetchWithPay = wrapFetchWithPayment(fetch, client);
```

Your key stays on your machine — the server only ever sees a signed payment.
Settles in USDC on Base, Polygon, Arbitrum or Solana. **Error responses are not charged.**

> The free example above was run as-is. The paid one needs your own funded wallet,
> so run it yourself with a small balance; it uses the same client our own service uses.

## 3. Connect an MCP client

Remote (free tools only — a remote server holds no wallet of yours):

```
https://agents.dexl.io/mcp
```

Local, with paid tools, because the wallet stays on your machine:

```json
{
  "mcpServers": {
    "dexl": {
      "command": "npx",
      "args": ["-y", "dexl-agents", "mcp"],
      "env": { "DEXL_BASE_URL": "https://agents.dexl.io", "DEXL_PRIVATE_KEY": "<optional>" }
    }
  }
}
```

## What you can call

`GET /v1/tools` lists every tool with its price and schema.
Machine-readable: [`/llms.txt`](https://agents.dexl.io/llms.txt) ·
[`/openapi.json`](https://agents.dexl.io/openapi.json) ·
[`/.well-known/x402`](https://agents.dexl.io/.well-known/x402) ·
[`/.well-known/mcp`](https://agents.dexl.io/.well-known/mcp)

MIT licensed. Issues and pull requests welcome.
agent-paymentsai-agentsbasehttp-402mcpmicropaymentsusdcx402

Lo que la gente pregunta sobre x402-agent-example

¿Qué es dexl-io/x402-agent-example?

+

dexl-io/x402-agent-example es mcp servers para el ecosistema de Claude AI. Pay an API with x402 in ~10 lines: free tier needs no wallet, one signature for paid calls, plus MCP config. Tiene 0 estrellas en GitHub y su última actualización registrada es del 2026-09-17.

¿Cómo se instala x402-agent-example?

+

Puedes instalar x402-agent-example clonando el repositorio (https://github.com/dexl-io/x402-agent-example) o siguiendo las instrucciones del README en GitHub. ClaudeWave también te ofrece bloques de instalación rápida en esta misma página.

¿Es seguro usar dexl-io/x402-agent-example?

+

Nuestro agente de seguridad ha analizado dexl-io/x402-agent-example y le ha asignado un Trust Score de 95/100 (tier: Verified). Revisa el desglose completo de comprobaciones superadas y flags en esta página.

¿Quién mantiene dexl-io/x402-agent-example?

+

dexl-io/x402-agent-example es mantenido por dexl-io. La última actividad registrada en GitHub es del 2026-09-17, con 0 issues abiertos.

¿Hay alternativas a x402-agent-example?

+

Sí. En ClaudeWave puedes explorar mcp servers similares en /categories/mcp, ordenados por popularidad o actividad reciente.

Despliega x402-agent-example en tu cloud

Lleva este repo a producción en minutos. Cada plataforma genera su propio entorno con variables de entorno editables.

¿Mantienes este repo? Añade un badge a tu README

Pega el badge en tu README de GitHub para mostrar que está auditado por ClaudeWave. Cada badge enlaza de vuelta a esta página y muestra el Trust Score actual.

Featured on ClaudeWave: dexl-io/x402-agent-example
[![Featured on ClaudeWave](https://claudewave.com/api/badge/dexl-io-x402-agent-example)](https://claudewave.com/repo/dexl-io-x402-agent-example)
<a href="https://claudewave.com/repo/dexl-io-x402-agent-example"><img src="https://claudewave.com/api/badge/dexl-io-x402-agent-example" alt="Featured on ClaudeWave: dexl-io/x402-agent-example" width="320" height="64" /></a>

Más MCP Servers

Alternativas a x402-agent-example