Skip to main content
Glama
Arjein

Polymarket MCP Server

by Arjein

Polymarket MCP Server

An MCP (Model Context Protocol) server that gives LLM agents full access to Polymarket โ€” the world's largest prediction market. Discover markets, analyze trends, monitor positions, and execute trades.

34 tools ยท 4 APIs ยท Read + Write ยท Safety Guards Built-in

Features

Category

Tools

Auth Required

๐Ÿ” Market Discovery

search_events, search_markets, get_event, get_gamma_market

โŒ

๐Ÿ“Š Real-Time Pricing

get_price, get_midpoint, get_spread, get_order_book, get_last_trade_price + batch variants

โŒ

๐Ÿ“ˆ Analytics

get_price_history, get_open_interest

โŒ

๐Ÿฆ Account

get_positions, get_trade_history, get_activity

Wallet address

๐Ÿ’ฐ Trading

place_order, cancel_order, cancel_all_orders, get_open_orders, get_balance_allowance

Private key

โš™๏ธ Market Metadata

get_tick_size, get_neg_risk, get_fee_rate, CLOB market listings

โŒ

Related MCP server: Polymarket MCP Server

Quick Start

Prerequisites

  • Python 3.12+

  • uv (recommended) or pip

Installation

git clone https://github.com/Arjein/polymarket-mcp.git
cd polymarket-mcp
uv sync

Configuration

cp .env.example .env

For read-only tools (market data, analytics): no configuration needed.

For trading tools: add your credentials to .env:

POLYMARKET_PRIVATE_KEY=0xYourPrivateKey
POLYMARKET_WALLET_ADDRESS=0xYourWalletAddress
POLYMARKET_DRY_RUN=true        # Start with dry-run!
POLYMARKET_MAX_ORDER_SIZE=100  # Safety limit in USD

Connect to Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "polymarket": {
      "command": "uv",
      "args": ["--directory", "/path/to/polymarket-mcp", "run", "server.py"]
    }
  }
}

Run Standalone

uv run server.py

Architecture

polymarket-mcp/
โ”œโ”€โ”€ server.py              # MCP server entrypoint
โ”œโ”€โ”€ clients/
โ”‚   โ”œโ”€โ”€ clob.py            # CLOB API (public reads + price history)
โ”‚   โ”œโ”€โ”€ gamma.py           # Gamma API (market/event discovery)
โ”‚   โ”œโ”€โ”€ data.py            # Data API (positions, trades, open interest)
โ”‚   โ””โ”€โ”€ auth_clob.py       # Authenticated CLOB (orders, balances)
โ”œโ”€โ”€ tools/
โ”‚   โ”œโ”€โ”€ clob_tools.py      # 18 read-only CLOB tools
โ”‚   โ”œโ”€โ”€ gamma_tools.py     # 4 market discovery tools
โ”‚   โ”œโ”€โ”€ data_tools.py      # 5 analytics & account tools
โ”‚   โ””โ”€โ”€ trading_tools.py   # 7 authenticated trading tools
โ”œโ”€โ”€ .env.example           # Configuration template
โ””โ”€โ”€ pyproject.toml         # Dependencies & metadata

API Coverage

API

Base URL

Purpose

CLOB

clob.polymarket.com

Order books, prices, spreads, market data

Gamma

gamma-api.polymarket.com

Market/event discovery, metadata, search

Data

data-api.polymarket.com

Positions, trades, activity, open interest

CLOB Auth

clob.polymarket.com

Order placement/cancellation, balances

Development

npx -y @modelcontextprotocol/inspector uv run polymarket-mcp

Safety Guards

The trading tools include built-in safety mechanisms:

  • Dry-run mode (POLYMARKET_DRY_RUN=true): Orders are simulated and returned as JSON without executing. Enabled by default.

  • Max order size (POLYMARKET_MAX_ORDER_SIZE): Orders exceeding this USD value are rejected. Default: $100.

  • Lazy authentication: The server starts without credentials โ€” read-only tools work immediately. Auth is only initialized when a trading tool is first called.

Tool Reference

Tool

Description

search_events

Search events by query, tag, active/closed status

get_event

Get event details including all child markets

search_markets

Search markets with filters (volume, tag, status)

get_gamma_market

Get full market metadata by ID or slug

Tool

Description

get_price

Best bid/ask price for a token

get_midpoint / get_midpoints

Mid-market price (single / batch)

get_spread / get_spreads

Bid-ask spread (single / batch)

get_order_book / get_order_books

Full order book depth (single / batch)

get_last_trade_price / get_last_trades_prices

Last executed price (single / batch)

Tool

Description

get_price_history

Historical time-series with configurable interval and fidelity

get_open_interest

Total shares outstanding for a market

Tool

Description

get_positions

Current holdings with P&L breakdown

get_trade_history

Historical executed trades

get_activity

Full audit trail (trades, splits, merges, rewards)

Tool

Description

place_order

Place a limit order (BUY/SELL, GTC/FOK/GTD/FAK)

cancel_order

Cancel a specific order

cancel_orders

Cancel multiple orders

cancel_all_orders

Emergency kill switch โ€” cancel everything

get_open_orders

List all pending orders

get_order

Get order status and details

get_balance_allowance

Check USDC balance and approvals

Tool

Description

clob_health_check

API health check

clob_server_time

Server timestamp

get_clob_markets / get_clob_simplified_markets

Browse CLOB market listings

get_tick_size / get_neg_risk / get_fee_rate

Market trading parameters

get_market_trades_events

Live trade feed for a market

Example Usage

Once connected to Claude Desktop, you can ask:

"What are the hottest markets on Polymarket right now?"

"Show me the Bitcoin price history over the last week"

"What's the order book depth for the Fed rate decision market?"

"Place a dry-run buy order for 100 YES shares at $0.35 on the Super Bowl market"

โš ๏ธ Disclaimer

This software is provided for educational and informational purposes only. It is not financial advice.

  • Trading prediction markets involves risk. You may lose some or all of your funds.

  • The authors are not responsible for any financial losses incurred through the use of this software.

  • You are solely responsible for your own trading decisions and for complying with all applicable laws and regulations in your jurisdiction.

By using this software, you acknowledge and accept these risks.

License

MIT

A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

โ€“Maintainers
โ€“Response time
โ€“Release cycle
โ€“Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Arjein/polymarket-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server