Polymarket MCP Server
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 today's trending prediction markets"
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
A Model Context Protocol (MCP) server that provides AI assistants with the ability to interact with Polymarket.
Features
Market Discovery: Browse and search current prediction markets
Real-time Data: Get detailed market information, prices, and statistics
Trading: Place market orders (FOK/FAK) and limit orders (GTC/GTD)
Portfolio Management: View balances, positions, and P&L
Order Management: Track and manage your active orders
Multi-format Support: Works with market slugs or direct token IDs
Related MCP server: Polymarket MCP Server
Installation
1. Clone and Install
git clone https://github.com/yourusername/polymarket-mcp-server.git
cd <folder-name>
pnpm install2. Install Required Dependencies
pnpm install @modelcontextprotocol/sdk zod @polymarket/clob-client ethers3. Environment Configuration
Create a .env file in the project root:
# Required: Your Polygon wallet private key
PRIVATE_KEY=your_private_key_here
# Optional: Custom CLOB API URL (defaults to https://clob.polymarket.com)
CLOB_API_URL=https://clob.polymarket.com
# Optional: Signature type (defaults to 0)
SIGNATURE_TYPE=0
# Optional: Existing API credentials (will be auto-generated if not provided)
CLOB_API_KEY=your_api_key
CLOB_SECRET=your_secret
CLOB_PASS_PHRASE=your_passphrase4. MCP Configuration
Add the server to your MCP settings file:
{
"mcpServers": {
"poly": {
"command": "npx",
"args": ["polymarket-mcp"],
"env": {
"PRIVATE_KEY": ""
}
}
}
}Available Tools
1. Market Discovery
getAllMarkets
Get current prediction markets with optional filtering.
Get me today's trending marketsgetMarketDetails
Get detailed information about a specific market using its slug.
Get details for the market "will-donald-trump-win-the-2024-us-presidential-election"
Show me info about "bitcoin-above-100k-by-end-of-2024"2. Trading Operations
placeMarketOrder
Execute immediate market orders (Fill or Kill / Fill and Kill).
Buy $100 of YES on "bitcoin-above-100k-by-end-of-2024" using FOK order
Sell $50 of NO on the Trump election market with FAKParameters:
marketSlugortokenID: Market identifieroutcome: YES or NO (if using marketSlug)amount: USD amount to tradeside: BUY or SELLorderType: FOK (Fill or Kill) or FAK (Fill and Kill)
placeLimitOrder
Place limit orders at specific prices (Good Till Cancelled / Good Till Date).
Place a limit buy order for 100 shares at $0.65 on the Bitcoin market
Set a GTC sell order for 50 shares at $0.80 on Trump electionParameters:
marketSlugortokenID: Market identifieroutcome: YES or NO (if using marketSlug)price: Price per share (0-1)size: Number of sharesside: BUY or SELLorderType: GTC (Good Till Cancelled) or GTD (Good Till Date)expirationMinutes: Expiration time (GTD only)
3. Portfolio Management
getPortfolio
View complete portfolio including balances and positions.
Show me my portfolio
What's my current P&L?
Check my USDC balancegetOrder
Get details of a specific order by ID.
Check order status for 0x831680cb77da95792af5a052c87c8abf9d2ae5cb21f275670bc0ff58f2823c5cUsage Examples
Starting the Server
Important: Always run the server using Node.js directly to ensure proper initialization:
node <path-to-index.js>This will:
Initialize your wallet connection Set up required token allowances (USDC approvals for CTF and Exchange contracts) Generate or use existing API credentials Start the MCP server
Basic Market Research
"Get details about the market 'ai-will-achieve-agi-by-2025'"
Simple Trading
"Buy $20 of YES on 'will-spacex-reach-mars-by-2030' using a market order"Portfolio Monitoring
"Show me my current portfolio and P&L"
"Check my USDC balance on Polymarket"Advanced Trading
"Set a GTC limit sell order for 100 shares at $0.85 on token ID 123456"
"Place a FOK buy order for $500 on the climate change market"
"Check the status of my order 0x831680..."Market Slug Examples
Market slugs are found in Polymarket URLs:
https://polymarket.com/event/will-donald-trump-win-the-2024-us-presidential-electionSlug:
will-donald-trump-win-the-2024-us-presidential-election
https://polymarket.com/event/bitcoin-above-100k-by-end-of-2024Slug:
bitcoin-above-100k-by-end-of-2024
API Limits
Polymarket may have rate limits on API calls
Large orders may have slippage on smaller markets
Some markets may have low liquidity
Troubleshooting
Common Issues
"Client not initialized"
Check your
PRIVATE_KEYis set correctlyEnsure you have USDC balance for gas fees
Verify Polygon network connectivity
"Market not found"
Double-check the market slug spelling
Ensure the market is still active
Try using direct token ID instead
"Insufficient balance"
Add USDC to your Polygon wallet
Check if allowances were set properly
Verify you're on Polygon Mainnet
"Order failed"
Check if market is still open for trading
Verify price is within valid range (0-1)
Ensure sufficient balance for the trade
API Reference
Market Data Endpoints
Gamma API:
https://gamma-api.polymarket.com/marketsData API:
https://data-api.polymarket.com/positionsCLOB API:
https://clob.polymarket.com
Contract Addresses (Polygon)
USDC:
0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174CTF:
0x4D97DCd97eC945f40cF65F87097ACe5EA0476045Exchange:
0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E
Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Support
Issues: GitHub Issues
Discussions: GitHub Discussions
Available Tools
6 toolsgetAllMarketsC
Get all markets from today
Inputs: limit.
getMarketDetailsB
Get detailed information about a specific market using Gamma API
Inputs: marketSlug (required).
getOrderA
Get details of a specific order by order ID
Inputs: orderId (required).
getPortfolioA
Get complete portfolio including account balance and all positions
Inputs: no named parameters.
placeLimitOrderC
Place a limit order (Good Till Cancelled / Good Till Date)
Inputs: side (required), size (required), price (required), orderType (required), +5 more.
placeMarketOrderB
Place a market order (Fill or Kill / Fill and Kill)
Inputs: side (required), amount (required), orderType (required), outcome, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool addresses a distinct function: market listing, market details, order details, portfolio overview, and two order types with clear differences. No overlaps.
All tools follow a consistent verbNoun camelCase pattern (getAllMarkets, getMarketDetails, getOrder, getPortfolio, placeLimitOrder, placeMarketOrder).
Six tools cover the essential operations for a prediction market server—browsing, querying, portfolio, and trading—without being excessive or insufficient.
Core functionalities are present, but missing order cancellation and trade history, which are common in trading APIs. Minor gap.
Maintenance
Related MCP Connectors
Polymarket in your AI: market rules, real fill costs, who is trading, top traders. Read-only.
Polymarket trader analytics for AI agents: rank wallets, read trader metrics, backtest strategies.
Trade Polymarket prediction markets from your Ask Gina wallet. Moves real funds.
Polymarket wallet intelligence for AI agents: scored wallets, insider signals, whale flow.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to query Polymarket prediction markets, accessing real-time odds, market data, price history, order books, and trending markets across categories like politics, crypto, and sports through natural language.44 npm7MIT
- FlicenseNot gradedqualityCmaintenanceEnables interaction with Polymarket prediction markets through read-only access to market data, events, orderbooks, and user positions, plus authenticated trading capabilities for creating and managing orders.1-
- AlicenseAqualityCmaintenanceEnables AI agents to discover and analyze prediction markets, execute trades, and manage positions on Polymarket via the Model Context Protocol.7106 npm20MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Polymarket prediction markets, including retrieving market data, user positions, and trading history.821 npm12Apache 2.0