Skip to main content
x402 is an HTTP-native payment protocol — the server responds 402 Payment Required, the client signs a payment, replays the request, and the server verifies and settles. For Pegana on Solana, settlement uses USDC via Coinbase Developer Platform (CDP). No API key. No subscription. No prepay. Each call is its own payment.

The paid tools

ToolPrice (USDC)Returns
getAssetHistory$0.001Discount points beyond 24h, raw or 1m bucket
subscribePegEvents$0.0005State transitions since a timestamp

getAssetHistory

// → getAssetHistory({ asset: "USDC", bucket: "1m", from: "2026-05-20T00:00:00Z", to: "2026-05-26T14:00:00Z" })
[
  { "ts": "2026-05-20T00:00:00Z", "discount": -0.0001, "state": "PEGGED" },
  { "ts": "2026-05-20T00:01:00Z", "discount": -0.0002, "state": "PEGGED" },
  ...
]
  • bucket=raw — every recorded snapshot
  • bucket=1m — 1-minute aggregate (recommended; smaller payload)
  • from, to — ISO 8601; max range = 7 days per call
  • limit — clamped 1–5000

subscribePegEvents

// → subscribePegEvents({ asset: "jitoSOL", since: "2026-05-25T00:00:00Z" })
[
  {
    "alert_id": "9c8e7f3a-...",
    "asset": "jitoSOL",
    "from_state": "PEGGED",
    "to_state": "DRIFT",
    "detected_at": "2026-05-25T14:32:11Z",
    "spread_at_trigger": -0.0034,
    "intrinsic_usd": 213.42,
    "market_usd": 212.69
  },
  ...
]
Returns every state transition for the asset since the timestamp. For continuous streaming, prefer the WebSocketsubscribePegEvents is a catch-up call for agents that just woke up.

Settlement flow

┌────────────────┐         ┌─────────────────┐         ┌────────────────────┐
│  Agent (MCP    │  call   │  Pegana MCP     │ 402 +   │  x402 Facilitator  │
│   client)      ├────────▶│   server        ├────────▶│  (Coinbase CDP)    │
└────────────────┘         └─────────────────┘         └────────────────────┘
       │                          │                            │
       │   sign USDC transfer     │                            │
       │◀─────────────────────────┤                            │
       │   replay w/ X-Payment    │                            │
       ├─────────────────────────▶│                            │
       │                          │   verify + settle on-chain │
       │                          ├───────────────────────────▶│
       │                          │◀───────────────────────────┤
       │   result JSON            │                            │
       │◀─────────────────────────┤                            │
  1. Agent calls getAssetHistory(...) via the MCP client.
  2. MCP server responds with HTTP 402 + the payment requirements (recipient, asset USDC, amount, chain solana-mainnet, nonce, deadline).
  3. The MCP client (the mcp-remote bridge or your own) signs a USDC transfer via the configured wallet (CDP, or any Solana wallet your client supports).
  4. Client replays the request with X-Payment: <signed payload> header.
  5. Pegana verifies the payment via the x402 facilitator. On success: settles on-chain and returns the result. On failure: returns 402 again or 4xx.
The whole round-trip is typically 1.5–3 seconds (signature is fast; on-chain settlement is the dominant cost). You don’t see the on-chain leg as a separate step from the agent — the bridge handles it.

Configure your wallet

Point your MCP host at the hosted server and pass CDP credentials to the mcp-remote bridge so it can sign payments locally:
claude_desktop_config.json
{
  "mcpServers": {
    "pegana": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.pegana.xyz"],
      "env": {
        "X402_WALLET_PROVIDER": "cdp",
        "CDP_API_KEY_NAME": "<your CDP key name>",
        "CDP_API_KEY_PRIVATE_KEY": "<your CDP key>",
        "CDP_WALLET_ID": "<your CDP wallet ID>"
      }
    }
  }
}
The server returns HTTP 402 with payment requirements; the bridge signs a USDC transfer via your CDP wallet and replays the request. Settlement is on Solana mainnet through Coinbase’s x402 facilitator. Other wallet providers (Phantom, Backpack, hot wallet via private key) are tracked in the mcp-ts README. The default is CDP because it gives the cleanest agent UX — no browser popup, no wallet extension, just a server-side signing key.

What if I just want to read history without paying?

The REST endpoint GET /v1/assets/{symbol}/history is free for the last 24h. getAssetHistory is paid because it returns up to 7 days, including the engine’s raw snapshot grain, which is more expensive to serve. If you need >24h of history one-off, the free REST endpoint covers it in 24h windows. The paid MCP tool is for agents that need it on-demand inside a reasoning flow.

Pricing details

  • getAssetHistory: $0.001 per call, regardless of date range or limit
  • subscribePegEvents: $0.0005 per call, regardless of result size
Prices are set in mcp-ts/src/tools/*.ts and revised periodically as we observe usage patterns. Major changes will be announced in the changelog.

On-chain receipts

Every settled payment is an on-chain transaction. The CDP wallet’s transaction history (or any Solana explorer pointed at the facilitator’s recipient address) lets you audit calls. The first 3 mainnet settlements are recorded in commit 7da9158 (C4 proof) — the production ledger for x402 starts there.

Next

Setup in Claude Desktop / Cursor

Step-by-step config for the major MCP hosts.