Skip to main content
Glama

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)

0x8BC070BEdAB741406F4B1Eb65A72bee27894B689

CTFExchange (Yield)

0x6bEb5a40C032AFc305961162d8204CDA16DECFa5

NegRiskCtfExchange (Non-Yield)

0x365fb81bd4A24D6303cd2F19c349dE6894D8d58A

NegRiskCtfExchange (Yield)

0x8A289d458f5a134bA40015085A8F50Ffb681B41d

NegRiskAdapter (Non-Yield)

0xc3Cf7c252f65E0d8D88537dF96569AE94a7F1A6E

NegRiskAdapter (Yield)

0x41dCe1A4B8FB5e6327701750aF6231B7CD0B2A40

+ 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)

0x22DA1810B194ca018378464a58f6Ac2B10C9d244

ConditionalTokens (Yield)

0x9400F8Ad57e9e0F352345935d6D3175975eb1d9F

NegRisk ConditionalTokens (Yield)

0xF64b0b318AAf83BD9071110af24D24445719A07F

NegRiskAdapter (Non-Yield)

0xc3Cf7c252f65E0d8D88537dF96569AE94a7F1A6E

NegRiskAdapter (Yield)

0x41dCe1A4B8FB5e6327701750aF6231B7CD0B2A40

NegRiskOperator (Yield)

0xBB7250101e0e3611D7e136fFE73Bc24b98E3e175

NegRiskOperator (Non-Yield)

0x56020F5024641d577Cb54032aF70a23a986ECfFD

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

0x9400F8Ad57e9e0F352345935d6D3175975eb1d9F

RewardDistributor

0x14e3a0a4aB4e4Fa60FC6b4aCce200afAD9233ecE

UMA Optimistic Oracle

0x76F4632032d3E16fE15e06DDB60b53C67BCE17a0

Related MCP server: graph-polymarket-mcp

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 resolution

All 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 than String!)

  • @entity(immutable: true) on all event logs

  • @derivedFrom for reverse lookups (no redundant storage)

  • No eth_calls (events only)

  • indexerHints: prune: auto for storage efficiency

  • nonFatalErrors feature enabled

  • concatI32(logIndex) for unique event IDs

MCP Server

An MCP (Model Context Protocol) server that gives AI agents structured access to all three subgraphs.

Setup

  1. Get a Graph API key from Subgraph Studio (docs)

  2. 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 --http

Point your agent at: http://localhost:3850/sse

Invocation

Transports

Use case

npx predictfun-mcp

stdio

Claude Desktop, Cursor, Claude Code

npx predictfun-mcp --http

stdio + SSE :3850

Dual — local + remote agents

npx predictfun-mcp --http-only

SSE :3850

OpenClaw, remote deployments

Tools (14)

Data Tools

Tool

Description

get_platform_stats

Full platform overview — volume, OI, yield, sync status

get_top_markets

Rank markets by volume, open interest, or trade count

get_market_details

Deep dive: OI, resolution, top holders, orderbook stats

get_trader_profile

Full P&L: trades, positions, payouts, yield rewards

get_recent_activity

Latest trades, splits, merges, redemptions, or yield claims

get_yield_overview

Venus Protocol deposits, redemptions, yield stats

get_whale_positions

Largest holders with % of market OI

get_leaderboard

Top traders by volume, payouts, or trade count

get_resolved_markets

Recently settled markets with outcomes

query_subgraph

Custom GraphQL against any subgraph

Meta-Tools (agent reasoning layer)

Tool

Description

find_trader_persona

Classify a trader into archetypes: whale accumulator, yield farmer, arbitrageur, early mover, resolution sniper

scan_trader_personas

Find traders matching a specific behavioral archetype across the platform

tag_market_structure

Tag a market by resolution latency, liquidity profile, oracle type, and tail-risk indicators

scan_markets_by_structure

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.1

License

MIT

Available Tools

15 tools
find_trader_personaA

