Skip to main content
Glama
Polymarket MCP Server

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

Available Tools

34 tools
cancel_all_ordersB

Cancel ALL currently active open orders sequentially. Functions as an emergency kill switch.

Deploy this operation functionally to immediately liquidate all pending structural positions.

Inputs: no named parameters. Returns: result

cancel_orderA

Cancel an individual specified open limit order directly via its unique ID.

Args: order_id (str): The unique transaction order ID returned functionally during order placement.

Inputs: order_id (required). Returns: result

cancel_ordersB

Cancel multiple open limit orders concurrently via their unique IDs.

Args: order_ids (str): A comma-separated sequential string of order IDs to be canceled.

Inputs: order_ids (required). Returns: result

clob_health_checkA

Check if the Polymarket Central Limit Order Book (CLOB) API server is reachable and operational. Returns 'OK' if the API is currently healthy.

Inputs: no named parameters. Returns: result

clob_server_timeA

Get the current server time from the Polymarket CLOB API as a Unix timestamp.

Inputs: no named parameters. Returns: result

get_activityA

Retrieve a comprehensive activity log for the authenticated user, encompassing trades, splits, merges, and rewards.

Provides a detailed audit trail of all supported account actions. Automatically utilizes the wallet address defined in the POLYMARKET_WALLET_ADDRESS environment variable.

Args: market (Optional[str]): Filter logs by a specific market condition ID. activity_type (Optional[str]): Filter logs by explicit activity type (e.g., 'TRADE', 'SPLIT', 'MERGE', 'REDEEM', 'REWARD', 'CONVERSION'). limit (Optional[int]): The maximum number of paginated results to return. offset (Optional[int]): The pagination offset.

Inputs: limit, market, offset, activity_type. Returns: result

get_balance_allowanceC

Retrieve the functional token balance and structural approval threshold metrics on the Polymarket protocol.

Args: asset_type (Optional[str]): 'COLLATERAL' to fetch the cumulative USDC balance or 'CONDITIONAL' to query conditional outcome token holdings. token_id (Optional[str]): Required intrinsically when the specified 'asset_type' functions as 'CONDITIONAL'.

Inputs: token_id, asset_type. Returns: result

get_clob_marketB

Retrieve detailed, comprehensive information regarding a single Polymarket prediction market.

Args: condition_id (str): The unique on-chain identifier corresponding to the specific market's conditions.

Inputs: condition_id (required). Returns: result

get_clob_marketsB

Retrieve a paginated list of all prediction markets actively trading on the Polymarket CLOB API.

Provides comprehensive details for each market, including the on-chain condition IDs, corresponding outcome token IDs, and trading configuration parameters.

Args: next_cursor (Optional[str]): The pagination cursor string returned from a previous request. Omit this argument to fetch the first page of results.

Inputs: next_cursor. Returns: result

get_clob_simplified_marketsA

Retrieve a paginated, simplified list of all prediction markets actively trading on the Polymarket CLOB API.

This provides less detail than get_clob_markets but operates significantly faster, making it suitable for overview data.

Args: next_cursor (Optional[str]): The pagination cursor string returned from a previous request. Omit this argument to fetch the first page of results.

Inputs: next_cursor. Returns: result

get_eventA

Retrieve detailed, comprehensive information regarding a specific Polymarket event.

Provides complete event metadata alongside a listing of all associated constituent markets, including their real-time prices, trading volumes, and specific outcome token identifiers.

Args: event_id (str): The unique Gamma identifier for the event (formatted as a numeric string).

Inputs: event_id (required). Returns: result

get_fee_rateC

Retrieve the baseline trading fee rate (measured in basis points) applicable to a specific token's market.

Args: token_id (str): The fundamental token identifier indicating the outcome side.

Inputs: token_id (required). Returns: result

get_gamma_marketB

Retrieve detailed, comprehensive information regarding a single, specific Polymarket market natively via the Gamma API.

Provides complete structural market metadata including the core question, qualitative description, array of outcomes, respective CLOB token IDs, global condition ID, cumulative volume, and definitive resolution parameters.

Args: market_id_or_slug (str): The unique Gamma market mapping ID (numeric string) or URL-friendly slug.

Inputs: market_id_or_slug (required). Returns: result

get_last_trade_priceC

Retrieve the exact transaction price of the most recently executed trade for an outcome token.

Args: token_id (str): The fundamental token identifier indicating the outcome side.

Inputs: token_id (required). Returns: result

get_last_trades_pricesB

Retrieve the transaction prices of the most recently executed trades for multiple outcome tokens concurrently.

Args: token_ids (str): A comma-separated list of foundational token IDs.

Inputs: token_ids (required). Returns: result

get_market_trades_eventsB

Fetch the stream of live trade activity and lifecycle events occurring on a specific Polymarket prediction market.

Args: condition_id (str): The unique on-chain identifier corresponding to the specific market's conditions.

