Skip to main content
Glama
polymarket-trader-mcp

polymarket-trader-mcp

Polymarket Agent MCP Server

polymarket-agent-mcp MCP server

npm version CI GitHub last commit License: MIT Node.js TypeScript MCP SDK Tools Tests SafeSkill 97/100 Socket Badge OpenSSF Scorecard OpenSSF Best Practices

Trade, analyze, and automate Polymarket prediction markets through AI.

The most comprehensive MCP server for Polymarket — 48 tools spanning direct trading, market discovery, smart money tracking, copy trading, backtesting, risk management, and portfolio optimization. Works with Claude Code, Cursor, or any MCP-compatible client.


Tool Overview

Category

Count

Highlights

Discovery

9

Search, trending, featured, events, related markets, smart money flow

Analysis

8

AI opportunity scoring, conviction rating, price history, market quality, top holders, comparison

Trading

8

Buy, sell, batch orders, limit orders, order management, safety limits

Copy Trading

5

Watch traders, auto-monitor, auto-rebalance, backtest

Portfolio

10

Positions, P&L, balance, risk assessment, SL/TP, optimization, market alerts

Utilities

8

Dashboard, config, trade history, watchlists, agent logging


Related MCP server: Polymarket MCP Server

Quick Start

npm Install

npm install -g polymarket-agent-mcp

Docker

docker compose up

Claude Code Config

Add to ~/.claude/settings.json:

{
  "mcpServers": {
    "polymarket": {
      "command": "npx",
      "args": ["polymarket-agent-mcp"]
    }
  }
}

Usage Examples

Just talk naturally to your AI assistant:

"What are the trending markets today?"

"Search for bitcoin prediction markets"

"Buy $5 on this market"

"Score this trader — should I copy them?"

"Backtest this trader with $10 per trade"

"Show smart money flow — what are the top traders buying?"

"Set stop-loss at 0.30 on my BTC position"

"Optimize my portfolio with a balanced strategy"

"Scan for arbitrage opportunities"

"Compare these two markets side by side"


All 48 Tools

Discovery

Tool

Description

markets.search

Search markets by keyword (bitcoin, election, UFC...)

traders.discover

Find top traders by PnL and volume

markets.discover

Find markets by end date and category

markets.trending

Top markets by 24h/7d/30d volume

markets.featured

Most liquid markets by category (politics, sports, crypto...)

wta.discover

WTA tennis markets with stink bid prices

flow.discover

Smart money signals — multiple top traders buying same market

markets.related

Find markets related to a topic or market

markets.events

Browse all markets under an event

Analysis

Tool

Description

markets.analyze

AI-powered BUY/SELL/HOLD recommendation

traders.analyze

Detailed trader profile, win rate, P&L

traders.score

Conviction score (0-100) across 5 dimensions

markets.check

Market quality — spread, depth, price range

markets.price

Live bid/ask/spread prices

markets.price_history

Historical prices with sparkline (1h to 1m)

markets.holders

Biggest position holders in a market

markets.compare

Side-by-side comparison of 2-5 markets

Trading

Tool

Description

orders.buy

Buy shares on any market

orders.sell

Sell an open position

orders.batch

Execute up to 10 orders at once

wta.bid

Place limit orders at discount

orders.cancel

Cancel all open orders

orders.list

View pending limit orders

orders.status

Check status of a specific order

config.go_live

Switch from preview to live mode

Copy Trading

Tool

Description

watchlist.add

Add/remove traders from watchlist

monitor.start

Start automatic copy trading loop

monitor.stop

Stop monitoring

watchlist.rebalance

Remove underperforming traders

traders.backtest

Simulate copying a trader's past trades

Portfolio & Risk

Tool

Description

portfolio.balance

Account balance, budget, and P&L

portfolio.get

Multi-wallet overview with P&L per trader

positions.list

Open/closed positions

positions.close

Manually close a position

positions.set_exit_rules

Set stop-loss and take-profit levels

positions.check_exits

Check positions for resolution

portfolio.risk

