The predictfun-mcp server provides AI agents with structured access to Predict.fun, a BNB Chain prediction market protocol, enabling analysis of trading activity, market data, positions, and yield mechanics through 14 tools across three specialized subgraphs.
Platform Analytics – Retrieve platform-wide stats including total volume, trade count, open interest, yield figures, and active market count.
Top Markets – List highest-ranked prediction markets sorted by volume, open interest, or trade count (up to 50 results).
Market Details – Deep dive into a specific market by ID, including volume, open interest, resolution status, recent trades, and top holders.
Trader Profiles – Look up a wallet address for full trading history, open positions, P&L, and reward claims.
Leaderboard – Rank top traders by volume, payouts, or trade count.
Recent Activity – Fetch latest platform events filtered by type: trades, splits, merges, redemptions, or yield claims.
Yield Mechanics – Analyze Venus Protocol integration including deposits, redemptions, net balances, yield claims, and token mappings.
Whale Tracking – Identify the largest position holders across all markets, filterable by minimum position size.
Resolved Markets – Browse recently settled markets with their outcomes and payout information.
Custom GraphQL Queries – Execute arbitrary queries against any of the three subgraphs (orderbook, positions, yield) for tailored data retrieval.
Behavioral Analysis (AI meta-tools) – Classify traders into archetypes (whale accumulator, yield farmer, arbitrageur, etc.) and scan for specific behavioral patterns.
Market Structure Analysis (AI meta-tools) – Tag markets by resolution latency, liquidity profile, oracle type, and tail-risk indicators, then filter markets by these structural characteristics.
Pre-built Workflows – 9 pre-configured prompts for common tasks like platform overviews, trader analysis, market deep dives, and yield analysis.
Provides structured access to Predict.fun's prediction market protocol on the BNB Chain, enabling AI agents to track market volume, open interest, trader profiles, and yield-bearing mechanics.
Enables custom GraphQL queries against specialized subgraphs to retrieve detailed blockchain data for prediction markets, including orderbook activity, user positions, and reward distributions.
Predict.fun Subgraphs
A suite of three subgraphs indexing Predict.fun — a prediction market protocol on BNB Chain (Polymarket fork) with $1.7B+ volume and novel yield-bearing mechanics via Venus Protocol.
Subgraphs
1. predictfun-orderbook
Indexes orderbook activity across all CTF and NegRisk exchanges.
Entities: Markets, Orderbooks, OrderFilled/Matched/Cancelled events, Fee tracking, Account stats, NegRisk markets, TradeData timeseries with hourly/daily aggregations
Contracts:
Contract | Address |
CTFExchange (Non-Yield) |
|
CTFExchange (Yield) |
|
NegRiskCtfExchange (Non-Yield) |
|
NegRiskCtfExchange (Yield) |
|
NegRiskAdapter (Non-Yield) |
|
NegRiskAdapter (Yield) |
|
+ 4 Fee Module contracts |
2. predictfun-positions
Indexes position lifecycle — splits, merges, redemptions, and open interest tracking.
Entities: Conditions, UserPositions, MarketOpenInterest, Split/Merge/Redemption events, NegRisk conversions, TransferSingle events
Contracts:
Contract | Address |
ConditionalTokens (Non-Yield) |
|
ConditionalTokens (Yield) |
|
NegRisk ConditionalTokens (Yield) |
|
NegRiskAdapter (Non-Yield) |
|
NegRiskAdapter (Yield) |
|
NegRiskOperator (Yield) |
|
NegRiskOperator (Non-Yield) |
|
3. predictfun-yield
Indexes Predict.fun's novel yield-bearing mechanics — Venus Protocol integration, reward distributions, and UMA oracle resolution.
Entities: TokenMappings (underlying/vToken pairs), YieldClaims, VTokenMints, RewardRounds, OracleRequests/Proposals/Settlements
Contracts:
Contract | Address |
YieldBearingConditionalTokens |
|
RewardDistributor |
|
UMA Optimistic Oracle |
|
Architecture
predict.fun (BNB Chain)
├── predictfun-orderbook ── Fills, matches, fees, market registration
├── predictfun-positions ── Splits, merges, redemptions, open interest
└── predictfun-yield ── Venus yield, reward claims, oracle resolutionAll subgraphs share:
Network: BSC (BNB Smart Chain)
Collateral: USDT (18 decimals)
Start Block: 64,817,753
Spec Version: 1.3.0
Best Practices Applied
Bytes!IDs everywhere (cheaper thanString!)@entity(immutable: true)on all event logs@derivedFromfor reverse lookups (no redundant storage)No
eth_calls(events only)indexerHints: prune: autofor storage efficiencynonFatalErrorsfeature enabledconcatI32(logIndex)for unique event IDs
MCP Server
An MCP (Model Context Protocol) server that gives AI agents structured access to all three subgraphs.
Setup
Get a Graph API key from Subgraph Studio (docs)
Add to your Claude Code config (
~/.claude/settings.json):
{
"mcpServers": {
"predictfun": {
"command": "npx",
"args": ["predictfun-mcp"],
"env": {
"GRAPH_API_KEY": "your-api-key-here"
}
}
}
}Subgraph IDs are built in. Queries go through The Graph Gateway and are billed to your API key.
OpenClaw / Remote Agents (SSE)
# Dual transport — stdio + SSE on port 3850
GRAPH_API_KEY=your-key npx predictfun-mcp --http
# SSE only (for remote/server deployments)
GRAPH_API_KEY=your-key npx predictfun-mcp --http-only
# Custom port
MCP_HTTP_PORT=4000 GRAPH_API_KEY=your-key npx predictfun-mcp --httpPoint your agent at: http://localhost:3850/sse
Invocation | Transports | Use case |
| stdio | Claude Desktop, Cursor, Claude Code |
| stdio + SSE :3850 | Dual — local + remote agents |
| SSE :3850 | OpenClaw, remote deployments |
Tools (14)
Data Tools
Tool | Description |
| Full platform overview — volume, OI, yield, sync status |
| Rank markets by volume, open interest, or trade count |
| Deep dive: OI, resolution, top holders, orderbook stats |
| Full P&L: trades, positions, payouts, yield rewards |
| Latest trades, splits, merges, redemptions, or yield claims |
| Venus Protocol deposits, redemptions, yield stats |
| Largest holders with % of market OI |
| Top traders by volume, payouts, or trade count |
| Recently settled markets with outcomes |
| Custom GraphQL against any subgraph |
Meta-Tools (agent reasoning layer)
Tool | Description |
| Classify a trader into archetypes: whale accumulator, yield farmer, arbitrageur, early mover, resolution sniper |
| Find traders matching a specific behavioral archetype across the platform |
| Tag a market by resolution latency, liquidity profile, oracle type, and tail-risk indicators |
| Find markets by structural filter: resolution speed, liquidity depth, oracle type, OI concentration, tail risk |
Meta-tools return structured JSON so agents can reason programmatically over trader behavior and market quality — not just raw volume and OI.
Prompts (9)
Pre-built workflows: platform_overview, analyze_trader, market_deep_dive, yield_analysis, whale_alert, market_scanner, custom_query_examples, trader_persona_analysis, market_quality_scan
Subgraph Development
cd predictfun-<subgraph>
npm install
npx graph codegen
npx graph build
npx graph deploy predictfun-<subgraph> --version-label v0.0.1License
MIT