Polymarket MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Polymarket MCP Server show me the top prediction markets by volume"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 |
| โ |
๐ Real-Time Pricing |
| โ |
๐ Analytics |
| โ |
๐ฆ Account |
| Wallet address |
๐ฐ Trading |
| Private key |
โ๏ธ Market Metadata |
| โ |
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 syncConfiguration
cp .env.example .envFor 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 USDConnect 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.pyArchitecture
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 & metadataAPI Coverage
API | Base URL | Purpose |
CLOB |
| Order books, prices, spreads, market data |
Gamma |
| Market/event discovery, metadata, search |
Data |
| Positions, trades, activity, open interest |
CLOB Auth |
| Order placement/cancellation, balances |
Development
npx -y @modelcontextprotocol/inspector uv run polymarket-mcpSafety 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 by query, tag, active/closed status |
| Get event details including all child markets |
| Search markets with filters (volume, tag, status) |
| Get full market metadata by ID or slug |
Tool | Description |
| Best bid/ask price for a token |
| Mid-market price (single / batch) |
| Bid-ask spread (single / batch) |
| Full order book depth (single / batch) |
| Last executed price (single / batch) |
Tool | Description |
| Historical time-series with configurable interval and fidelity |
| Total shares outstanding for a market |
Tool | Description |
| Current holdings with P&L breakdown |
| Historical executed trades |
| Full audit trail (trades, splits, merges, rewards) |
Tool | Description |
| Place a limit order (BUY/SELL, GTC/FOK/GTD/FAK) |
| Cancel a specific order |
| Cancel multiple orders |
| Emergency kill switch โ cancel everything |
| List all pending orders |
| Get order status and details |
| Check USDC balance and approvals |
Tool | Description |
| API health check |
| Server timestamp |
| Browse CLOB market listings |
| Market trading parameters |
| 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 toolscancel_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
Scored across 34 tools
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.
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.
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.
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
Related MCP Connectors
Polymarket in your AI: market rules, real fill costs, who is trading, top traders. Read-only.
Calibrated world model for AI agents. 40 tools: world state, markets, trading. Kalshi + Polymarket.
Polymarket trader analytics for AI agents: rank wallets, read trader metrics, backtest strategies.
Polymarket + Hyperliquid + macro for AI agents. 38 tools, signal backtest, SSE streaming. Free tier.
Related MCP Servers
- AlicenseBqualityNot gradedmaintenanceEnables 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.5941 npm-
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Polymarket prediction markets, including retrieving market data, user positions, and trading history.821 npm12Apache 2.0
- AlicenseAqualityDmaintenanceEnables AI assistants to discover prediction markets, view real-time data, execute trades (market/limit orders), and manage portfolios on Polymarket.641 npm3MIT
- AlicenseAqualityDmaintenanceEnables AI agents to browse, search, and trade on Polymarket prediction markets, including viewing markets, order books, balances, and placing/canceling orders.1122 npmMIT