Polymarket MCP Server

Polymarket MCP Server

Enables AI assistants to interact with Polymarket prediction markets, including retrieving market data, user positions, and trading history.

Category
访问服务器

README

Polymarket MCP Server

License TypeScript MCP

A comprehensive Model Context Protocol (MCP) server for interacting with Polymarket, the world's largest prediction market platform. This server provides seamless access to Polymarket's APIs, enabling AI assistants to retrieve market data, user positions, trading history, and more.

🚀 Features

Market Data

  • Get Markets: Retrieve prediction markets with filtering and pagination
  • Get Events: Access event data containing multiple related markets
  • Market Prices: Real-time and historical price data with technical analysis
  • Order Book: Live bid/ask data with market depth analysis

Trading & Activity

  • Trade History: Comprehensive trading data with statistics
  • User Positions: Portfolio tracking with P&L calculations
  • User Activity: On-chain activity including trades, splits, merges, and rewards
  • Market Holders: Ownership distribution and concentration analysis

Advanced Analytics

  • Liquidity analysis and market depth
  • Price trend analysis and volatility metrics
  • Portfolio performance tracking
  • Market concentration and distribution insights

📦 Installation

Prerequisites

  • Node.js 18+
  • TypeScript 5.3+
  • npm or yarn

Setup

  1. Clone the repository

    git clone <repository-url>
    cd polymarket-mcp
    
  2. Install dependencies

    npm install
    
  3. Build the project

    npm run build
    
  4. Start the server

    npm start
    

🔧 Configuration

Claude Desktop Integration

Method 1: Stdio Mode (Recommended for Development)

Add to your Claude Desktop configuration file:

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

{
  "mcpServers": {
    "polymarket-mcp": {
      "command": "node",
      "args": ["path/to/polymarket-mcp/build/index.js"]
    }
  }
}

Method 2: SSE Mode (Recommended for Production)

  1. Install Supergateway

    npm install -g supergateway
    
  2. Start SSE server

    npm run sse
    
  3. Configure Claude Desktop

    {
      "mcpServers": {
        "polymarket-mcp": {
          "type": "sse",
          "url": "http://localhost:3100/sse",
          "timeout": 600
        }
      }
    }
    

🛠️ Available Tools

1. Get Markets

get_markets({
  limit?: number,           // Max results (default: 20, max: 100)
  offset?: number,          // Pagination offset
  active?: boolean,         // Filter by active status
  search?: string,          // Search by title/description
  order?: string,           // Sort by: volume, liquidity, start_date, end_date
  liquidity_min?: number,   // Minimum liquidity threshold
  volume_min?: number       // Minimum volume threshold
})

2. Get Events

get_events({
  limit?: number,           // Max results (default: 20, max: 100)
  offset?: number,          // Pagination offset
  active?: boolean,         // Filter by active status
  search?: string,          // Search by title/description
  order?: string            // Sort by: volume, liquidity, start_date, end_date
})

3. Get User Positions

get_user_positions({
  user_address: string,     // Required: User's wallet address
  limit?: number,           // Max results (default: 50, max: 100)
  market_id?: string,       // Filter by specific market
  min_size?: number,        // Minimum position size
  show_zero_positions?: boolean // Include zero positions
})

4. Get User Activity

get_user_activity({
  user_address: string,     // Required: User's wallet address
  limit?: number,           // Max results (default: 50, max: 100)
  activity_type?: string,   // TRADE, SPLIT, MERGE, REDEEM, REWARD, CONVERSION
  side?: string,            // BUY or SELL (for trades)
  start_date?: string,      // ISO 8601 date format
  end_date?: string         // ISO 8601 date format
})

5. Get Market Prices

get_market_prices({
  market_id?: string,       // Market ID (required if no token_id)
  token_id?: string,        // Token ID (required if no market_id)
  interval?: string,        // 1m, 5m, 1h, 1d (default: 1h)
  fidelity?: number,        // Number of price points (default: 100, max: 1000)
  include_orderbook?: boolean // Include current order book
})

6. Get Trades

get_trades({
  limit?: number,           // Max results (default: 50, max: 100)
  market_id?: string,       // Filter by market
  user_address?: string,    // Filter by user
  side?: string,            // BUY or SELL
  min_size?: number,        // Minimum trade size
  start_date?: string,      // ISO 8601 date format
  end_date?: string         // ISO 8601 date format
})

7. Get Order Book

get_order_book({
  market_id?: string,       // Market ID (required if no token_id)
  token_id?: string,        // Token ID (required if no market_id)
  depth?: number,           // Price levels to show (default: 10, max: 50)
  include_spread_analysis?: boolean,   // Include spread analysis
  include_liquidity_analysis?: boolean // Include liquidity analysis
})

8. Get Market Holders

get_market_holders({
  market_id?: string,       // Market ID (required if no token_id)
  token_id?: string,        // Token ID (required if no market_id)
  limit?: number,           // Max results (default: 50, max: 100)
  min_balance?: number,     // Minimum balance threshold
  include_user_info?: boolean // Include user profiles
})

📊 Example Usage

Get Active Markets

Show me the top 10 most liquid active prediction markets

Analyze User Portfolio

Get positions for wallet address 0x1234... and show P&L analysis

Market Analysis

Get order book for market ID abc123 with liquidity analysis

Trading History

Show recent trades for market xyz789 with volume over 1000 shares

🏗️ Architecture

src/
├── index.ts              # MCP server entry point
├── lib/
│   └── polymarketClient.ts # Polymarket API client
└── tools/                # Business logic tools
    ├── getMarkets.ts
    ├── getEvents.ts
    ├── getUserPositions.ts
    ├── getUserActivity.ts
    ├── getMarketPrices.ts
    ├── getTrades.ts
    ├── getOrderBook.ts
    └── getMarketHolders.ts

🔗 API Coverage

This MCP server integrates with multiple Polymarket APIs:

  • Gamma Markets API: Market data and metadata
  • CLOB API: Order book and trading data
  • Data API: User positions, activity, and analytics

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

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

👨‍💻 Author

Xingyu Chen

🙏 Acknowledgments


Built with ❤️ for the prediction markets ecosystem

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选