Inputs: condition_id (required). Returns: result

get_midpointB

Calculate and return the mid-market price for a specified outcome token.

The midpoint serves as a fair-value indicator generated by averaging the current best bid and best ask prices.

Args: token_id (str): The fundamental token identifier indicating the outcome side.

Inputs: token_id (required). Returns: result

get_midpointsA

Calculate and return the mid-market prices concurrently for multiple outcome tokens.

Args: token_ids (str): A comma-separated list of foundational token IDs to fetch fair value for.

Inputs: token_ids (required). Returns: result

get_neg_riskC

Verify whether a specified outcome token's market utilizes the negative risk mathematical framework.

Args: token_id (str): The fundamental token identifier indicating the outcome side.

Inputs: token_id (required). Returns: result

get_open_interestA

Retrieve the current open interest (total outstanding shares) for a specific market or globally.

Open interest serves as an indicator of market conviction and overall liquidity.

Args: condition_id (Optional[str]): The unique on-chain identifier for a specific market's conditions. Omit to retrieve a global aggregate.

Inputs: condition_id. Returns: result

get_open_ordersB

Retrieve a comprehensive list of all open/pending limit orders currently active for the authenticated account.

Args: market (Optional[str]): Explicitly filter results chronologically by market condition ID. asset_id (Optional[str]): Explicitly filter results specifically by CLOB token ID.

Inputs: market, asset_id. Returns: result

get_orderB

Retrieve granular structural details and fundamental status of a specifically defined order.

Args: order_id (str): The unique transaction order ID to dynamically query.

Inputs: order_id (required). Returns: result

get_order_bookB

Retrieve the current full depth of the order book (all pending bids and asks) for a specific outcome token.

This provides a complete snapshot of all open buy and sell orders mapped to their respective price levels.

Args: token_id (str): The fundamental token ID associated with a specific outcome (e.g., the YES or NO side of the bet) in a prediction market.

Inputs: token_id (required). Returns: result

get_order_booksB

Retrieve the current order books for up to multiple discrete tokens concurrently.

Args: token_ids (str): A comma-separated list of foundational token IDs to fetch mapping for.

Inputs: token_ids (required). Returns: result

get_positionsA

Retrieve current portfolio positions and quantitative holdings for the authenticated user.

Provides detailed position data including share size, average entry price, and calculated P&L for each held outcome token. Automatically utilizes the wallet address defined in the POLYMARKET_WALLET_ADDRESS environment variable.

Args: market (Optional[str]): Filter results by a specific market condition ID. event_id (Optional[str]): Filter results by a specific overarching event ID. size_threshold (Optional[float]): The minimum numerical position size required for inclusion in the results. limit (Optional[int]): The maximum number of paginated results to return. offset (Optional[int]): The pagination offset.

Inputs: limit, market, offset, event_id, +1 more. Returns: result

get_priceB

Fetch the single best available price for a given outcome token on a specified directional side.

Pricing maps intrinsically to outcome probabilities in the range 0.00 to 1.00.

Args: token_id (str): The fundamental token identifier indicating the outcome side. side (str): The designated trading side to check, either strictly 'BUY' or 'SELL'.

Inputs: side (required), token_id (required). Returns: result

get_price_historyA

Retrieve historical price time-series data for a specified token.

Provides a chronologically ordered list of objects containing timestamp and price data, facilitating charting and trend analysis.

Args: token_id (str): The fundamental token ID associated with a specific outcome. interval (Optional[str]): A predefined time window ending at the current moment. Valid options include: '1h', '6h', '1d', '1w', '1m', 'max'. This parameter is mutually exclusive with 'start_ts'/'end_ts'. fidelity (Optional[int]): The data resolution expressed in minutes (e.g., 60 for hourly data, 1440 for daily data). start_ts (Optional[int]): The starting Unix timestamp in UTC. Use in conjunction with 'end_ts' instead of 'interval'. end_ts (Optional[int]): The ending Unix timestamp in UTC. Use in conjunction with 'start_ts' instead of 'interval'.

Inputs: token_id (required), end_ts, fidelity, interval, +1 more. Returns: result

get_spreadC

Calculate and return the current bid-ask spread for a specified outcome token.

The spread serves as a key liquidity indicator; smaller spreads typically denote deeper, more efficient markets.

Args: token_id (str): The fundamental token identifier indicating the outcome side.

Inputs: token_id (required). Returns: result

get_spreadsB

Calculate and return the current bid-ask spreads for multiple specified tokens concurrently.

Args: token_ids (str): A comma-separated list of foundational token IDs.

Inputs: token_ids (required). Returns: result

get_tick_sizeB

Retrieve the minimum allowable price increment (tick size) for trading a specific token's market.

Args: token_id (str): The fundamental token identifier indicating the outcome side.

Inputs: token_id (required). Returns: result

get_trade_historyB

Retrieve the historical log of executed trades associated with a specific user or market.

