Polymarket MCP Server
Enables autonomous trading and portfolio management on Polymarket prediction markets with 45 tools covering market discovery, analysis, trading execution, position tracking, and real-time monitoring via WebSocket connections.
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 trending prediction markets for this week"
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
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
Developed in collaboration with:
πΎ Yield Hacker - DeFi Innovation Community
π° Renda Cripto - Crypto Trading Community
ποΈ Cultura Builder - Builder Culture Community
Powered by Claude Code from Anthropic
Related MCP server: polymarket-trader-mcp
β 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!
# Start the web dashboard
polymarket-web
# Or use the quick start script
./start_web_dashboard.shAccess 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):
# 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.shFull installation (with trading):
# macOS/Linux
./install.sh
# Windows
install.batThe 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
Method | Command | Best For |
Quick Start |
| First-time users, testing |
DEMO Mode |
| No wallet, read-only access |
Full Install |
| Production trading setup |
Windows |
| Windows 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:
# 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)
cp .env.example .env
# Edit .env and set:
DEMO_MODE=trueOption 2: Full Trading Mode
cp .env.example .env
# Edit with your Polygon wallet credentials
nano .envRequired credentials (Full Mode):
POLYGON_PRIVATE_KEY=your_private_key_without_0x_prefix
POLYGON_ADDRESS=0xYourPolygonAddressRecommended Safety Limits:
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=500With 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
{
"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
Visual Installation Guide - Step-by-step with diagrams and screenshots
FAQ - Frequently asked questions and troubleshooting
Setup Guide - Detailed configuration instructions
Demo Video Script - Video tutorial scripts
Developer Resources
Tools Reference - Complete API documentation for all 45 tools
Agent Integration Guide - How to integrate with your agents
Trading Architecture - System design and architecture
WebSocket Integration - Real-time data setup
Examples & Guides
Usage Examples - Code examples for all tools
Test Examples - Example test implementations
Market Analysis Scripts - Advanced analysis examples
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
# 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.pyNote: 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
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 $500These 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
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)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
πΎ Yield Hacker - DeFi Innovation & Yield Farming
π° Renda Cripto - Crypto Trading & Investments
ποΈ Cultura Builder - Builder Culture & Development
Featured In
Awesome Agent Trading - Curated directory of AI trading agents, MCP servers, and prediction market tools
Get Support
GitHub Issues: Report bugs or request features
GitHub Discussions: Ask questions and share ideas
Telegram Communities: Get help from the community
π 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
GitHub Repository: github.com/caiovicentino/polymarket-mcp-server
Polymarket: polymarket.com
Polymarket Docs: docs.polymarket.com
MCP Protocol: modelcontextprotocol.io
Claude Code: claude.ai/code
π 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!
Built with β€οΈ for autonomous AI trading on Polymarket
Ready to make Claude your personal prediction market trader! π
Available Tools
25 toolsanalyze_market_opportunityC
AI-powered market analysis with trading recommendation, risk assessment, and confidence score.
Inputs: market_id (required).
compare_marketsC
Compare multiple markets side-by-side with key metrics (volume, liquidity, etc.).
Inputs: market_ids (required).
filter_markets_by_categoryA
Filter markets by category or tag (e.g., Politics, Sports, Crypto). Returns markets in the specified category.
Inputs: category (required), limit, active_only.
get_closing_soon_marketsB
Get markets closing within specified timeframe. Returns markets sorted by closing time.
Inputs: hours, limit.
get_crypto_marketsB
Get cryptocurrency-related markets. Optionally filter by specific crypto symbol.
Inputs: limit, symbol.
get_current_priceB
Get current bid/ask prices for a token. Returns PriceData with bid, ask, and mid prices.
Inputs: token_id (required), side.
get_event_marketsB
Get all markets for a specific event. Returns all markets belonging to the event.
Inputs: event_id, event_slug.
get_featured_marketsB
Get featured or promoted markets. Returns curated list of important markets.
Inputs: limit.
get_liquidityC
Get available liquidity in USD for a market.
Inputs: market_id (required).
get_market_detailsC
Get complete market information including metadata, tokens, volume, and liquidity.
Inputs: slug, market_id, condition_id.
get_market_holdersA
Get top position holders for a market. Note: Requires authenticated access.
Inputs: market_id (required), limit.
get_market_volumeA
Get volume statistics for different timeframes (24h, 7d, 30d, all-time).
Inputs: market_id (required), timeframes.
get_orderbookC
Get complete order book with bids and asks arrays.
Inputs: token_id (required), depth.
get_price_historyB
Get historical price data (OHLC). Note: Limited availability via public API.
Inputs: token_id (required), end_date, resolution, start_date.
get_realtime_statusA
Get status of all real-time WebSocket subscriptions. Shows active subscriptions, connection status, event statistics, and errors. Use this to monitor the health of real-time data feeds.
Inputs: no named parameters.
get_sports_marketsC
Get sports betting markets. Optionally filter by specific sport type.
Inputs: limit, sport_type.
get_spreadA
Get current spread (difference between bid and ask prices).
Inputs: token_id (required).
get_trending_marketsA
Get markets with highest trading volume in specified timeframe. Returns top markets sorted by volume.
Inputs: limit, timeframe.
search_marketsB
Search markets by text query, slug, or keywords. Returns markets matching the search criteria.
Inputs: query (required), limit, filters.
subscribe_market_pricesA
Subscribe to real-time price changes for one or more markets. Receives notifications whenever the price changes for subscribed markets. Useful for monitoring market movements and price action.
Inputs: market_ids (required), callback_type.
subscribe_market_resolutionA
Subscribe to market resolution alerts. Receives notifications when specified markets are resolved (closed with final outcome). Useful for tracking when bets settle and positions can be claimed.
Inputs: market_ids (required), callback_type.
subscribe_orderbook_updatesA
Subscribe to real-time orderbook updates for one or more tokens. Receives notifications with aggregated bid/ask levels whenever the orderbook changes. Useful for monitoring liquidity and best bid/ask prices.
Inputs: token_ids (required), depth, callback_type.
subscribe_user_ordersB
Subscribe to real-time updates for user's orders. Receives notifications when orders are created, filled, partially filled, or cancelled. Requires CLOB authentication. Optionally filter by specific markets.
Inputs: market_ids, callback_type.
subscribe_user_tradesA
Subscribe to real-time updates for user's trades. Receives notifications when orders are matched and trades execute. Requires CLOB authentication. Optionally filter by specific markets.
Inputs: market_ids, callback_type.
unsubscribe_realtimeA
Unsubscribe from a real-time data feed. Removes a subscription by ID (obtained from subscribe_* tools). Stops receiving updates for that subscription.
Inputs: subscription_id (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 25 tools
Core market data tools are distinct, but the many market discovery variants (search_markets, get_trending_markets, filter_markets_by_category, get_featured_markets, get_closing_soon_markets, get_sports_markets, get_crypto_markets) overlap in purpose and can be hard to choose between. The subscription tools are clearly separated, but the listing surface creates real ambiguity.
Tool names mostly follow a readable verb_noun snake_case pattern (get_market_details, subscribe_orderbook_updates, unsubscribe_realtime). The main deviation is the mix of generic action verbs like search, compare, analyze, and filter, but the overall pattern remains predictable.
At 25 tools, the server sits at the heavy end and includes many narrow market query variants that could be consolidated into a more compact surface. The count is not unreasonable for a market data and subscription server, but it feels larger than necessary.
The server provides strong coverage of market discovery, pricing, order books, and real-time subscriptions, but it completely lacks trade execution tools such as place order, cancel order, or position management. This is a major gap for a Polymarket server, especially since user order/trade subscriptions require authentication.
Maintenance
Related MCP Connectors
Calibrated world model for AI agents. 40 tools: world state, markets, trading. Kalshi + Polymarket.
Polymarket in your AI: market rules, real fill costs, who is trading, top traders. Read-only.
AI prediction market trading β real-time data, CLOB exchange, Prop Desk, 40+ tools
Polymarket + Hyperliquid + macro for AI agents. 38 tools, signal backtest, SSE streaming. Free tier.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables 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
- AlicenseAqualityDmaintenanceTrade, analyze, and automate Polymarket prediction markets via AI. 34 tools for direct trading, smart money flow, copy trading, backtest, and portfolio management.48197 npm19MIT
- AlicenseNot gradedqualityDmaintenanceEnable Claude to autonomously trade, analyze, and manage positions on Polymarket with 45 comprehensive tools, real-time WebSocket monitoring, and enterprise-grade safety features.MIT
- AlicenseBqualityDmaintenanceEnables LLM agents to interact with Polymarket prediction markets, including market discovery, real-time pricing, analytics, account management, and trading with built-in safety guards.34MIT