Back to Browse

Polymarket Agent MCP Server

Developer ToolsLow Risk10.0LocalNew
Free

Polymarket trading, market discovery, copy trading and backtesting — 48 MCP tools.

About

Polymarket trading, market discovery, copy trading and backtesting — 48 MCP tools.

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (2 strong, 3 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry.

3 files analyzed · 1 issue found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

file_system

Check that this permission is expected for this type of plugin.

env_vars

Check that this permission is expected for this type of plugin.

network_websocket

Check that this permission is expected for this type of plugin.

database

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Execution mode: 'preview' simulates trades in a local SQLite DB (default, safe for inspection); 'live' places real orders on Polymarket and requires all POLY_* credentials.Optional

Environment variable: COPY_MODE

Polygon wallet private key used to sign CLOB orders. Required only when COPY_MODE=live. Never logged, persisted, or transmitted outside signed order bodies.Required

Environment variable: POLY_PRIVATE_KEY

Polymarket CLOB API key. Required only when COPY_MODE=live.Required

Environment variable: POLY_API_KEY

Polymarket CLOB API secret. Required only when COPY_MODE=live.Required

Environment variable: POLY_API_SECRET

Polymarket CLOB API passphrase. Required only when COPY_MODE=live.Required

Environment variable: POLY_API_PASSPHRASE

Polymarket funder wallet address (proxy wallet) used for live trading.Optional

Environment variable: POLY_FUNDER_ADDRESS

Maximum USDC the agent may spend per day. Used by BudgetManager to cap copy-trading exposure.Optional

Environment variable: DAILY_BUDGET

Minimum conviction score (0–100) required before a copy trade is executed.Optional

Environment variable: MIN_CONVICTION

EVM chain ID for Polymarket (137 = Polygon mainnet).Optional

Environment variable: CHAIN_ID

Optional override for the SQLite database path. Defaults to a package-local file.Optional

Environment variable: DB_PATH

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "io-github-demwick-polymarket-agent-mcp": {
      "env": {
        "DB_PATH": "your-db-path-here",
        "CHAIN_ID": "your-chain-id-here",
        "COPY_MODE": "your-copy-mode-here",
        "DAILY_BUDGET": "your-daily-budget-here",
        "POLY_API_KEY": "your-poly-api-key-here",
        "MIN_CONVICTION": "your-min-conviction-here",
        "POLY_API_SECRET": "your-poly-api-secret-here",
        "POLY_PRIVATE_KEY": "your-poly-private-key-here",
        "POLY_API_PASSPHRASE": "your-poly-api-passphrase-here",
        "POLY_FUNDER_ADDRESS": "your-poly-funder-address-here"
      },
      "args": [
        "-y",
        "polymarket-agent-mcp"
      ],
      "command": "npx"
    }
  }
}

Documentation

View on GitHub

From the project's GitHub README.

Polymarket Agent MCP Server

polymarket-agent-mcp MCP server

npm version CI GitHub last commit License: MIT Node.js TypeScript MCP Protocol 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

CategoryCountHighlights
Discovery9Search, trending, featured, events, related markets, smart money flow
Analysis8AI opportunity scoring, conviction rating, price history, market quality, top holders, comparison
Trading8Buy, sell, batch orders, limit orders, order management, safety limits
Copy Trading5Watch traders, auto-monitor, auto-rebalance, backtest
Portfolio10Positions, P&L, balance, risk assessment, SL/TP, optimization, market alerts
Utilities8Dashboard, config, trade history, watchlists, agent logging

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

ToolDescription
search_marketsSearch markets by keyword (bitcoin, election, UFC...)
discover_tradersFind top traders by PnL and volume
discover_marketsFind markets by end date and category
trending_marketsTop markets by 24h/7d/30d volume
featured_marketsMost liquid markets by category (politics, sports, crypto...)
discover_wtaWTA tennis markets with stink bid prices
discover_flowSmart money signals — multiple top traders buying same market
find_relatedFind markets related to a topic or market
get_market_eventsBrowse all markets under an event

Analysis

ToolDescription
analyze_opportunityAI-powered BUY/SELL/HOLD recommendation
analyze_traderDetailed trader profile, win rate, P&L
score_traderConviction score (0-100) across 5 dimensions
check_marketMarket quality — spread, depth, price range
get_priceLive bid/ask/spread prices
get_price_historyHistorical prices with sparkline (1h to 1m)
get_top_holdersBiggest position holders in a market
compare_marketsSide-by-side comparison of 2-5 markets

Trading

ToolDescription
buyBuy shares on any market
sellSell an open position
batch_orderExecute up to 10 orders at once
place_stink_bidPlace limit orders at discount
cancel_ordersCancel all open orders
get_open_ordersView pending limit orders
get_order_statusCheck status of a specific order
go_liveSwitch from preview to live mode

Copy Trading

ToolDescription
watch_walletAdd/remove traders from watchlist
start_monitorStart automatic copy trading loop
stop_monitorStop monitoring
rebalanceRemove underperforming traders
backtest_traderSimulate copying a trader's past trades

Portfolio & Risk

ToolDescription
get_balanceAccount balance, budget, and P&L
get_portfolioMulti-wallet overview with P&L per trader
get_positionsOpen/closed positions
close_positionManually close a position
set_exit_rulesSet stop-loss and take-profit levels
check_exitsCheck positions for resolution
assess_riskPortfolio risk scoring and warnings
optimize_portfolioAI-powered optimization (conservative/balanced/aggressive)
watch_marketMarket watchlist with price alerts
detect_arbitrageFind YES+NO price discrepancies

Configuration

ToolDescription
set_configUpdate bot settings
set_safety_limitsMax order size, exposure cap, spread tolerance
get_dashboardTerminal-formatted dashboard
get_trade_historyTrade history with filters
list_watchlistShow watched wallets
log_cycleLog agent cycle for dashboard
get_trader_positionsView a trader's open positions
discover_wtaWTA tennis market discovery

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:

ModeActivationUse case
stdio (default)npx polymarket-agent-mcpClaude Code, Cursor, local MCP clients
HTTP--http flag or PORT env varSelf-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

PathMethodDescription
/mcpPOSTMCP protocol endpoint (Streamable HTTP transport)
/healthGETHealth check — returns { status, version, db }
/.well-known/mcp/server-card.jsonGETMCP discovery card (tools, permissions, data handling)
/GETServer 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

The included Dockerfile builds a multi-stage production image that runs in HTTP mode:

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.

VariableRequiredDefaultDescription
COPY_MODENopreviewpreview (simulated) or live (real orders)
DAILY_BUDGETNo20Max daily spend in USDC
MIN_CONVICTIONNo3Min trade size to copy ($)
Wallet signing keyLive only-Locally signs CLOB order payloads, never persisted (see PERMISSIONS.md for exact env var name)
CLOB API credentialsLive 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.

CategoryScope
Network (outbound)3 Polymarket HTTPS APIs + 1 inbound-only WSS public price stream (ws-subscriptions-clob.polymarket.com) + optional license check (mcp-marketplace.io)
FilesystemSingle SQLite database file + .env read at startup — nothing else
EnvironmentAPI credentials (live mode only, in memory only), budget config, mode selection
ProcessesNone — no child processes, no shell commands, no eval/Function
TelemetryNone — 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

Reviews

No reviews yet

Be the first to review this server!