Logotipo de Polymarket MCP Server

Polymarket MCP Server

Comunidad
caiovicentino

🤖 AI-Powered MCP Server for Polymarket - Enable Claude to trade prediction markets with 45 tools, real-time monitoring, and enterprise-grade safety features

Editorcaiovicentino
Repositoriopolymarket-mcp-server
IdiomaPython
Forks
140
Estrellas
674
Herramientas disponibles
0
Tipo de transportestdio
Categorías
LicenciaMIT
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    Polymarket MCP Server ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    674 estrellas y 140 forks en el repositorio enlazado.

🤖 Polymarket MCP Server

Python 3.10+ License: MIT MCP Protocol Tests AgentSeal MCP

Complete AI-Powered Trading Platform for Polymarket Prediction Markets

Enable Claude to autonomously trade, analyze, and manage positions on Polymarket with 45 comprehensive tools, real-time WebSocket monitoring, and enterprise-grade safety features.


👨‍💻 Created By

Caio Vicentino

Developed in collaboration with:

Powered by Claude Code from Anthropic


⭐ Key Features

🎯 45 Comprehensive Tools Across 5 Categories

🔍 Market Discovery (8 tools)

  • Search and filter markets by keywords, categories, events
  • Trending markets by volume (24h, 7d, 30d)
  • Category-specific markets (Politics, Sports, Crypto)
  • Markets closing soon alerts
  • Featured and promoted markets
  • Sports markets (NBA, NFL, etc.)
  • Crypto prediction markets

📊 Market Analysis (10 tools)

  • Real-time prices and spreads
  • Complete orderbook depth analysis
  • Liquidity and volume metrics
  • Historical price data
  • AI-powered opportunity analysis with BUY/SELL/HOLD recommendations
  • Multi-market comparison
  • Top holders analysis
  • Risk assessment and scoring
  • Spread calculation and monitoring

💼 Trading (12 tools)

  • Limit orders (GTC, GTD, FOK, FAK)
  • Market orders (immediate execution)
  • Batch order submission
  • AI-suggested pricing (aggressive/passive/mid strategies)
  • Order status tracking and history
  • Open orders management
  • Single and bulk order cancellation
  • Smart trade execution (natural language → automated strategy)
  • Position rebalancing with slippage protection
  • Order book integration

📈 Portfolio Management (8 tools)

  • Real-time position tracking
  • P&L calculation (realized/unrealized)
  • Portfolio value aggregation
  • Risk analysis (concentration, liquidity, diversification)
  • Trade history with filters
  • On-chain activity log
  • Performance metrics
  • AI-powered portfolio optimization (conservative/balanced/aggressive)

⚡ Real-time Monitoring (7 tools)

  • Live price updates via WebSocket
  • Orderbook depth streaming
  • User order status notifications
  • Trade execution alerts
  • Market resolution notifications
  • Subscription management
  • System health monitoring
  • Auto-reconnect with exponential backoff

🛡️ Enterprise-Grade Safety & Risk Management

  • ✅ Order Size Limits - Configurable maximum per order
  • ✅ Exposure Caps - Total portfolio exposure limits
  • ✅ Position Limits - Per-market position caps
  • ✅ Liquidity Validation - Minimum liquidity requirements
  • ✅ Spread Tolerance - Maximum spread checks before execution
  • ✅ Confirmation Flow - User confirmation for large orders
  • ✅ Pre-trade Validation - Comprehensive safety checks

⚙️ Production-Ready Infrastructure

  • ✅ L1 & L2 Authentication - Wallet (private key) + API key auth
  • ✅ Advanced Rate Limiting - Token bucket algorithm respecting all Polymarket API limits
  • ✅ EIP-712 Signing - Secure order signatures
  • ✅ Auto-reconnect WebSockets - Resilient real-time connections
  • ✅ Comprehensive Error Handling - User-friendly error messages
  • ✅ No Mocks - Real Polymarket API integration throughout
  • ✅ Full Test Coverage - Production-grade testing with real APIs

🌐 Web Dashboard

NEW: Manage and monitor your Polymarket MCP Server with a modern web interface!

bash
# Start the web dashboard
polymarket-web