Provides chronological records of executed trades, detailing transaction price, share size, designated side, and timestamp.

Args: user (Optional[str]): The wallet address to query historical trades for. market (Optional[str]): Filter results by a specific market condition ID. limit (Optional[int]): The maximum number of paginated results to return. offset (Optional[int]): The pagination offset.

Inputs: user, limit, market, offset. Returns: result

place_orderA

Place a limit order on a Polymarket prediction market.

โš ๏ธ WARNING: This action actively spends real currency! The total order value (price ร— size) is validated against the POLYMARKET_MAX_ORDER_SIZE prior to API submission. To test safely without financial execution, configure POLYMARKET_DRY_RUN=true in the environment .env file.

Args: token_id (str): The fundamental CLOB token ID indicating the precise outcome side (e.g., YES or NO). price (float): The designated limit price, scaling strictly between 0.01 and 0.99 (representing outcome probability). size (float): The aggregate number of shares to purchase or sell. side (str): The functional trading direction, strictly either 'BUY' or 'SELL'. order_type (Optional[str]): The operational order type payload. Options: GTC (Good-Til-Cancelled), FOK (Fill-Or-Kill), GTD (Good-Til-Date), FAK (Fill-And-Kill). tick_size (Optional[str]): The calculated market tick size structure (e.g., '0.1', '0.01', '0.001', '0.0001'). neg_risk (Optional[bool]): Designates whether the overarching market utilizes a negative risk framework.

Inputs: side (required), size (required), price (required), token_id (required), +3 more. Returns: result

search_eventsA

Search and discover Polymarket prediction events.

Events function as high-level thematic containers grouping related markets (e.g., '2024 US Presidential Election' containing multiple candidate markets). This serves as the primary entry point for exploring the Polymarket ecosystem.

Args: query (Optional[str]): A search term utilized to filter events by their title or descriptive slug. tag (Optional[str]): A thematic category tag for filtering (e.g., 'politics', 'crypto', 'sports'). active (Optional[bool]): Set to true to strictly return currently active and open events. closed (Optional[bool]): Set to true to strictly return resolved or closed events. order (Optional[str]): The chronological or statistical field to sort results by (e.g., 'volume', 'created_at', 'end_date_iso'). ascending (Optional[bool]): The sort direction. Defaults to false (descending order). limit (Optional[int]): The maximum number of paginated results to return. offset (Optional[int]): The pagination offset for results.

Inputs: tag, limit, order, query, +4 more. Returns: result

search_marketsB

Search and discover specific, individual Polymarket prediction markets.

Each individual market constitutes a singular yes/no predictive question utilizing tradeable outcome tokens. These markets provide the fundamental CLOB token IDs intrinsically required for pricing and order book evaluations.

Args: query (Optional[str]): A search term utilized to filter markets by their title or descriptive slug. tag (Optional[str]): A thematic category tag for filtering. active (Optional[bool]): Set to true to strictly return currently active and successfully tradeable markets. closed (Optional[bool]): Set to true to strictly return definitively resolved or settled markets. condition_id (Optional[str]): Filter intrinsically by a unique on-chain condition ID. clob_token_ids (Optional[str]): Filter fundamentally by defined CLOB token IDs. order (Optional[str]): The specific field to sort the payload by. ascending (Optional[bool]): The structural sort direction. limit (Optional[int]): The maximum number of paginated results to return. offset (Optional[int]): The defined pagination offset limit.

Inputs: tag, limit, order, query, +6 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    B3.2/5.0

    Scored across 34 tools

    Disambiguation3/5

    Many tools target distinct operations, but multiple market-retrieval endpoints overlap heavily: get_clob_markets, get_clob_simplified_markets, get_clob_market, get_gamma_market, and search_markets all fetch market information. Singular/plural order-book tools and price variants also require careful selection, though the descriptions help clarify differences.

    Naming Consistency4/5

    Most tools use snake_case with predictable action prefixes such as get_, place_, cancel_, and search_, and batch variants are generally pluralized. Minor deviations include clob_health_check and clob_server_time, which lack the get_ action prefix, but the overall naming pattern is readable and consistent.

    Tool Count2/5

    With 34 tools, the surface is above the 25-tool threshold for being heavy and includes several singular/plural duplicates and thin API wrappers. The domain is broad, but the set feels over-expanded rather than tightly scoped.

    Completeness4/5

    The server covers market discovery, pricing, order books, trading, order management, positions, and balance allowance, which is a strong lifecycle surface for Polymarket. Missing order modification and direct redeem/split/merge operations are minor gaps that agents can partly work around.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      Not graded
      maintenance
      Enables AI agents to interact with the Polymarket prediction market platform to discover markets, analyze real-time pricing, and monitor public portfolio data. It provides comprehensive access to market analytics, implied probabilities, and order books through the Model Context Protocol.
      59
      41 npm
      -