Portfolio risk scoring and warnings

portfolio.optimize

AI-powered optimization (conservative/balanced/aggressive)

markets.watch

Market watchlist with price alerts

markets.watch_price

Live WebSocket price subscriptions

markets.arbitrage

Find YES+NO price discrepancies

Configuration

Tool

Description

config.set

Update bot settings

config.safety_limits

Max order size, exposure cap, spread tolerance

dashboard.get

Terminal-formatted dashboard

trades.history

Trade history with filters

watchlist.list

Show watched wallets

agent.log_cycle

Log agent cycle for dashboard

traders.positions

View a trader's open positions


Architecture

Claude Code / Cursor / AI Client
        |
        | MCP Protocol (stdio)
        v
+------------------+
|  MCP Server      |  48 tools registered
|  (index.ts)      |
+--------+---------+
         |
    +----+----+
    |         |
 Tools    Services
    |         |
    v         v
+-------+ +------------+
| Zod   | | Backtester |
| Input | | Scorer     |
| Valid. | | SmartFlow  |
+-------+ | Filter     |
          | Tracker    |
          | Executor   |
          +-----+------+
                |
        +-------+-------+
        |       |       |
     Data    Gamma    CLOB
     API      API     API

HTTP Transport & Deployment

The server supports two transport modes:

Mode

Activation

Use case

stdio (default)

npx polymarket-agent-mcp

Claude Code, Cursor, local MCP clients

HTTP

--http flag or PORT env var

Self-hosted Docker, private VPS, single-user remote

Deployment model — read this first

This server is designed for single-tenant use. Each client runs its own instance with its own SQLite database (copytrader.db), watchlist, daily budget, trade history, and monitor loop. The stdio mode is the recommended path for most users — npx polymarket-agent-mcp or the Claude Code config above gives you a fully isolated, local-only instance.

⚠️ Do not expose an HTTP instance publicly. The server has no per-user isolation: watchlist, positions, budget, and the background monitor loop are shared across every client that connects. A public HTTP deployment is effectively a shared workspace, not a multi-tenant SaaS. If you enable live trading, a public endpoint can drain your Polymarket wallet from any caller. Always configure the HTTP bearer-token env var (see PERMISSIONS.md) and keep the endpoint behind a firewall, VPN, or auth proxy.

Starting in HTTP mode

# Flag
node dist/index.js --http

# Or set PORT (defaults to 3000)
PORT=8080 node dist/index.js

Endpoints

Path

Method

Description

/mcp

POST

MCP protocol endpoint (Streamable HTTP transport)

/health

GET

Health check — returns { status, version, db }

/.well-known/mcp/server-card.json

GET

MCP discovery card (tools, permissions, data handling)

/

GET

Server info with version and endpoint list

Authentication

The HTTP transport accepts an optional bearer token gated by an environment variable — the exact name is documented in PERMISSIONS.md. When set, clients must send Authorization: Bearer <token> on requests to /mcp; when unset the endpoint is open (suitable only for local or private networks).

Docker deployment

A prebuilt multi-arch image is published to GHCR on every release:

docker pull ghcr.io/demwick/polymarket-agent-mcp:1.7.0

Or build it yourself from the included Dockerfile:

docker build -t polymarket-mcp .
docker run -p 3000:3000 -v mcp-data:/app/data \
  -e DAILY_BUDGET=50 \
  polymarket-mcp
# To require bearer-token auth on /mcp, also pass the HTTP bearer env var
# listed in PERMISSIONS.md (e.g. `-e <VAR>=my-secret-key`).

DB_PATH (default /app/data/copytrader.db) controls where SQLite data is persisted — mount a volume to keep it across restarts.


Configuration

All secrets stay in memory for the lifetime of the process — they are never written to the database, logs, or disk, and are only transmitted to their designated Polymarket API endpoint over HTTPS. The complete authoritative env var list, with per-variable sensitivity and scope, lives in PERMISSIONS.md and SECURITY.md.

Variable

Required

Default

Description

COPY_MODE

