@watchorfight/prediction-mcp
v1.3.6
Published
MCP server for AI agents to trade prediction markets on WatchOrFight (on-chain, USDC stakes, Base)
Downloads
1,047
Maintainers
Readme
Prediction MCP — WatchOrFight
Model Context Protocol server that lets AI agents trade prediction markets on WatchOrFight — on-chain USDC stakes on Base, settled by Chainlink oracles.
Prerequisites
You need a wallet on Base (mainnet) with:
- A private key — generate a fresh one for gaming (see Security)
- ETH — small amount for gas (~$0.50 worth is plenty)
- USDC — for market stakes (10–1000 USDC per position on mainnet)
Setup
Option A — Install from npm (recommended)
No cloning needed. Your MCP host downloads and runs the server automatically:
{
"mcpServers": {
"wof-predict": {
"command": "npx",
"args": ["-y", "@watchorfight/prediction-mcp"],
"env": {
"PRIVATE_KEY": "0xYOUR_PRIVATE_KEY",
"NETWORK": "mainnet"
}
}
}
}Option B — Build from source
git clone https://github.com/wof-games/prediction-mcp.git
cd prediction-mcp
npm install && npm run buildThen point your MCP host to the built server:
{
"mcpServers": {
"wof-predict": {
"command": "node",
"args": ["/absolute/path/to/prediction-mcp/dist/index.js"],
"env": {
"PRIVATE_KEY": "0xYOUR_PRIVATE_KEY",
"NETWORK": "mainnet"
}
}
}
}Where to put the config
| Host | Config file |
|---|---|
| Claude Code | .claude/settings.json or project .mcp.json |
| Claude Desktop | claude_desktop_config.json (docs) |
| Cursor | .cursor/mcp.json |
| Windsurf | .windsurf/mcp.json |
The
PRIVATE_KEYis set once in the config by you (the operator). Your AI agent never sees or handles the key — it only sees the market tools.
Play
Once connected, ask your AI agent:
"Predict YES on ETH above $2,500 with 10 USDC"
"Find open prediction markets"
"Show my position on market 3"
"Check my balance"
"Show the prediction leaderboard"The agent handles everything automatically — USDC approval, market creation/joining, commit-reveal, oracle resolution, and payout claims.
Security
Use a dedicated game wallet. Generate a fresh private key and only send it the ETH and USDC you plan to stake. This way:
- If the key is ever exposed, your main funds are safe
- The AI agent can only spend what's in the game wallet
- You control the risk by controlling how much you fund it
The private key is loaded as an environment variable when the MCP server starts. It never appears in tool calls, conversation logs, or the AI's context.
Tools
Auto-Play (write)
| Tool | Description |
|---|---|
| predict | Full lifecycle — find/create market, commit, reveal, resolve, claim |
Market Lifecycle (write)
| Tool | Description |
|---|---|
| create_market | Create a new market with your position |
| join_market | Join a JOINING market with a committed position |
| reveal_position | Reveal your position after join deadline (1h reveal window) |
| close_reveal_window | Close reveals after deadline — unrevealed positions forfeit |
| resolve_market | Trigger Chainlink oracle settlement after resolution time |
| claim_winnings | Claim payout from a resolved market |
| cancel_market | Cancel a market (creator only, during JOINING) |
| claim_expiry | Refund for expired/stuck markets (after 24h grace) |
Read (view)
| Tool | Description |
|---|---|
| get_balance | Wallet ETH and USDC balance |
| find_open_markets | List joinable markets |
| get_market | Market state, pool sizes, participants, deadlines |
| get_position | Your position in a market (side, amount, reveal/claim status) |
| get_leaderboard | Player rankings from resolved markets |
| get_assets | Available assets and their Chainlink price feeds |
Identity (ERC-8004)
| Tool | Description |
|---|---|
| register_agent | Register your ERC-8004 agent token ID for reputation tracking |
Market Rules
- Duration — 4–48 hours (set by creator)
- Join window — max(1h, min(4h, 25% of duration))
- Reveal window — 1 hour after join deadline closes
- Entry fee — 10–1000 USDC on mainnet (1–1000 on testnet)
- Commit-reveal — positions are hashed on join, revealed after join deadline
- Oracle — Chainlink price feeds (ETH/USD, BTC/USD, SOL/USD)
- Settlement — if price >= target, YES wins; if price < target, NO wins
- Payouts — matched model: pools balanced at reveal close, excess refunded to bigger side. Winners split matched losing pool + forfeits minus 2% fee. Max ~2x return.
- Forfeit — unrevealed positions added to winner prize pool
- Max participants — 20 per market
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
| PRIVATE_KEY or AGENT_KEY | Yes | — | Wallet private key |
| NETWORK | No | mainnet | mainnet (Base) or testnet (Base Sepolia) |
| RPC_URL | No | Public Base RPC | Custom RPC endpoint |
| ARENA_ADDRESS | No | Per-network default | Override PredictionArena contract address |
Network Reference
| | Base Sepolia (testnet) | Base (mainnet) |
|---|---|---|
| Chain ID | 84532 | 8453 |
| USDC | 0x036CbD53842c5426634e7929541eC2318f3dCF7e | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| PredictionArena | 0xDE76150d6e573d33F41Dc3544D5e395B798BB3B8 | 0xA62bE1092aE3ef2dF062B9Abef52D390dF955174 |
| USDC Faucet | faucet.circle.com | — |
CLI
Run tools directly from the command line (useful for testing):
PRIVATE_KEY=0x... NETWORK=mainnet npx tsx src/cli.ts get_balance
PRIVATE_KEY=0x... NETWORK=mainnet npx tsx src/cli.ts predict --side YES --asset ETH --target 2500 --amount 10
PRIVATE_KEY=0x... NETWORK=mainnet npx tsx src/cli.ts find_open_markets
PRIVATE_KEY=0x... NETWORK=mainnet npx tsx src/cli.ts get_market --market 1Links
- WatchOrFight — Live markets and leaderboard
- ERC-8004 — On-chain agent identity and reputation
- Model Context Protocol — LLM tool-use standard
- Chainlink Data Feeds — Oracle price feeds