# Or use the quick start script
./start_web_dashboard.sh

Access at: http://localhost:8080

Dashboard Features

  • Real-time Monitoring: Live MCP status, WebSocket connection, and statistics
  • Configuration Management: Visual sliders for safety limits and trading controls
  • Market Discovery: Search, filter, and browse markets with live updates
  • Market Analysis: AI-powered analysis with recommendations and risk assessment
  • System Monitoring: Performance charts, rate limits, and activity logs
  • Dark Theme: Professional UI optimized for extended use

See WEB_DASHBOARD.md for complete documentation.


🚀 Quick Start

One-Command Installation (Recommended)

Try DEMO mode first (no wallet needed):

bash
# macOS/Linux
curl -sSL https://raw.githubusercontent.com/caiovicentino/polymarket-mcp-server/main/quickstart.sh | bash

# Or clone and run locally
git clone https://github.com/caiovicentino/polymarket-mcp-server.git
cd polymarket-mcp-server
./quickstart.sh

Full installation (with trading):

bash
# macOS/Linux
./install.sh

# Windows
install.bat

The automated installer will:

  • ✓ Check Python version (3.10+)
  • ✓ Create virtual environment
  • ✓ Install all dependencies
  • ✓ Configure environment
  • ✓ Set up Claude Desktop integration
  • ✓ Test the installation

Installation Options

MethodCommandBest For
Quick Start./quickstart.shFirst-time users, testing
DEMO Mode./install.sh --demoNo wallet, read-only access
Full Install./install.shProduction trading setup
Windowsinstall.batWindows users

DEMO Mode vs Full Mode

DEMO Mode (No wallet required):

  • ✅ Market discovery and search
  • ✅ Real-time market analysis
  • ✅ AI-powered insights
  • ✅ Price monitoring
  • ❌ Trading disabled (read-only)

Full Mode (Requires Polygon wallet):

  • ✅ Everything in DEMO mode
  • ✅ Place orders and execute trades
  • ✅ Portfolio management
  • ✅ Position tracking
  • ✅ Real-time trade notifications

Manual Installation

If you prefer manual setup:

bash
# Clone the repository
git clone https://github.com/caiovicentino/polymarket-mcp-server.git
cd polymarket-mcp-server

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install the package
pip install -e .

Configuration

Option 1: DEMO Mode (easiest)

bash
cp .env.example .env
# Edit .env and set:
DEMO_MODE=true

Option 2: Full Trading Mode

bash
cp .env.example .env
# Edit with your Polygon wallet credentials
nano .env

Required credentials (Full Mode):

env
POLYGON_PRIVATE_KEY=your_private_key_without_0x_prefix
POLYGON_ADDRESS=0xYourPolygonAddress

Recommended Safety Limits:

env
MAX_ORDER_SIZE_USD=1000
MAX_TOTAL_EXPOSURE_USD=5000
MAX_POSITION_SIZE_PER_MARKET=2000
MIN_LIQUIDITY_REQUIRED=10000
MAX_SPREAD_TOLERANCE=0.05
ENABLE_AUTONOMOUS_TRADING=false
REQUIRE_CONFIRMATION_ABOVE_USD=500

With ENABLE_AUTONOMOUS_TRADING=false (the default), every order is held and returned as confirmation_required until you re-issue it with confirm=true. Set it to true to let orders under REQUIRE_CONFIRMATION_ABOVE_USD go through without that step.

Claude Desktop Integration

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

json
{
  "mcpServers": {
    "polymarket": {
      "command": "/path/to/your/venv/bin/python",
      "args": ["-m", "polymarket_mcp.server"],
      "cwd": "/path/to/polymarket-mcp-server",
      "env": {
        "POLYGON_PRIVATE_KEY": "your_private_key",
        "POLYGON_ADDRESS": "0xYourAddress"
      }
    }
  }
}

Restart Claude Desktop and you're ready to trade! 🎉


📖 Documentation

Getting Started

Developer Resources

Examples & Guides

System Architecture

