{"id":32675432,"url":"https://github.com/iqaicom/mcp-polymarket","last_synced_at":"2026-05-13T11:02:03.456Z","repository":{"id":321590944,"uuid":"1084969382","full_name":"IQAIcom/mcp-polymarket","owner":"IQAIcom","description":"MCP server for interacting with polymarket","archived":false,"fork":false,"pushed_at":"2026-01-29T12:14:16.000Z","size":413,"stargazers_count":9,"open_issues_count":0,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-30T02:21:33.389Z","etag":null,"topics":["agents","mcp","mcp-server","polymarket"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IQAIcom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-28T12:13:44.000Z","updated_at":"2026-01-29T12:14:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b0eb294-bf0b-49f8-b713-fe9ddba13061","html_url":"https://github.com/IQAIcom/mcp-polymarket","commit_stats":null,"previous_names":["iqaicom/mcp-polymarket"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/IQAIcom/mcp-polymarket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IQAIcom%2Fmcp-polymarket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IQAIcom%2Fmcp-polymarket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IQAIcom%2Fmcp-polymarket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IQAIcom%2Fmcp-polymarket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IQAIcom","download_url":"https://codeload.github.com/IQAIcom/mcp-polymarket/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IQAIcom%2Fmcp-polymarket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32979305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T06:31:55.726Z","status":"ssl_error","status_checked_at":"2026-05-13T06:31:51.336Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agents","mcp","mcp-server","polymarket"],"created_at":"2025-11-01T06:01:35.236Z","updated_at":"2026-05-13T11:02:03.449Z","avatar_url":"https://github.com/IQAIcom.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📊 Polymarket MCP Server\n\n[![npm version](https://img.shields.io/npm/v/@iqai/mcp-polymarket.svg)](https://www.npmjs.com/package/@iqai/mcp-polymarket)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n## 📖 Overview\n\nThe Polymarket MCP Server enables AI agents to interact with [Polymarket](https://polymarket.com), a leading prediction market platform on Polygon. This server provides comprehensive access to market data, real-time pricing, order books, and trading capabilities through the Polymarket API.\n\nBy implementing the Model Context Protocol (MCP), this server allows Large Language Models (LLMs) to discover prediction markets, analyze odds (probabilities), execute trades, and track portfolio positions directly through their context window, bridging the gap between AI and decentralized prediction markets.\n\n## ✨ Features\n\n*   **Market Discovery**: Search and filter prediction markets by keywords, tags, and status.\n*   **Real-time Pricing**: Access live price data, implied probabilities, and depth-of-market (order books) for any outcome token.\n*   **Trading Capabilities**: Place limit orders, market orders, and manage open orders (requires private key).\n*   **Portfolio Tracking**: Monitor user positions, trade history, and balances for specific wallet addresses.\n*   **Order Management**: View, cancel, and manage open orders across all markets.\n\n## 📦 Installation\n\n### 🚀 Using npx (Recommended)\n\nTo use this server without installing it globally:\n\n```bash\nnpx @iqai/mcp-polymarket\n```\n\n### 🔧 Build from Source\n\n```bash\ngit clone https://github.com/IQAIcom/mcp-polymarket.git\ncd mcp-polymarket\npnpm install\npnpm run build\n```\n\n## ⚡ Running with an MCP Client\n\nAdd the following configuration to your MCP client settings (e.g., `claude_desktop_config.json`).\n\n### 📋 Minimal Configuration (Read-Only)\n\n```json\n{\n  \"mcpServers\": {\n    \"polymarket\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@iqai/mcp-polymarket\"]\n    }\n  }\n}\n```\n\n### ⚙️ Advanced Configuration (With Trading)\n\n```json\n{\n  \"mcpServers\": {\n    \"polymarket\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@iqai/mcp-polymarket\"],\n      \"env\": {\n        \"POLYMARKET_PRIVATE_KEY\": \"your_private_key_here\",\n        \"POLYGON_RPC_URL\": \"https://polygon-mainnet.g.alchemy.com/v2/\u003cYOUR_KEY\u003e\"\n      }\n    }\n  }\n}\n```\n\n## 🔐 Configuration (Environment Variables)\n\n| Variable | Required | Description | Default |\n| :--- | :--- | :--- | :--- |\n| `POLYMARKET_PRIVATE_KEY` | No | Private key for trading (enables trading tools) | - |\n| `POLYGON_RPC_URL` | No | Polygon RPC URL for transactions | `https://polygon-rpc.com` |\n| `CLOB_API_BASE` | No | Polymarket CLOB API base URL | `https://clob.polymarket.com` |\n| `CHAIN_ID` | No | Blockchain network chain ID | `137` (Polygon) |\n| `SIGNATURE_TYPE` | No | Signature type for signing transactions | `2` |\n| `POLYMARKET_FUNDER` | No | Funder address for transactions | - |\n| `FUNDER_ADDRESS` | No | Alternative funder address (alias) | - |\n\n## 💡 Usage Examples\n\n### 🔍 Market Discovery\n*   \"What are the most active prediction markets on Polymarket right now?\"\n*   \"Search for markets related to 'Bitcoin' or 'BTC'.\"\n*   \"Find markets in the 'Crypto' category.\"\n*   \"What events are trending on Polymarket today?\"\n\n### 📊 Analytics \u0026 Pricing\n*   \"Show me the order book for the 2024 election market.\"\n*   \"What is the current probability implied by the price of the 'Yes' token?\"\n*   \"Get detailed information about the 'will-trump-win-2024' market.\"\n\n### 💼 Portfolio \u0026 Trading (Requires Private Key)\n*   \"What's my current USDC balance and allowance?\"\n*   \"Show me all my open orders across all markets.\"\n*   \"Place a buy order for 100 shares at 0.65 price.\"\n*   \"Cancel all my open orders on this market.\"\n\n## 🛠️ MCP Tools\n\n\u003c!-- AUTO-GENERATED TOOLS START --\u003e\n\n### `approve_allowances`\nGrant the USDC and Conditional Tokens approvals required to trade on Polymarket. Automatically approves only the contracts that don't already have approvals set. Includes both regular and NegRisk markets. These approvals are standard ERC20/ERC1155 approvals, revocable at any time in your wallet.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `waitForConfirmations` | integer | false | How many confirmations to wait before returning (0 = return immediately after broadcasting). Default: 0 |\n\n### `cancel_all_orders`\nCancel all open orders for the authenticated account.\n\n_No parameters_\n\n### `cancel_order`\nCancel a specific order by its ID.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `orderId` | string | true | The unique identifier of the order to cancel |\n\n### `get_all_tags`\nGet a list of all available tags for categorizing markets.\n\n_No parameters_\n\n### `get_balance_allowance`\nGet balance and allowance information for the authenticated account. Can check COLLATERAL or CONDITIONAL tokens.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `assetType` | string | true | Asset type to check balance for: COLLATERAL or CONDITIONAL |\n| `tokenID` | string | false | Optional token ID for conditional token balance |\n\n### `get_event_by_slug`\nGet detailed information about a specific event by its slug identifier. Events group multiple related markets.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `slug` | string | true | The event slug identifier |\n\n### `get_market_by_slug`\nGet detailed information about a specific market by its slug identifier. The slug can be extracted from the Polymarket URL.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `slug` | string | true | The market slug identifier (e.g., 'will-trump-win-2024') |\n\n### `get_markets_by_tag`\nGet markets filtered by a specific tag ID. Useful for finding markets in specific categories.\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|----------|---------|-------------|\n| `tag_id` | string | true |  | The tag ID to filter by |\n| `limit` | number | false | 20 | Number of markets to return (default: 20) |\n| `closed` | boolean | false | false | Include closed markets (default: false) |\n\n### `get_open_orders`\nGet all open orders for the authenticated account. Can optionally filter by market.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `market` | string | false | Optional market address to filter orders by |\n\n### `get_order`\nGet details of a specific order by its ID.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `orderId` | string | true | The unique identifier of the order |\n\n### `get_order_book`\nGet the current order book for a specific market token. Shows all active buy and sell orders.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `token_id` | string | true | The token ID for the market outcome |\n\n### `get_positions`\nGet all positions for a wallet address with current values. Returns position details including size, current price, current value, and P\u0026L. Uses the Polymarket Data API for accurate position valuation.\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|----------|---------|-------------|\n| `user` | string | false |  | Wallet address to fetch positions for. If not provided, uses POLYMARKET_FUNDER env var. |\n| `limit` | number | false | 100 | Maximum number of positions to return (default: 100) |\n\n### `get_trade_history`\nGet trade history for the authenticated account. Can optionally filter by market or maker address.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `market` | string | false | Optional market address to filter trades by |\n| `maker_address` | string | false | Optional maker address to filter trades by |\n\n### `list_active_markets`\nList all currently active markets with pagination. Returns markets that are not yet closed.\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|----------|---------|-------------|\n| `limit` | number | false | 20 | Number of markets to return (default: 20, max: 100) |\n| `offset` | number | false | 0 | Number of markets to skip for pagination (default: 0) |\n\n### `place_market_order`\nPlace a market order that executes immediately at current market price. IMPORTANT: For BUY orders, amount is the dollar amount ($USD) you want to spend. For SELL orders, amount is the number of shares to sell. Example: amount=5, side=BUY means 'spend $5 to buy shares at market price'. Minimum $1 for BUY orders.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `tokenId` | string | true | The token ID of the market outcome to trade |\n| `amount` | number | true | BUY orders: Dollar amount ($) to spend. SELL orders: Number of shares to sell. Minimum $1 for BUY orders. |\n| `side` | string | true | The side of the order: BUY or SELL |\n| `orderType` | string | false | Order type: FOK (Fill or Kill) or FAK (Fill and Kill). Default: FOK |\n\n### `place_order`\nPlace a limit order on Polymarket at a specific price. Specify the number of shares (size) and price (0-1). For both BUY and SELL, you specify the number of shares you want to trade. Example: size=10, price=0.6 means buy/sell 10 shares at $0.60 per share (total: $6).\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `tokenId` | string | true | The token ID of the market outcome to trade |\n| `price` | number | true | The limit price for the order (between 0 and 1). This is the probability/price per share. |\n| `size` | number | true | Number of shares to trade. For both BUY and SELL orders, this is always the number of outcome tokens/shares. |\n| `side` | string | true | The side of the order: BUY or SELL |\n| `orderType` | string | false | Order type: GTC (Good Till Cancelled) or GTD (Good Till Date). Default: GTC |\n\n### `redeem_positions`\nRedeem (claim) winnings from a resolved Polymarket prediction market. Use this to collect USDC from positions in markets that have been settled. For regular markets, you need the conditionId. For negative risk markets, you also need the tokenId and should set negRisk=true. The market must be resolved before redemption is possible.\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|----------|---------|-------------|\n| `conditionId` | string | true |  | The condition ID (market ID) for the resolved market. This is typically a 32-byte hex string. |\n| `tokenId` | string | false |  | The token ID of the position to redeem. Required for negRisk markets, optional for regular markets. |\n| `outcomeIndex` | number | false |  | The outcome index: 0 for Yes/first outcome, 1 for No/second outcome. Used for negRisk markets to determine which tokens to redeem. |\n| `negRisk` | boolean | false | false | Whether this is a negative risk market. Negative risk markets use the NegRiskAdapter contract for redemption. Default: false |\n\n### `search_markets`\nSearch for markets, events, and profiles using text search.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `query` | string | true | Search query text |\n\n### `update_balance_allowance`\nUpdate balance and allowance for the authenticated account. Required before trading.\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `assetType` | string | true | Asset type to update allowance for: COLLATERAL or CONDITIONAL |\n| `tokenID` | string | false | Optional token ID for conditional token |\n\n\u003c!-- AUTO-GENERATED TOOLS END --\u003e\n\n## 👨‍💻 Development\n\n### 🏗️ Build Project\n```bash\npnpm run build\n```\n\n### 👁️ Development Mode (Watch)\n```bash\npnpm run watch\n```\n\n### ✅ Linting \u0026 Formatting\n```bash\npnpm run lint\npnpm run format\n```\n\n### 📁 Project Structure\n*   `src/tools/`: Individual tool definitions\n*   `src/services/`: API client and business logic\n*   `src/index.ts`: Server entry point\n\n## 📚 Resources\n\n*   [Polymarket API Documentation](https://docs.polymarket.com)\n*   [Model Context Protocol (MCP)](https://modelcontextprotocol.io)\n*   [Polymarket Platform](https://polymarket.com)\n\n## ⚠️ Disclaimer\n\nThis project is an unofficial tool and is not directly affiliated with Polymarket. It interacts with financial and prediction market data. Users should exercise caution and verify all data independently. Trading in prediction markets involves risk.\n\n## 📄 License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiqaicom%2Fmcp-polymarket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiqaicom%2Fmcp-polymarket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiqaicom%2Fmcp-polymarket/lists"}