Build a Polymarket trading bot in Claude Code (MCP tutorial)
Plug datapolymarket's MCP server into Claude Code and you have a coding agent that can read live weather, query Chainlink lag, and write the strategy by chatting with you. No manual REST plumbing. Walkthrough with real prompts and a working bot at the end.
What is MCP?
Model Context Protocol — Anthropic's standard for letting an AI agent call external tools. Our MCP server exposes the datapolymarket API as native tools to Claude Code, Cursor, Codex CLI, and anything else that speaks MCP.
Setup (one minute)
# Install
npm install -g @datapolymarket/mcp
# Add to Claude Code config (~/.config/claude-code/mcp.json)
{
"mcpServers": {
"datapolymarket": {
"command": "npx",
"args": ["-y", "@datapolymarket/mcp"],
"env": { "DPM_API_KEY": "dpm_..." }
}
}
}What you can ask
Now in Claude Code:
> Find me 5 Polymarket weather markets where YES is underpriced by 10pp+ right now [Claude calls /v1/weather/resolution-probability for active markets, sorts by edge, returns:] 1. NYC ≥ 28°C — YES at 65¢, our prob 82%, edge +17pp 2. Tokyo ≥ 30°C — YES at 41¢, our prob 56%, edge +15pp 3. Berlin ≥ 22°C — YES at 38¢, our prob 51%, edge +13pp 4. ...
What it builds for you
Ask Claude to write the strategy. Tell it the rules. It writes Python that calls the API, ranks markets by edge, sizes positions, and connects to a Polymarket order client. You review and ship.
For the full MCP setup walk-through, see /learn/mcp.
Get the API. 3 days free, no card surprises.
Card required. $0 today. Auto-converts to $49.99/mo or $74.99/mo (Combo). Cancel any time before day 3 — no charge.
Start 3-day trial