┌─────────────────────────────────────────────────────────────┐
│                    POLYMARKET MCP SERVER                    │
└─────────────────────────────────────────────────────────────┘

    ┌──────────────┐
    │   Claude     │
    │   Desktop    │ (Natural language interface)
    └──────┬───────┘
           │ MCP Protocol
           ▼
    ┌──────────────────────────────────────────────┐
    │           MCP Server (Python)                │
    ├──────────────────────────────────────────────┤
    │  ┌────────────┐  ┌──────────────────────┐   │
    │  │  Market    │  │  Trading             │   │
    │  │  Discovery │  │  Engine              │   │
    │  │  (8 tools) │  │  (12 tools)          │   │
    │  └────────────┘  └──────────────────────┘   │
    │                                              │
    │  ┌────────────┐  ┌──────────────────────┐   │
    │  │  Market    │  │  Portfolio           │   │
    │  │  Analysis  │  │  Manager             │   │
    │  │  (10 tools)│  │  (8 tools)           │   │
    │  └────────────┘  └──────────────────────┘   │
    │                                              │
    │  ┌──────────────────────────────────────┐   │
    │  │  Real-time WebSocket (7 tools)       │   │
    │  └──────────────────────────────────────┘   │
    └──────────────┬───────────────────────────────┘
                   │
                   ▼
    ┌──────────────────────────────────────────────┐
    │         Polymarket Infrastructure            │
    ├──────────────────────────────────────────────┤
    │  • CLOB API (Order placement & management)   │
    │  • Gamma API (Market data & analytics)       │
    │  • WebSocket (Real-time price feeds)         │
    │  • Polygon Chain (Settlement & execution)    │
    └──────────────────────────────────────────────┘

💡 Usage Examples

Market Discovery

Ask Claude:

"Show me the top 10 trending markets on Polymarket in the last 24 hours"
"Find all crypto markets about Bitcoin"
"What sports markets are closing in the next 12 hours?"
"Search for markets about Trump"

Market Analysis

"Analyze the trading opportunity for the government shutdown market"
"Compare these three markets and tell me which has the best risk/reward"
"What's the current spread on the Eagles vs Packers market?"
"Show me the orderbook depth for token ID xyz"

Autonomous Trading

"Buy $100 of YES tokens in [market_id] at $0.65"
"Place a limit order: sell 200 NO at $0.40 in [market]"
"Execute a smart trade: buy YES up to $500 in [market] using best strategy"
"Cancel all my open orders in the government shutdown market"
"Rebalance my position in [market] to $1000 with max 2% slippage"

Portfolio Management

"Show me all my current positions"
"What's my total portfolio value?"
"Analyze my portfolio risk and suggest improvements"
"What's my P&L for the last 30 days?"
"Which are my best and worst performing markets?"
"Suggest portfolio optimizations for a conservative strategy"

Real-time Monitoring

"Subscribe to price changes for the government shutdown markets"
"Monitor my order status in real-time"
"Alert me when the Eagles vs Packers market moves more than 10%"
"Show me real-time orderbook updates for [token_id]"

🧪 Testing

bash
# Install dev dependencies
pip install -e ".[dev]"

# Run all tests
pytest

# Run specific test suite
pytest tests/test_trading_tools.py -v

# Run with coverage
pytest --cov=polymarket_mcp --cov-report=html

# Run market analysis demo
python demo_mcp_tools.py

Note: All tests use real Polymarket APIs - NO MOCKS!


🛡️ Safety & Security

⚠️ Important Security Considerations

  • Private Key Protection: Never share or commit your private key
  • Start Small: Begin with small amounts ($50-100) to test
  • Understand Markets: Only trade in markets you understand
  • Monitor Positions: Check your positions regularly
  • Use Safety Limits: Configure appropriate limits for your risk tolerance
  • Never Risk More: Than you can afford to lose

Default Safety Limits

env
MAX_ORDER_SIZE_USD=1000              # Maximum $1,000 per order
MAX_TOTAL_EXPOSURE_USD=5000          # Maximum $5,000 total exposure
MAX_POSITION_SIZE_PER_MARKET=2000    # Maximum $2,000 per market
MIN_LIQUIDITY_REQUIRED=10000         # Minimum $10,000 market liquidity
MAX_SPREAD_TOLERANCE=0.05            # Maximum 5% spread
ENABLE_AUTONOMOUS_TRADING=false      # Every order needs confirm=true
REQUIRE_CONFIRMATION_ABOVE_USD=500   # When autonomous: confirm orders over $500

