graph-polymarket-mcp is an MCP server for querying Polymarket prediction market data, exposing 31 tools to AI agents (such as Claude, Cursor, etc.) through The Graph subgraphs and the Polymarket REST API (Gamma and CLOB).
Main capabilities
- Market discovery (Gamma API): search prediction markets, browse active events, sort by volume, filter by category, etc.
- Real-time trading data (CLOB API): get current prices, full order books, bid-ask spreads, price history, etc. No Graph API Key is required; it directly accesses Polymarket's public REST endpoints.
- On-chain analytics (The Graph subgraphs): query global statistics, latest order book trades, positions of a specified address, trader profit and loss, open interest, disputed markets, top traders, full transaction history of a wallet, etc. This part requires GRAPH_API_KEY.
Version and migration notes
- v2.0.0 adds 10 tools powered by the Polymarket Gamma and CLOB APIs (inspired by polymarket-cli).
- Polymarket migrated to the V2 exchange contracts on 2026-04-28. The V2 subgraphs read by the relevant tools begin indexing from block 84902353 and do not include historical data from before the migration; V1 and V2 are different eras, not old and new versions.
- V2 adds builder attribution capability: every V2 trade carries the builder code of the frontend, bot, or integrator that routed the transaction. As of 2026-08-08, there are 3,325 builders in total.
- The tools handle two common pitfalls: the V2 exchange contracts appear as Account rows (because the exchange is the taker when orders are matched), and simple ranking by account would place 0xe111…996b (176 million trades) and 0xe222…0f59 (41 million trades) above all human users; get_v2_top_traders excludes these addresses; in addition, v2_main is still syncing and will return stale data rather than an error, and check_subgraph_freshness can check its staleness before trusting the datadegree.
- Choosing the query era: use V1 for all-time data or data before 2026-04-28; use V2 for post-migration activity or any builder-related questions. beefy_pnl retains the hedge fund metrics that V2 P&L does not have (winRate, profitFactor, maxDrawdown, daily series), so trader quality scoring is still done on V1.
Usage
- Before use, you need to obtain a free Graph API Key: go to The Graph Studio, connect a wallet (MetaMask, WalletConnect, etc.), click "API Keys" in the sidebar and create one; the free tier is 100,000 queries per month.
- It can be used directly via npx: set the GRAPH_API_KEY environment variable before running.
- Claude Desktop: add it to claude_desktop_config.json and set the GRAPH_API_KEY environment variable.
- Cursor / other MCP clients: use stdio transport, with the command npx graph-polymarket-mcp, and pass GRAPH_API_KEY as an environment variable.
- OpenClaw / remote agents (SSE): SSE transport has no authentication, and anyone who can access the port can call all tools and consume your GRAPH_API_KEY quota. --http binds to 0.0.0.0 inside the container, so the host port should be published to 127.0.0.1, and a reverse proxy with TLS and authentication should be placed in front of any externally accessible endpoint. For local agents, it is recommended to prefer the default stdio transport, which has no network exposure at all.
- After starting the server with HTTP transport, point the agent at the SSE endpoint. When HTTP transport is active, it can be accessed via http://localhost:3851/health Access the /health endpoint.
Example queries (which the AI agent can execute after connecting)
- Market discovery (Gamma API): search for prediction markets about AI, view the currently most active Polymarket events, find 2024 election markets sorted by trading volume, view markets under the 'crypto' category.
- Real-time trading data (CLOB API): query the current price of the Trump YES token, view the full order book, view the bid-ask spread, view the price history over the past week.
- On-chain analytics (The Graph): view global Polymarket statistics, the latest 20 order book fills, positions for a specified address (which will flag whether the wallet entered solely through OB buys), profit and loss for a specified trader, the market with the most current open interest (which will flag dead money OI on resolved markets), disputed markets, top traders (which will flag any OB trading volume not captured by Beefy P&L), the full transaction history for a specified wallet (including OB fills and entry type classification).
Limitations
- The on-chain analytics tool requires a Graph API Key, with a free tier of 100,000 queries per month.
- The SSE transport has no authentication, posing quota consumption and security risks.
- The V2 subgraph does not include pre-migration history, and v2_main is still syncing, so it may return stale data.
- Apart from the above information, the specific tool list, full parameters, and code details are not provided.