io.github.demwick/polymarket-agent-mcp

Registre officiel Finance et paiements

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

Que pouvez-vous faire avec io.github.demwick/polymarket-agent-mcp ?

  • 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

Installation

Ajoutez ceci à la configuration MCP de votre client (Claude Desktop : claude_desktop_config.json ; Cursor : .cursor/mcp.json ; VS Code et les autres utilisent la même forme « mcpServers »).

NPM package polymarket-agent-mcp
Claude Code
claude mcp add polymarket-agent-mcp -e 'COPY_MODE=preview' -e 'POLY_PRIVATE_KEY=<your poly_private_key>' -e 'POLY_API_KEY=<your poly_api_key>' -e 'POLY_API_SECRET=<your poly_api_secret>' -e 'POLY_API_PASSPHRASE=<your poly_api_passphrase>' -e 'POLY_FUNDER_ADDRESS=<POLY_FUNDER_ADDRESS>' -e 'DAILY_BUDGET=20' -e 'MIN_CONVICTION=3' -e 'CHAIN_ID=137' -e 'DB_PATH=<DB_PATH>' -- npx -y polymarket-agent-mcp@1.7.0
Configuration JSON (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "polymarket-agent-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "polymarket-agent-mcp@1.7.0"
            ],
            "env": {
                "COPY_MODE": "preview",
                "POLY_PRIVATE_KEY": "<your poly_private_key>",
                "POLY_API_KEY": "<your poly_api_key>",
                "POLY_API_SECRET": "<your poly_api_secret>",
                "POLY_API_PASSPHRASE": "<your poly_api_passphrase>",
                "POLY_FUNDER_ADDRESS": "<POLY_FUNDER_ADDRESS>",
                "DAILY_BUDGET": "20",
                "MIN_CONVICTION": "3",
                "CHAIN_ID": "137",
                "DB_PATH": "<DB_PATH>"
            }
        }
    }
}

Variables d'environnement

  • COPY_MODE 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.
  • POLY_PRIVATE_KEY secret Polygon wallet private key used to sign CLOB orders. Required only when COPY_MODE=live. Never logged, persisted, or transmitted outside signed order bodies.
  • POLY_API_KEY secret Polymarket CLOB API key. Required only when COPY_MODE=live.
  • POLY_API_SECRET secret Polymarket CLOB API secret. Required only when COPY_MODE=live.
  • POLY_API_PASSPHRASE secret Polymarket CLOB API passphrase. Required only when COPY_MODE=live.
  • POLY_FUNDER_ADDRESS Polymarket funder wallet address (proxy wallet) used for live trading.
  • DAILY_BUDGET Maximum USDC the agent may spend per day. Used by BudgetManager to cap copy-trading exposure.
  • MIN_CONVICTION Minimum conviction score (0–100) required before a copy trade is executed.
  • CHAIN_ID EVM chain ID for Polymarket (137 = Polygon mainnet).
  • DB_PATH Optional override for the SQLite database path. Defaults to a package-local file.

Documentation

Tirée du README du projet sur GitHub, actualisée chaque semaine. Les liens ouvrent GitHub.

Sommaire
  1. Polymarket Agent MCP Server
  2. Tool Overview
  3. Quick Start
  4. Usage Examples
  5. All 48 Tools
  6. Architecture
  7. HTTP Transport & Deployment
  8. Configuration
  9. Safety Features
  10. Permissions & Capabilities
  11. Development
  12. License

Polymarket Agent MCP Server

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
markets.searchSearch markets by keyword (bitcoin, election, UFC...)
traders.discoverFind top traders by PnL and volume
markets.discoverFind markets by end date and category
markets.trendingTop markets by 24h/7d/30d volume
markets.featuredMost liquid markets by category (politics, sports, crypto...)
wta.discoverWTA tennis markets with stink bid prices
flow.discoverSmart money signals — multiple top traders buying same market
markets.relatedFind markets related to a topic or market
markets.eventsBrowse all markets under an event
Analysis
ToolDescription
markets.analyzeAI-powered BUY/SELL/HOLD recommendation
traders.analyzeDetailed trader profile, win rate, P&L
traders.scoreConviction score (0-100) across 5 dimensions
markets.checkMarket quality — spread, depth, price range
markets.priceLive bid/ask/spread prices
markets.price_historyHistorical prices with sparkline (1h to 1m)
markets.holdersBiggest position holders in a market
markets.compareSide-by-side comparison of 2-5 markets
Trading
ToolDescription
orders.buyBuy shares on any market
orders.sellSell an open position
orders.batchExecute up to 10 orders at once
wta.bidPlace limit orders at discount
orders.cancelCancel all open orders
orders.listView pending limit orders
orders.statusCheck status of a specific order
config.go_liveSwitch from preview to live mode
Copy Trading
ToolDescription
watchlist.addAdd/remove traders from watchlist
monitor.startStart automatic copy trading loop
monitor.stopStop monitoring
watchlist.rebalanceRemove underperforming traders
traders.backtestSimulate copying a trader's past trades
Portfolio & Risk
ToolDescription
portfolio.balanceAccount balance, budget, and P&L
portfolio.getMulti-wallet overview with P&L per trader
positions.listOpen/closed positions
positions.closeManually close a position
positions.set_exit_rulesSet stop-loss and take-profit levels
positions.check_exitsCheck positions for resolution
portfolio.riskPortfolio risk scoring and warnings
portfolio.optimizeAI-powered optimization (conservative/balanced/aggressive)
markets.watchMarket watchlist with price alerts
markets.watch_priceLive WebSocket price subscriptions
markets.arbitrageFind YES+NO price discrepancies
Configuration
ToolDescription
config.setUpdate bot settings
config.safety_limitsMax order size, exposure cap, spread tolerance
dashboard.getTerminal-formatted dashboard
trades.historyTrade history with filters
watchlist.listShow watched wallets
agent.log_cycleLog agent cycle for dashboard
traders.positionsView 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:

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

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.

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)
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

Questions fréquentes

Qu'est-ce que io.github.demwick/polymarket-agent-mcp ?

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

Comment installer io.github.demwick/polymarket-agent-mcp ?

Il s'exécute sur votre machine. Dans Claude Code : claude mcp add polymarket-agent-mcp -e 'COPY_MODE=preview' -e 'POLY_PRIVATE_KEY=<your poly_private_key>' -e 'POLY_API_KEY=<your poly_api_key>' -e 'POLY_API_SECRET=<your poly_api_secret>' -e 'POLY_API_PASSPHRASE=<your poly_api_passphrase>' -e 'POLY_FUNDER_ADDRESS=<POLY_FUNDER_ADDRESS>' -e 'DAILY_BUDGET=20' -e 'MIN_CONVICTION=3' -e 'CHAIN_ID=137' -e 'DB_PATH=<DB_PATH>' -- npx -y polymarket-agent-mcp@1.7.0. Pour les autres clients, collez la configuration JSON de cette page dans leurs réglages MCP.

Faut-il une clé API pour io.github.demwick/polymarket-agent-mcp ?

Oui. Il attend POLY_PRIVATE_KEY, POLY_API_KEY, POLY_API_SECRET, POLY_API_PASSPHRASE, à renseigner dans sa configuration.

io.github.demwick/polymarket-agent-mcp est-il open source ?

Oui. Son code est sur GitHub sous licence MIT.

Qui maintient io.github.demwick/polymarket-agent-mcp ?

Il est publié par demwick. AI.tn le référence sans le maintenir ni le recommander.

Issu du registre MCP officiel. Être listé n'est pas une recommandation : vérifiez le code et les permissions d'un serveur avant de lui donner accès à vos données.