No

preview

preview (simulated) or live (real orders)

DAILY_BUDGET

No

20

Max daily spend in USDC

MIN_CONVICTION

No

3

Min trade size to copy ($)

Wallet signing key

Live only

-

Locally signs CLOB order payloads, never persisted (see PERMISSIONS.md for exact env var name)

CLOB API credentials

Live only

-

API key / secret / passphrase — sent only to clob.polymarket.com (see PERMISSIONS.md for exact names)


Safety Features

  • Configurable order size limits

  • Total exposure caps

  • Per-market position limits

  • Minimum liquidity requirements

  • Maximum spread tolerance

  • Stop-loss / take-profit automation

  • Preview mode (default) — no real money


Permissions & Capabilities

This package has a transparent, minimal footprint. Full disclosure: PERMISSIONS.md — machine-readable version in .well-known/mcp/server-card.json.

Category

Scope

Network (outbound)

3 Polymarket HTTPS APIs + 1 inbound-only WSS public price stream (ws-subscriptions-clob.polymarket.com)

Filesystem

Single SQLite database file + .env read at startup — nothing else

Environment

API credentials (live mode only, in memory only), budget config, mode selection

Processes

None — no child processes, no shell commands, no eval/Function

Telemetry

None — no analytics, no crash reports, no update checks, no third-party data flow

WebSocket scope: The WSS connection to Polymarket is inbound-only for public price updates. No wallet, credential, or user identity is transmitted — it carries the same public feed available to any browser client.

Secrets scope: Every secret environment variable is held in memory only, never logged, never persisted, and sent to exactly one host (see SECURITY.md).


Development

git clone https://github.com/demwick/polymarket-agent-mcp.git
cd polymarket-agent-mcp
npm install
npm run build
npm test         # 200+ tests

License

MIT - see LICENSE

Available Tools

48 tools
analysis.arbitrageA

Scan active Polymarket markets for arbitrage opportunities where YES + NO prices don't sum to $1.00. Returns markets with the price gap and potential profit percentage.

Inputs: limit, min_spread.

analysis.compareA

Compare 2-5 Polymarket markets side by side. Shows price, spread, order book depth, volume, and quality score for each market. Useful for choosing the best market to trade among similar options.

Inputs: condition_ids (required).

analysis.flowA

Scan top leaderboard traders for smart money convergence signals. Identifies markets where multiple top traders are buying the same outcome simultaneously, indicating strong conviction. Pro feature.

Inputs: top_traders, max_age_minutes, min_traders.

analysis.holdersA

View the largest position holders in a Polymarket market by condition_id. Shows wallet address, position size, and side (YES/NO). Useful for gauging smart money sentiment on a market.

Inputs: condition_id (required), limit.

analysis.opportunityA

Generate a BUY/SELL/HOLD recommendation for a Polymarket market by analyzing price, spread, price trend, and liquidity depth. Returns a score with detailed reasoning. Read-only analysis, does not place trades.

Inputs: condition_id (required).

analysis.price_historyA

Fetch historical OHLC price data for a market token over a configurable time window (1h to 1m). Returns price points with a sparkline visualization showing the price trend. Pro feature.

Inputs: token_id (required), interval.

analysis.qualityA

Evaluate market quality by checking bid/ask spread, order book depth, and price range. Returns a pass/fail with specific reasons. Use before placing trades to avoid illiquid or wide-spread markets. Pro feature.

Inputs: token_id (required), max_spread, min_depth.

config.dashboardA

Get a comprehensive dashboard showing daily budget usage, total P&L, recent trades, watchlist status, and monitor state. No parameters needed. Use this for a quick overview of your trading activity.

Inputs: no named parameters.

config.go_liveA

Switch from preview (simulated) to live trading mode where real orders are placed on Polymarket. Requires API credentials configured in environment. This action uses real money. Pro feature.

Inputs: confirm (required).

config.historyB

Retrieve past copy trades from the database with optional filters by trader address or status. Returns trade details including entry price, P&L, and market info. Pro feature.