Classify a trader into behavioral archetypes: whale_accumulator, yield_farmer, arbitrageur, early_mover, or resolution_sniper. Returns structured JSON with matched personas and supporting metrics.

Inputs: address (required).

get_leaderboardA

Get the top traders on Predict.fun by volume, P&L, or trade count

Inputs: rank_by, limit.

get_market_detailsB

Get full details for a specific market/condition: volume, OI, resolution status, recent trades, top holders

Inputs: condition_id (required).

get_market_orderbookA

Get the live order book for a Predict.fun market — current bids and asks with prices and sizes. Requires PREDICT_API_KEY. Provide market_id (integer from Predict.fun API) or condition_id. Use this to see the current state of the market, not historical trades.

Inputs: condition_id, market_id.

get_platform_statsA

Get Predict.fun platform-wide stats: total volume, trades, open interest, yield, and active markets

Inputs: no named parameters.

get_recent_activityC

Get recent activity on Predict.fun: latest trades, splits, merges, redemptions, or yield events

Inputs: event_type (required), limit.

get_resolved_marketsB

Get recently resolved markets with their outcomes and payout info

Inputs: limit.

get_top_marketsA

Get the top prediction markets ranked by volume, open interest, or trade count

Inputs: rank_by, limit.

get_trader_profileB

Get a trader's full profile: trading history, positions, P&L, and reward claims

Inputs: address (required).

get_whale_positionsB

Find the largest position holders across all Predict.fun markets

Inputs: limit, min_position.

get_yield_overviewA

Get Venus Protocol yield stats: deposits, redemptions, net balance, yield claims, and token mappings

Inputs: no named parameters.

query_subgraphA

Run a custom GraphQL query against any Predict.fun subgraph. Use this for advanced queries not covered by other tools.

Inputs: subgraph (required), graphql_query (required).

scan_markets_by_structureB

Find markets matching structural criteria: resolution speed, liquidity depth, oracle type, or tail-risk flags. Returns structured JSON.

Inputs: filter (required), resolved_only, limit.

scan_trader_personasB

Find traders matching a specific behavioral archetype across the platform. Returns structured JSON with matching traders and evidence.

Inputs: persona (required), limit.

tag_market_structureB

Classify a market by structural features: resolution latency, liquidity profile, oracle type, and tail-risk indicators. Returns structured JSON.

Inputs: condition_id (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 15 tools

    Disambiguation4/5

    Most tools have distinct purposes (e.g., get_market_orderbook vs get_market_details), but some overlap exists between get_leaderboard and get_whale_positions (both rank traders) and between find_trader_persona and scan_trader_personas (both deal with personas). Descriptions help differentiate, but slight ambiguity remains.

    Naming Consistency4/5

    All names use snake_case and follow a verb_noun pattern, but verbs vary: get (9 tools), scan (2), find (1), tag (1), query (1). While each verb is semantically appropriate, the mix deviates from a strict pattern. Minor inconsistency.

    Tool Count5/5

    15 tools is within the optimal range for a domain-specific server covering prediction markets and yield. Each tool serves a clear purpose without excessive redundancy, and the count feels well-scoped for the intended functionality.

    Completeness5/5

    The tool set covers core read operations: markets (details, top, resolved, orderbook), traders (profile, leaderboard, whale positions, personas), platform stats, and activity. The query_subgraph tool fills any gaps, making the surface effectively complete for a data-querying server.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      An MCP server that enables querying Polymarket prediction market data through The Graph subgraphs. It provides tools for accessing market stats, trader P\&L, user positions, and orderbook activity using AI agents.
      35
      101 npm
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Real-time prediction market intelligence for AI agents. Query Polymarket and Kalshi markets, wallet profiles, smart money leaderboards, social pulse signals, price candlesticks, and orderbook data — 13 agents, one MCP connection. Powered by 1.1TB+ of historical data.
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      AI-agent ready FastMCP server for Polymarket market discovery, wallet analytics, and public CLOB data, providing a read-only interface for querying markets, wallets, and order books.
      22
      35 PyPI
      -