These can be customized in your .env file or Claude Desktop config.

Choosing the Outcome

Order tools take an outcome argument ("Yes", "No", or a label like "Lakers"). On a Yes/No market it defaults to Yes. Sports and multi-outcome markets have no Yes/No side, so the outcome must be given explicitly — the tool refuses the order and lists the available outcomes rather than guessing a side.


🤝 Contributing

Contributions are welcome! We appreciate your help making this project better.

Please read CONTRIBUTING.md for details on:

  • How to report bugs
  • How to suggest features
  • Code standards and guidelines
  • Pull request process

Quick Contribution Guide

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📊 Project Stats

  • Lines of Code: ~10,000+ (Python)
  • Tools: 45 comprehensive tools
  • Test Coverage: High (real API integration)
  • Documentation: Comprehensive (multiple guides)
  • Dependencies: Modern Python packages (MCP, httpx, websockets, eth-account)

🌐 Community

Join Our Communities

Featured In

  • Awesome Agent Trading - Curated directory of AI trading agents, MCP servers, and prediction market tools

Get Support


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments

This project was made possible by:

  • Caio Vicentino - Creator and lead developer
  • Yield Hacker Community - DeFi expertise and testing
  • Renda Cripto Community - Trading insights and validation
  • Cultura Builder Community - Builder culture and support
  • Polymarket - Amazing prediction market platform
  • Anthropic - Claude and the MCP protocol
  • py-clob-client - Official Polymarket SDK

Special thanks to all contributors and community members who have helped improve this project!


⚠️ Disclaimer

This software is provided for educational and research purposes. Trading prediction markets involves financial risk.

Important Reminders:

  • Cryptocurrency trading carries significant risk
  • Only invest what you can afford to lose
  • Past performance does not guarantee future results
  • This is not financial advice
  • Always do your own research (DYOR)
  • Start with small amounts to learn the system
  • Understand the markets you're trading
  • Monitor your positions regularly

The authors and contributors are not responsible for any financial losses incurred through the use of this software.


🔗 Links


📈 Roadmap

Current Version (v0.1.0)

  • ✅ 45 comprehensive tools
  • ✅ Real-time WebSocket monitoring
  • ✅ Safety limits and risk management
  • ✅ Complete test suite
  • ✅ Comprehensive documentation

Planned Features

  • CI/CD pipeline (GitHub Actions)
  • Enhanced AI analysis tools
  • Portfolio strategy templates
  • Market alerts and notifications
  • Performance analytics dashboard
  • Multi-wallet support
  • Advanced order types
  • Historical backtesting

🌟 Contributors

Thanks to everyone who has contributed to this project!

Contributors


Built with ❤️ for autonomous AI trading on Polymarket

Ready to make Claude your personal prediction market trader! 🚀

⭐ Star this repo | 🐛 Report Bug | ✨ Request Feature

Instalación

TypingMind
{
  "mcpServers": {
    "polymarket-mcp-server": {
      "command": "npx",
      "args": [
        "polymarket-web"
      ]
    }
  }
}

Usa el MCP de Polymarket MCP Server con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado Polymarket MCP Server, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade Polymarket MCP Server como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de Polymarket MCP Server.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "polymarket-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "polymarket-mcp"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de Polymarket MCP Server y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de Polymarket MCP Server.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar Polymarket MCP Server para ayudarme con esta tarea?
Polymarket MCP Server
Claro. Lo he leído.
Esto he encontrado usando Polymarket MCP Server.

Preguntas frecuentes

¿Para qué sirve el servidor MCP Polymarket MCP Server?

Polymarket MCP Server es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP Polymarket MCP Server con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar Polymarket MCP Server con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de Polymarket MCP Server con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con Polymarket MCP Server conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP Polymarket MCP Server a TypingMind?

Polymarket MCP Server funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP Polymarket MCP Server en TypingMind?

Polymarket MCP Server ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP Polymarket MCP Server?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si Polymarket MCP Server requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