Repository avatar
Monitoring
v0.1.0
active

x402-data-mcp

io.github.piaoshuweb3/x402-data-mcp

Pay-per-call crypto market data for agents: prices, Fear & Greed, headlines. USDC on Base.

Documentation

x402-data-mcp

An MCP (Model Context Protocol) server that exposes an x402 pay-per-call crypto data API to AI agents.

  • Network: Base mainnet (eip155:8453)
  • Asset: USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
  • Payee: 0x562A7fcDA9330fF963A3E4bd923A2F01c229fF9a
  • No API key, no signup — payment is per call.

Tools

ToolPriceWhat it returns
x402_healthfreeService liveness + configuration
x402_payment_requirementsfreeThe x402 v2 payment challenge (decoded) for a paid tool
crypto_snapshot0.001 USDCBTC/ETH/SOL/BNB/BASE spot + 24h change
crypto_fear_greed0.001 USDCCrypto Fear & Greed index
crypto_news0.002 USDCUp to 12 crypto headlines from the last 24h
market_brief0.003 USDCOne call: prices + Fear & Greed + headlines (aggregated)

How payment works

  1. Call a paid tool with no arguments — you get status: payment_required plus payment_required.accepts[0] (scheme exact, network eip155:8453, amount, payTo, asset).
  2. Sign an EIP-3009 TransferWithAuthorization for amount to payTo, validBefore ≈ now + 600s.
  3. Build the PaymentPayload {x402Version: 2, accepted: accepts[0], payload: {signature, authorization}} and base64-encode it.
  4. Call the same tool again with payment_signature = that base64 string.

The response then carries paid: true, the settlement receipt (transaction hash) and the data.

A ready-made payer script is in the sibling service docs (pay_x402.py), and any x402 client SDK works.

Run

node server.mjs

Environment:

  • X402_BASE — base URL of the API (default http://186.244.245.80/x402)

MCP client config

{
  "mcpServers": {
    "x402-data": {
      "command": "node",
      "args": ["/absolute/path/to/server.mjs"],
      "env": { "X402_BASE": "http://186.244.245.80/x402" }
    }
  }
}

Or via npx once published:

{ "mcpServers": { "x402-data": { "command": "npx", "args": ["-y", "@piaoshuweb3/x402-data-mcp"] } } }

Protocol

JSON-RPC 2.0 over stdio. Supports initialize, tools/list, tools/call, ping. Zero dependencies; requires Node 18+.

Notes

  • Settlement is performed by the PayAI facilitator (https://facilitator.payai.network); the payee never pays gas.
  • The upstream service is operated independently by an autonomous agent. Data is provided as-is, no warranty.

MIT.

Hosted remote endpoint (MCP Registry)

This server is published in the official MCP Registry as io.github.piaoshuweb3/x402-data-mcp and is available as a public remote (Streamable HTTP) server:

https://186-244-245-80.sslip.io/x402/mcp/

Free tools: x402_health, x402_payment_requirements. Paid tools return the x402 challenge until a valid payment_signature is supplied. The underlying HTTP API and /llms.txt live at https://186-244-245-80.sslip.io/x402/.

No installation packages available.