Inputs: limit, trader, status.

config.log_cycleA

Record an AI agent's trading cycle metrics to the database for dashboard tracking and performance analysis. Stores PnL, win rate, positions, budget usage, and notes. Call this after each automated trading cycle.

Inputs: agent_name (required), strategy (required), status, positions_open, +8 more.

config.safety_limitsA

Configure trading safety guardrails: maximum order size in USDC, total exposure cap, and maximum spread tolerance. These limits are enforced on all subsequent buy/sell operations. Changes persist in the database.

Inputs: max_order_size, max_exposure, max_per_market, min_liquidity, +2 more.

config.setA

Update bot configuration at runtime. Supports daily_budget (max USDC per day) and min_conviction (minimum trade size to copy). Changes take effect immediately and persist across restarts. Pro feature.

Inputs: key (required), value (required).

markets.discoverA

Find active Polymarket prediction markets filtered by resolution deadline and category. Returns market question, price, volume, and end date. Use ending='today' for fast-resolving markets, or 'all' to browse everything.

Inputs: ending, category, min_volume, limit.

markets.eventsA

Browse Polymarket event groups to find all markets under a single event (e.g. 'US Election', 'UFC 300', 'NBA Finals'). Returns the event with all its sub-markets and their current prices.

Inputs: slug, query, limit.

markets.featuredA

List top Polymarket markets ranked by liquidity with optional category filter (politics, sports, crypto, pop-culture, business, science). Returns the most liquid and actively traded markets.

Inputs: category, limit.

markets.priceA

Get live bid/ask/spread prices from the CLOB order book for a specific market by condition_id. If no condition_id is given and show_positions is true, returns current prices for all open positions.

Inputs: condition_id, show_positions.

markets.relatedA

Find Polymarket markets related to a given condition_id or topic keyword. Useful for discovering correlated markets or building a diversified position across related events.

Inputs: condition_id, query, limit.

markets.searchA

Search Polymarket markets by keyword query. Returns matching markets with question, price, volume, and condition_id. Use the condition_id from results with buy, get_price, or analyze_opportunity.

Inputs: query (required), limit, active_only.

markets.trendingA

List trending Polymarket markets ranked by trading volume over a configurable period (24h, 7d, or 30d). Filter by category to focus on specific topics. Returns market question, price, and volume.

Inputs: period, category, limit.

markets.watchA

Manage your market watchlist: add, remove, or list watched markets with optional price alert thresholds. When a market crosses your alert price, it shows up in check_exits.

Inputs: action, condition_id, title, alert_below, +1 more.

markets.watch_priceA

Manage live WebSocket price subscriptions for real-time market updates. Subscribe to a token_id to start streaming price changes, unsubscribe to stop, or check connection status.

Inputs: action, token_id.

monitor.startA

Start a background loop that polls watched wallets for new trades and automatically copies them. Runs continuously at the specified interval until stop_monitor is called. Requires at least one wallet on the watchlist. Pro feature.

Inputs: interval_seconds.

monitor.stopA

Stop the background wallet monitoring loop started by monitor.start. Call this to end a copy-trading session, before changing bot configuration via config.set or config.safety_limits, or when switching between preview and live modes via config.go_live. Does NOT close open positions — use positions.close or positions.set_exit_rules separately to unwind trades. Idempotent: safe to call when the monitor is not running. Returns a short confirmation string. No parameters. Pro feature.

Inputs: no named parameters.

orders.batchA

Execute multiple buy/sell orders in a single call (max 10 orders). Each order specifies a condition_id, amount, optional price, and side. Returns per-order results with success/failure status.

Inputs: orders (required).

orders.buyA

Buy outcome shares on a Polymarket market. Specify condition_id, USDC amount, and optionally a limit price. Runs a market quality check before executing. In preview mode, simulates the trade. In live mode, places a real CLOB order.

Inputs: condition_id (required), amount (required), price, outcome.

orders.cancelA

Cancel ALL open/pending limit orders on Polymarket for this account in a single call. Use as an emergency stop, before changing strategy, after a sudden price move, or when unwinding positions. Not reversible — cancelled orders must be re-placed via orders.buy, wta.bid, or orders.batch. Returns the count of cancelled orders. Call orders.list first if you want to preview what will be cancelled. Only works in live mode (no-op in preview). No parameters. Pro feature.

Inputs: no named parameters.

orders.listA

List all open (pending/unfilled) limit orders currently resting on Polymarket's order book for this account. Use after placing limit orders via orders.buy or wta.bid to confirm acceptance, or before orders.cancel to preview what will be removed. Returns each order's ID, market question, side (BUY/SELL), size, limit price, and age. For deeper detail on a single order, call orders.status with its order_id. Only works in live mode (returns an empty list in preview). No parameters. Pro feature.

Inputs: no named parameters.

orders.sellA

Sell an open position by trade_id (from get_positions) or condition_id. In live mode, places a sell order on Polymarket. In preview mode, marks the position as sold in the database and calculates realized P&L.

Inputs: trade_id, condition_id, price.

orders.statusA

Check the live state of a specific Polymarket limit order by its order_id. Use after orders.buy, orders.batch, or wta.bid to track fill progress, or to verify that an orders.cancel call succeeded. Returns the order status (OPEN, FILLED, CANCELLED, or EXPIRED), filled amount, remaining size, current limit price, and the market it was placed on. Obtain the order_id from the response of the placing tool or from orders.list. Only works in live mode.

Inputs: order_id (required).

portfolio.balanceA

View account balance summary: daily budget remaining, total invested, realized and unrealized P&L. No parameters needed. Use this to check how much budget is left before placing new trades.

Inputs: no named parameters.

portfolio.getA

Get a comprehensive portfolio overview of all open copy-trading positions, grouped by the source trader they were copied from, with per-wallet subtotals, individual market names/entry prices/sizes, active stop-loss/take-profit rules, and an aggregate total P&L. Use as a daily status check, before sizing decisions via config.set, or to identify which source wallet is carrying the portfolio. Returns a grouped markdown table. Call portfolio.balance for budget-focused numbers or portfolio.risk for concentration metrics. No parameters.

Inputs: no named parameters.

portfolio.optimizeA

Analyze your open positions and generate optimization recommendations based on your chosen strategy (conservative, balanced, or aggressive). Returns SL/TP suggestions, concentration warnings, and cut/hold/take-profit actions for each position.

Inputs: strategy.

portfolio.riskA

Assess portfolio risk across 4 dimensions: position concentration, market diversification, stop-loss/take-profit coverage, and daily budget utilization. Returns a risk score with specific warnings. No parameters needed.

Inputs: no named parameters.

positions.check_exitsA

Scan all open positions for exit conditions: market resolution, stop-loss/take-profit triggers, or the original trader exiting. Updates P&L and closes positions that meet exit criteria. No parameters needed.

Inputs: no named parameters.

positions.closeA

Manually close a copy trading position by trade ID. In live mode, places a sell order on Polymarket. In preview mode, marks the position as closed in the database. Use get_positions to find the trade_id. Pro feature.

Inputs: trade_id (required), reason.

positions.listA

View your own copy trading positions filtered by status (open, closed, or all). Returns market name, entry price, current price, P&L, and exit rules for each position.

Inputs: status.

positions.set_exit_rulesA

Set stop-loss and/or take-profit price levels on an open position. When the market price crosses these levels, check_exits will automatically close the position. Use get_positions to find trade IDs. Pro feature.

Inputs: trade_id (required), stop_loss, take_profit.

traders.analyzeA

Analyze a Polymarket trader by wallet address. Returns profile stats, active positions, win rate, volume, PnL, and recent trade activity. Use before adding a trader to your watchlist to assess their quality.

Inputs: address (required).

traders.backtestA

Simulate copying a trader's historical trades to calculate hypothetical P&L. Shows what you would have earned if you had copy-traded this wallet. Use before adding a trader to your watchlist to validate their performance. Pro feature.

