Skip to main content
Model Context Protocol (MCP) is the standard agents use to discover and call tools. Pegana ships an MCP server that exposes peg state, history, methodology metadata, and a live event subscription — directly to the model, without needing a wrapper API call. Hosted endpoint: https://mcp.pegana.xyz (Streamable HTTP transport) Source: mcp-ts/ (TypeScript on Bun + Hono) Point your MCP host at the URL — no install, no clone, no API key. See setup for per-host config.

Why MCP

If your agent already lives in Claude Code, Cursor, Cline, or Continue, MCP is the shortest path to “the model knows the peg state.” No middleware, no toolchain — the model calls getAssetState("USDC") and gets back JSON. The model also discovers methodology and asset metadata via getMethodology and getAssets, so it can reason about why an alert fires before reading any code you wrote.

Tools available

Free tools

getAssets, getAssetState, getMethodology, ping. No payment, no key.

Paid tools (x402)

getAssetHistory (0.001),subscribePegEvents(0.001), `subscribePegEvents` (0.0005). Settled in USDC on Solana.

Setup

Add Pegana to Claude / Cursor / Cline

One-time config in your MCP host’s settings file.

A typical agent prompt

Once configured:
You have a Pegana MCP server. Before recommending any swap to or from a
pegged asset on Solana, call getAssetState({asset}) and refuse if the
state is not PEGGED (unless the user explicitly accepts the risk).
The model handles the rest. It will call getAssetState("USDC") on its own, inspect the result, and refuse a swap if state is DRIFT or worse.

Tool list

ToolFree?Description
pingServer liveness check
getAssetsList all 22 active assets with latest snapshot
getAssetStateCurrent state, intrinsic, market, spread for one asset
getMethodologyFormula, sources, FSM thresholds — for the model to reason from
getAssetHistory$0.001Discount history beyond 24h, 1m or raw bucket
subscribePegEvents$0.0005Replay state transitions since a timestamp

Self-hosting (optional)

If you want to run your own instance (e.g., pointing at a private Pegana API):
git clone https://github.com/lrafasouza/pegana ~/pegana
cd ~/pegana/mcp-ts
bun install
bun run src/index.ts        # boots Hono on :3000 via Bun.serve
Configuration via env vars — PEGANA_API_BASE, REDIS_URL, DATABASE_URL, plus the CDP block for paid tools. A Dockerfile ships in mcp-ts/ for container deploys. See mcp-ts/README.md for the full env contract.

Anti-prompt-injection note

The MCP server returns structured JSON — no markdown, no nested instructions, no “ignore previous” payloads. We do not flow user-provided strings back into the response. The getMethodology content is static (vendored at build time), so an attacker compromising api.pegana.xyz cannot inject prompts via the methodology response. The values we do return (asset, state, decimal numbers, timestamps) are constrained shapes — your model can treat them as data, not prompts.

Next

Free tools detail

Schemas + example calls for each free tool.

Paid tools + x402

Settlement flow with Coinbase CDP wallet.