Content
# polymarket-mcp
Clean, **NegRisk-resolved** Polymarket market & order-book data as an MCP server.
No API key, no database — stateless wrappers over the public Gamma and CLOB
APIs, with the messy parts (keyset pagination, NegRisk flags, token→outcome
resolution, book parsing) already handled for you.
Point any MCP client (Claude Desktop, Cowork, Cursor, …) at it and your agent
can query prediction-market data directly.
## Tools
| Tool | What it does |
|---|---|
| `polymarket_get_markets` | Top active markets by liquidity or 24h volume. Returns question, conditionId, **outcome→tokenId mapping**, negRisk flag, event, liquidity, volume, best bid/ask, spread. Filters: `limit`, `order_by`, `min_liquidity`, `contains`, `neg_risk_only`. |
| `polymarket_get_orderbook` | Live CLOB order book(s) for one or more outcome token ids. Sorted bids/asks + best bid/ask, spread, midpoint. |
| `polymarket_resolve_token` | Resolve a `token_id`, `condition_id`, or `slug` to its market and outcome mapping (which outcome the token is, its siblings). |
## Install & run
```bash
npm install
npm run build
```
Add to your MCP client config (e.g. Claude Desktop `claude_desktop_config.json`):
```json
{
"mcpServers": {
"polymarket": { "command": "node", "args": ["/absolute/path/to/polymarket-mcp/dist/server.js"] }
}
}
```
Then ask your agent things like *"what are the most active Polymarket markets
right now?"* or *"get the order book for this token id"*.
### Try it without a client
```bash
npm run build && npm run smoke # drives the server over stdio against live APIs
```
## Config (all optional)
| Env | Default |
|---|---|
| `GAMMA_BASE_URL` | `https://gamma-api.polymarket.com` |
| `CLOB_BASE_URL` | `https://clob.polymarket.com` |
| `FETCH_TIMEOUT_MS` | `15000` |
## Notes
- **Read-only.** No trading, no orders, no keys. It reads public data.
- Every fetch has a hard timeout + backstop so a stalled upstream can't hang the
server.
- This is a data-access tool, not trading advice. Prices and books are live
public data; verify before acting on them.
## License
MIT