Inputs: address (required), copy_budget.

traders.discoverA

Fetch top traders from the Polymarket leaderboard ranked by PnL, volume, and ROI. Use this to find profitable traders worth copying. Returns trader address, PnL, volume, and win rate. Use auto_watch to add them to your watchlist directly.

Inputs: pages, period, min_volume, min_pnl, +1 more.

traders.positionsA

View another trader's current open positions on Polymarket by their wallet address. Shows market name, outcome, size, and current price. Useful for due diligence before copy trading. Pro feature.

Inputs: address (required), limit.

traders.scoreA

Calculate a conviction score (0-100) for a trader across 5 dimensions: win rate, volume, consistency, experience, and diversity. Higher scores indicate more reliable traders for copy trading. Pro feature.

Inputs: address (required).

watchlist.addA

Add or remove an Ethereum wallet address from the copy trading watchlist. Watched wallets are monitored for new trades when the monitor is running. Use discover_traders first to find good wallets to watch.

Inputs: address (required), alias, action.

watchlist.listA

Show every wallet address currently on the copy-trading watchlist, with its alias, date added, and active/paused status. Use to review who is being copied before calling monitor.start, after watchlist.rebalance to confirm removals, or to pick a target for traders.analyze, traders.positions, or traders.score. Returns a markdown table of watched wallets. Call watchlist.add to manage entries, or traders.discover to find new wallets to watch. No parameters.

Inputs: no named parameters.

watchlist.rebalanceA

Analyze all traders on your watchlist and remove underperformers whose conviction score or win rate falls below your threshold. Use to keep your watchlist focused on high-quality traders. Pro feature.

Inputs: min_score, min_win_rate, dry_run.

wta.bidA

Place limit orders (stink bids) at a discount on WTA tennis match favorites. Orders sit in the order book until filled at your target price. In preview mode, simulates the orders. In live mode, places real CLOB orders. Pro feature.

Inputs: discount_pct, bet_size.

wta.discoverA

Find today's WTA tennis match markets on Polymarket where the favorite is available at a discount. Returns matches with current price vs fair price and the discount percentage. Use place_stink_bid to act on these opportunities. Pro feature.

Inputs: discount_pct.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 48 tools

    Disambiguation4/5

    Tools are grouped by domain (analysis, markets, orders, etc.) and each has a clearly described purpose. However, some market discovery tools (search, discover, featured, trending) have overlapping functionality that could confuse an agent, though parameters help differentiate.

    Naming Consistency5/5

    All tools follow a consistent 'category.tool_name' pattern with lowercase and underscores. The naming is uniform and predictable, making it easy for an agent to infer usage.

    Tool Count3/5

    48 tools is high, but the server aims to cover a comprehensive trading platform including analysis, market data, order execution, portfolio management, and copy trading. While each tool earns its place, the sheer number could be overwhelming for agents.

    Completeness5/5

    The tool set covers the full lifecycle of trading on Polymarket: market discovery, price analysis, trading (buy/sell/batch), portfolio management, risk analysis, copy trading setup, and monitoring. No obvious gaps are present for the intended domain.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables interaction with the PolyMarket API to fetch prediction market data such as market information, prices, and historical data, with robust error handling and rate limit management.
      4
      144
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables Claude to autonomously trade, analyze, and manage positions on Polymarket prediction markets with 45 comprehensive tools including market discovery, real-time monitoring, portfolio management, and AI-powered trading recommendations with enterprise-grade safety features.
      25
      745
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude to autonomously trade, analyze, and manage positions on Polymarket prediction markets with 45 comprehensive tools covering market discovery, analysis, trading execution, portfolio management, and real-time monitoring with enterprise-grade safety features.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Prediction market probability oracle for AI agents. 26 tools across 500+ live markets from Kalshi and Polymarket. Cross-source arbitrage detection, structured TPF signals, Kelly Criterion sizing, agent performance tracking, and webhook alerts.
      9
      86 npm
      1
      MIT