MCP server and Python toolkit for Polymarket prediction markets: slippage estimation, liquidity scanning, arbitrage detection, price feeds, and sentiment analysis.
Project description
polymarket-mcp
pip install polymarket-mcp
MCP server and Python toolkit for Polymarket prediction markets. Gives AI agents real-time slippage estimation, liquidity scanning, arbitrage detection, crypto price feeds, contract timers, sentiment analysis, probability estimation, and portfolio risk calculation — all through the Model Context Protocol.
Works with Claude Desktop, Cursor, Windsurf, and any MCP-compatible client.
Quick Start
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"polymarket": {
"command": "polymarket-mcp",
"args": ["--stdio"]
}
}
}
Run as SSE server
polymarket-mcp
# Starts on http://127.0.0.1:8000/sse
Run as streamable HTTP
polymarket-mcp --http
# Starts on http://127.0.0.1:8000/mcp
Tools
All free tools require no API key. Paid tools require an API key from whitmorelabs.io.
Free Tools
estimate_slippage
Walk the CLOB order book and calculate average fill price for a given position size.
estimate_slippage(
market_id="71321045679252212594626385532587807886473352341859285086426388424842616389328",
side="BUY",
position_size_usd=500.0
)
Returns: best_price, avg_fill_price, slippage_pct, liquidity_available, recommendation (go/caution/no-go).
scan_market_liquidity
Scan a market's liquidity depth with spread and depth at 1%/2%/5% from mid.
scan_market_liquidity(market_id="71321045679252212594626385532587807886473352341859285086426388424842616389328")
Returns: best_bid, best_ask, spread_pct, depth buckets, liquidity_grade (A/B/C).
find_arbitrage_gaps
Scan all active Polymarket markets for YES + NO price sums that don't equal 1.00.
find_arbitrage_gaps(min_gap_pct=2.0)
Returns: markets with gaps, gap size, and direction to exploit (BUY_BOTH or SELL_BOTH).
get_crypto_price
Real-time crypto price from Binance and/or CoinGecko in parallel, with latency metadata.
get_crypto_price(symbol="BTC", sources="binance,coingecko")
Returns: per-source prices, average, max deviation between sources.
get_contract_status
Time remaining and resolution status for active Polymarket contracts. BTC 5-min/15-min contracts use slug timestamp parsing for exact expiry.
get_contract_status(market_id="btc-updown-5m-1711234567")
get_contract_status(category="crypto") # scan all short-duration contracts
Returns: time_remaining_seconds, time_remaining_human, current_odds.
estimate_probability
Estimate the probability of any event using structured reasoning. Base rates, key factors, timeframe analysis — all in one structured JSON response.
estimate_probability(question="Will Bitcoin reach $150k before end of 2025?")
Returns: estimated_probability (0-1), confidence_level, factors_for, factors_against, base_rate_note, reasoning.
calculate_portfolio_risk
Pure-math risk metrics for a portfolio of prediction market positions. No external API calls.
calculate_portfolio_risk(positions='[{"market_id": "abc123", "side": "YES", "size": 200, "entry_price": 0.65}]')
Returns: total_exposure, max_loss, max_gain, diversification_score, kelly_warnings, rebalancing_suggestions.
get_scoring_performance
Free. No API key. Returns scoring methodology, current dataset stats, and pricing. Call this first to evaluate whether the paid data is worth it.
Paid Tools (API key required)
7-day free trial on signup. After trial: pay-per-request in USDC on Polygon.
| Tool | Cost |
|---|---|
get_shadow_wallets |
$0.05/request |
get_top_wallets |
$0.05/request |
get_wallet_score |
$0.05/request |
get_wallet_pnl |
$0.05/request |
get_wallet_clusters |
$0.05/request |
get_btc_short_markets |
$0.01/request |
analyze_market_sentiment |
$0.05/request |
Volume discount: 50% off above 1000 requests/day.
get_shadow_wallets
Find wallets that co-trade with a seed wallet across the same Polymarket categories.
get_shadow_wallets(seed_wallet="0xabc...", api_key="your-key")
Returns: up to 20 shadow wallets ranked by co-trading intensity, shared categories, win rates.
get_top_wallets
Top-ranked Polymarket wallets from MoonMirror's scoring engine (PnL + consistency + specialization - drawdown penalty).
get_top_wallets(api_key="your-key", limit=50, min_score=0.5)
get_wallet_score
Full scoring breakdown for a specific wallet address.
get_wallet_score(address="0xabc...", api_key="your-key")
Returns: score components, win rate, trade count, data freshness.
get_wallet_pnl
Realized PnL for a wallet with per-category breakdown. Pre-computed from Goldsky subgraph.
get_wallet_pnl(address="0xabc...", api_key="your-key")
get_wallet_clusters
Wallets that independently appear alongside 3+ different top-scoring wallets — stronger signal than a single shadow match.
get_wallet_clusters(api_key="your-key", min_co_trades=3)
get_btc_short_markets
Active BTC 5-min and 15-min Polymarket contracts with token IDs and current midpoint prices. Cached, refreshed every 60 seconds.
get_btc_short_markets(api_key="your-key")
analyze_market_sentiment
Structured probabilistic analysis for a prediction market question using Claude's reasoning.
analyze_market_sentiment(question="Will Ethereum ETF hit $10B AUM by Q3 2025?", api_key="your-key")
Wallet Intelligence: How It Works
The paid wallet tools are backed by MoonMirror, a Polymarket wallet intelligence engine. MoonMirror continuously monitors wallets on-chain, scores them on PnL, consistency, and market specialization, and pre-computes shadow wallet relationships.
All wallet queries return in < 100ms because everything is pre-computed. No blocking subgraph calls.
Alternatives Comparison
| Feature | polymarket-mcp | Manual CLOB calls | py-clob-client |
|---|---|---|---|
| MCP integration | Yes | No | No |
| Slippage estimation | Yes | DIY | Partial |
| Arbitrage scanning | Yes | DIY | No |
| Wallet intelligence | Yes | No | No |
| Price feed (multi-source) | Yes | No | No |
| Probability engine | Yes | No | No |
| Portfolio risk math | Yes | No | No |
| AI agent ready | Yes | No | No |
Configuration
All settings via environment variables:
# Server
HOST=127.0.0.1
PORT=8000
# DB paths (for self-hosted wallet intelligence)
MOONMIRROR_DB_PATH=/path/to/moonmirror.db
SERVICES_DB_PATH=/path/to/services.db
# Pricing
PRICE_WALLET_INTEL=0.05
PRICE_MARKET_DATA=0.01
TRIAL_DAYS=7
# Rate limiting
RATE_PER_KEY=5
RATE_GLOBAL=20
Admin CLI
# Create an API key
polymarket-mcp --create-key "customer-name"
# Top up a key's USDC balance
polymarket-mcp --top-up YOUR_KEY 10.0
GitHub
github.com/whitmorelabs/polymarket-mcp
Issues, PRs, and stars welcome.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polymarket_trading_mcp-0.1.1.tar.gz.
File metadata
- Download URL: polymarket_trading_mcp-0.1.1.tar.gz
- Upload date:
- Size: 48.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61198837ade0d289335730d57ac6caae3e65fa8ac31679c0e5fb5e052180ce83
|
|
| MD5 |
b6bdbb1fb373ed05cc5b608721eb2487
|
|
| BLAKE2b-256 |
1bd2ae01c17e994011e35ffd49a7be9462d68580d1ffe2b4f127e0f7129da44e
|
File details
Details for the file polymarket_trading_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: polymarket_trading_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 54.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89cc18d77388fbe0c7ac16e648f238ae72e6249baaccd8dc87aa0d9f5d7ffe2f
|
|
| MD5 |
971261c70b8119bf44f8dd361d79fff5
|
|
| BLAKE2b-256 |
285337e17db69bc755ad3e1378977feed46491f43cf8a74ebce3d9381d77cf79
|