Polymarket MCP Server

Polymarket MCP Server

Enables LLM agents to interact with Polymarket prediction markets, including market discovery, real-time pricing, analytics, account management, and trading with built-in safety guards.

Category
Visit Server

README

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.

<div align="center">

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

</div>

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 โŒ

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

<details> <summary><strong>Market Discovery (4 tools)</strong></summary>

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

</details>

<details> <summary><strong>Real-Time Pricing (10 tools)</strong></summary>

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)

</details>

<details> <summary><strong>Analytics (2 tools)</strong></summary>

Tool Description
get_price_history Historical time-series with configurable interval and fidelity
get_open_interest Total shares outstanding for a market

</details>

<details> <summary><strong>Account Management (3 tools)</strong></summary>

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)

</details>

<details> <summary><strong>Trading (7 tools)</strong></summary>

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

</details>

<details> <summary><strong>CLOB Metadata (6 tools)</strong></summary>

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

</details>

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured