Query Polymarket prediction market data via The Graph subgraphs
graph-polymarket-mcp
MCP server for querying Polymarket prediction market data via The Graph subgraphs.
Exposes 20 tools that AI agents (Claude, Cursor, etc.) can use to query market data, trader P&L, positions, activity, orderbook trades, open interest, market resolution status, and trader profiles.
v1.6.0 — five tools now cross-query multiple subgraphs in parallel to flag unreliable P&L, dead-money OI, and orderbook-only wallets that would otherwise produce misleading data.
Published to the MCP Registry as
io.github.PaulieB14/graph-polymarket-mcp
Prerequisites
You need a free Graph API key (takes ~2 minutes):
- Go to The Graph Studio
- Connect your wallet (MetaMask, WalletConnect, etc.)
- Click "API Keys" in the sidebar and create one
- Free tier includes 100,000 queries/month
Installation
npm install -g graph-polymarket-mcp
Or use directly with npx:
npx graph-polymarket-mcp
Configuration
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"graph-polymarket": {
"command": "npx",
"args": ["-y", "graph-polymarket-mcp"],
"env": {
"GRAPH_API_KEY": "your-api-key-here"
}
}
}
}
Claude Code
claude mcp add graph-polymarket -- npx -y graph-polymarket-mcp
Set the environment variable GRAPH_API_KEY before running.
Cursor / Other MCP Clients
Use the stdio transport with npx graph-polymarket-mcp as the command, passing GRAPH_API_KEY as an environment variable.
OpenClaw / Remote Agents (SSE)
Start the server with the HTTP transport:
# Dual transport — stdio + SSE on port 3851
GRAPH_API_KEY=your-key npx graph-polymarket-mcp --http
# SSE only (for remote/server deployments)
GRAPH_API_KEY=your-key npx graph-polymarket-mcp --http-only
# Custom port
MCP_HTTP_PORT=4000 GRAPH_API_KEY=your-key npx graph-polymarket-mcp --http
Then point your agent at the SSE endpoint:
{
"mcpServers": {
"graph-polymarket": {
"url": "http://localhost:3851/sse"
}
}
}
Transport Modes
| Invocation | Transports | Use case |
|---|---|---|
npx graph-polymarket-mcp |
stdio | Claude Desktop, Cursor, Claude Code |
npx graph-polymarket-mcp --http |
stdio + SSE :3851 | Dual — local + remote agents |
npx graph-polymarket-mcp --http-only |
SSE :3851 | OpenClaw, remote deployments |
A /health endpoint is available at http://localhost:3851/health when HTTP transport is active.
Available Tools
Core Tools
| Tool | Description |
|---|---|
list_subgraphs |
List all available Polymarket subgraphs with descriptions and key entities |
get_subgraph_schema |
Get the full GraphQL schema for a specific subgraph |
query_subgraph |
Execute a custom GraphQL query against any subgraph |
Domain-Specific Tools
| Tool | Description | Subgraphs |
|---|---|---|
get_market_data |
Get market/condition data with outcomes and resolution status | Main |
get_global_stats |
Get platform stats: market counts + real volume/fees/trades | Main + Orderbook |
get_account_pnl |
Get a trader's P&L and performance metrics (winRate, profitFactor, maxDrawdown) | Beefy P&L |
get_top_traders |
Leaderboard ranked by PnL, winRate, volume, or profitFactor. Cross-refs Orderbook to flag rows where OB volume exceeds Beefy-tracked volume and surface OB-only traders absent from the leaderboard. | Beefy P&L + Orderbook |
get_daily_stats |
Daily volume, fees, trader counts, and market activity (1–90 days) | Beefy P&L |
get_market_positions |
Top holders for a specific outcome token with their P&L | Beefy P&L |
get_user_positions |
Current token positions. Cross-refs Orderbook: flags ⚠ orderbook-only entry when totalBought=0 but OB volume exists, and ⚠ mixed entry when OB volume > 2× split collateral. |
Slimmed P&L + Orderbook |
get_recent_activity |
Unified chronological feed interleaving splits, merges, and redemptions with orderbook fills. Supports optional address filter. | Activity + Orderbook |
get_orderbook_trades |
Get |
Tools (12)
list_subgraphsList all available Polymarket subgraphs with descriptions and key entitiesget_subgraph_schemaGet the full GraphQL schema for a specific subgraphquery_subgraphExecute a custom GraphQL query against any subgraphget_market_dataGet market/condition data with outcomes and resolution statusget_global_statsGet platform stats: market counts + real volume/fees/tradesget_account_pnlGet a trader's P&L and performance metricsget_top_tradersLeaderboard ranked by PnL, winRate, volume, or profitFactorget_daily_statsDaily volume, fees, trader counts, and market activityget_market_positionsTop holders for a specific outcome token with their P&Lget_user_positionsCurrent token positions for a userget_recent_activityUnified chronological feed interleaving splits, merges, and redemptionsget_orderbook_tradesGet orderbook trade historyEnvironment Variables
GRAPH_API_KEYrequiredAPI key from The Graph StudioMCP_HTTP_PORTCustom port for HTTP transportConfiguration
{"mcpServers": {"graph-polymarket": {"command": "npx", "args": ["-y", "graph-polymarket-mcp"], "env": {"GRAPH_API_KEY": "your-api-key-here"}}}}