Skip to main content
Glama
PolyMarket MCP Server

PolyMarket MCP Server

by berlinbra

PolyMarket MCP 服务器

铁匠徽章

模型上下文协议 (MCP) 服务器,通过 PolyMarket API 提供对预测市场数据的访问。该服务器实现了一个标准化接口,用于检索预测市场的市场信息、价格和历史数据。

特征

  • 实时预测市场数据,包括当前价格和概率

  • 详细的市场信息,包括类别、决议日期和描述

  • 具有可自定义时间范围(1 天、7 天、30 天、全部)的历史价格和数量数据

  • 内置错误处理和速率限制管理

  • 清晰的数据格式,方便使用

Related MCP server: Polymarket MCP Server

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 PolyMarket Predictions:

npx -y @smithery/cli install polymarket_mcp --client claude

克劳德桌面

  • 在 MacOS 上: ~/Library/Application\ Support/Claude/claude_desktop_config.json

  • 在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

    "mcpServers": {
        "polymarket-mcp": {
            "command": "uv",
            "args": [
            "--directory",
            "/Users/{INSERT_USER}/YOUR/PATH/TO/polymarket-mcp",
            "run",
            "polymarket-mcp" //or src/polymarket_mcp/server.py
            ],
            "env": {
                "KEY": "<insert poly market api key>",
                "FUNDER": "<insert polymarket wallet address"
            }
        }
    }

本地运行

  1. 克隆存储库并安装依赖项:

安装库

uv pip install -e .

跑步

通过 json 文件将 Claude 客户端与 MCP 工具连接并安装软件包后,Claude 应该可以看到服务器的 mcp 工具:

您可以通过以下方式自行运行服务器:在 polymarket-mcp repo 中:

uv run src/polymarket_mcp/server.py

*如果您想与服务器一起运行服务器检查器:

npx @modelcontextprotocol/inspector uv --directory C:\\Users\\{INSERT_USER}\\YOUR\\PATH\\TO\\polymarket-mcp run src/polymarket_mcp/server.py
  1. 使用您的 PolyMarket API 密钥创建一个.env文件:

Key=your_api_key_here
Funder=poly market wallet address

通过 json 文件将 Claude 客户端与 MCP 工具连接后,运行服务器:在 alpha-vantage-mcp repo 中: uv run src/polymarket_mcp/server.py

可用工具

该服务器实现了四个工具:

  • get-market-info :获取有关特定预测市场的详细信息

  • list-markets :列出可用的预测市场并附带过滤选项

  • get-market-prices :获取当前价格和交易信息

  • get-market-history :获取历史价格和交易量数据

获取市场信息

输入模式:

{
    "market_id": {
        "type": "string",
        "description": "Market ID or slug"
    }
}

响应示例:

Title: Example Market
Category: Politics
Status: Open
Resolution Date: 2024-12-31
Volume: $1,234,567.89
Liquidity: $98,765.43
Description: This is an example prediction market...
---

上市市场

输入模式:

{
    "status": {
        "type": "string",
        "description": "Filter by market status",
        "enum": ["open", "closed", "resolved"]
    },
    "limit": {
        "type": "integer",
        "description": "Number of markets to return",
        "default": 10,
        "minimum": 1,
        "maximum": 100
    },
    "offset": {
        "type": "integer",
        "description": "Number of markets to skip (for pagination)",
        "default": 0,
        "minimum": 0
    }
}

响应示例:

Available Markets:

ID: market-123
Title: US Presidential Election 2024
Status: Open
Volume: $1,234,567.89
---

ID: market-124
Title: Oscar Best Picture 2024
Status: Open
Volume: $234,567.89
---

获取市场价格

输入模式:

{
    "market_id": {
        "type": "string",
        "description": "Market ID or slug"
    }
}

响应示例:

Current Market Prices for US Presidential Election 2024

Outcome: Democratic
Price: $0.6500
Probability: 65.0%
---

Outcome: Republican
Price: $0.3500
Probability: 35.0%
---

获取市场历史

输入模式:

{
    "market_id": {
        "type": "string",
        "description": "Market ID or slug"
    },
    "timeframe": {
        "type": "string",
        "description": "Time period for historical data",
        "enum": ["1d", "7d", "30d", "all"],
        "default": "7d"
    }
}

响应示例:

Historical Data for US Presidential Election 2024
Time Period: 7d

Time: 2024-01-20T12:00:00Z
Price: $0.6500
Volume: $123,456.78
---

Time: 2024-01-19T12:00:00Z
Price: $0.6300
Volume: $98,765.43
---

错误处理

该服务器包括针对各种场景的全面错误处理:

  • 速率限制(429 个错误)

  • 无效的 API 密钥(403 错误)

  • 无效的市场 ID(404 错误)

  • 网络连接问题

  • API 超时条件(30 秒超时)

  • 格式错误的响应

错误消息以清晰、人类可读的格式返回。

先决条件

  • Python 3.9 或更高版本

  • httpx>=0.24.0

  • mcp-核心

  • python-dotenv>=1.0.0

贡献

欢迎贡献代码!欢迎提交 Pull 请求。对于重大变更,请先提交一个 issue 来讨论您想要修改的内容。

Available Tools

4 tools
get-market-historyC

Get historical price and volume data for a market

Inputs: market_id (required), timeframe.

get-market-infoC

Get detailed information about a specific prediction market

Inputs: market_id (required).

get-market-pricesB

Get current prices and trading information for a market

Inputs: market_id (required).

list-marketsB

Get a list of prediction markets with optional filters

Inputs: limit, offset, status.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 4 tools

    Disambiguation3/5

    The tools have overlapping purposes that could cause confusion. get-market-history, get-market-info, and get-market-prices all retrieve data about a specific market, making it unclear which to use for different needs. However, the descriptions provide some guidance on the type of data each returns (historical vs. current vs. detailed info), which helps reduce misselection.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with hyphens (e.g., get-market-history, list-markets). The naming is predictable and uniform across all four tools, making it easy for agents to understand the pattern and purpose at a glance.

    Tool Count3/5

    With only 4 tools, the server feels thin for a prediction market domain, which typically involves actions like creating markets, placing bets, or managing positions. While the tools cover data retrieval well, the lack of operational tools (e.g., trade, create-market) suggests the scope is limited, bordering on under-provisioned for the apparent purpose.

    Completeness2/5

    There are significant gaps in the tool surface for a prediction market server. The tools only support read-only operations (get and list), with no ability to interact with markets (e.g., trade, resolve, create). This will cause agent failures when trying to perform common actions in this domain, as the surface is severely incomplete for the stated purpose.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables 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
      -
    • A
      license
      B
      quality
      D
      maintenance
      Enables LLM agents to interact with Polymarket prediction markets, including market discovery, real-time pricing, analytics, account management, and trading with built-in safety guards.
      34
      MIT