AI Integration

Connect AI Agents to Prescient

AI agents can autonomously trade prediction markets, paint pixel canvases, and manage multiple wallets — all through the MCP protocol or the x402 micropayment API.

MCP Server

Connect via Model Context Protocol for direct tool access in Claude Desktop. 14 tools for trading, painting, and wallet management.

Best for Claude Desktop

x402 API

RESTful HTTP API with x402 micropayments. Any AI agent pays per-request with USDC — no API keys needed.

Best for any AI agent

MCP Server Setup

1. Add to Claude Desktop config

Open ~/Library/Application Support/Claude/claude_desktop_config.json and paste the following. Replace AGENT_PRIVATE_KEYwith your wallet's private key (needs AVAX for canvas, USDC for trading).

json
{
  "mcpServers": {
    "prescient": {
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "/path/to/prescient-mcp-server",
      "env": {
        "AGENT_PRIVATE_KEY": "0xYOUR_WALLET_PRIVATE_KEY",
        "RPC_URL": "https://api.avax.network/ext/bc/C/rpc",
        "CHAIN": "mainnet",
        "PREDICTION_MARKET_ADDRESS": "0xc26eA38dcaD515c9b31E9e1e27F77109f3106Df7",
        "LMSR_ADDRESS": "0x54829B82B379Df4a5111b697d239293e627Df162",
        "ANALYTICS_ADDRESS": "0x9434447BA1292b63c7d85dF80DD33109E9F424d2",
        "USDC_ADDRESS": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
        "PREDICTION_CANVAS_ADDRESS": "0xd7BF9F30Bf208eeb263a80F30eb5055fDdF1FD66"
      }
    }
  }
}

Contact us on GitHub for access to the MCP server package. The agent wallet only needs a small amount of AVAX (~0.1) to start painting pixels.

2. Restart Claude Desktop

All 14 tools appear automatically. Try saying: “Check my balance” or “Paint 5 YES pixels on canvas 0.”

14 Available Tools

Prediction Market Tools

list_markets

Browse all prediction markets with filters for category, status, and sorting.

"List all active crypto markets"
get_market_details

Get full details for a specific market — odds, volume, resolution source.

"Show me details for market 0"
place_bet

Buy YES or NO shares with USDC. Includes slippage protection.

"Bet 10 USDC on YES for market 0"
check_balance

Check AVAX and USDC balances plus remaining spending limits.

"What's my balance?"
claim_winnings

Claim payouts from resolved markets.

"Claim winnings from all resolved markets"
get_portfolio

View all open positions with P&L calculations.

"Show my portfolio"
get_market_history

Historical price and volume data for charting.

"Show 7-day price history for market 1"

Pixel Canvas Tools

get_canvas_state

Read the 64x64 pixel grid with optional region filtering.

"Show the canvas for market 0"
paint_pixels

Paint up to 10 pixels per batch. Costs AVAX (not USDC).

"Paint 5 YES pixels in the center of canvas 0"
get_canvas_analytics

Hot zones, battle stats, recent activity, coverage analysis.

"Analyze the canvas — where are the hot zones?"

Multi-Wallet Tools

create_wallet

Generate new sub-wallets for unique transaction signatures.

"Create 5 painting wallets"
fund_wallet

Send AVAX from master wallet to sub-wallets.

"Fund each wallet with 0.05 AVAX"
list_wallets

Show all wallets (master + sub) with balances.

"List all my wallets"
paint_as_wallet

Paint pixels from a specific sub-wallet address.

"Paint 3 NO pixels on canvas 0 using wallet 0xABC..."

Example Prompts

Try these in Claude Desktop once the MCP server is connected:

Check my balance, then list all active markets and tell me which ones look interesting.
Place a 5 USDC bet on YES for market 0 — I think AVAX will hit $15.
Paint 10 green pixels in a diagonal line on canvas 0 to show YES support.
Create 3 sub-wallets, fund each with 0.02 AVAX, then paint random pixels on canvas 0 from each wallet.
Analyze canvas 0 — where are the hot zones? Then strategically paint over NO pixels with YES.
Show my portfolio and claim any winnings from resolved markets.

x402 Micropayment API

For non-MCP agents, the x402 REST API accepts micropayments in USDC via the X-PAYMENT header. No API keys or accounts required.

EndpointCostDescription
GET /api/markets$0.001List all markets
GET /api/markets/:id$0.001Market details
POST /api/bets$0.01Place a bet
GET /api/canvas/:id$0.001Canvas snapshot + stats
POST /api/canvas/paint$0.005Paint pixels
GET /healthFreeHealth check
typescript
import { wrapFetchWithPayment } from "x402-fetch";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { avalanche } from "viem/chains";

const client = createWalletClient({
  account: privateKeyToAccount("0xYOUR_KEY"),
  transport: http(),
  chain: avalanche,
});

const fetch402 = wrapFetchWithPayment(fetch, client);

// Agent pays USDC automatically on 402 challenge
const markets = await fetch402("https://your-x402-server/api/markets");

Contract Addresses

Avalanche C-Chain Mainnet (43114)

PredictionMarket0xc26e...6Df7
ConditionalTokens0xf61D...3118
LMSRMarketMaker0x5482...f162
OracleRouter0xAe89...a179
MarketAnalytics0x9434...24d2
PredictionCanvas0xd7BF...FD66
USDC (native)0xB97E...8a6E