PolyMarket MCP Server

PolyMarket MCP Server

启用与 PolyMarket API 的交互,以获取预测市场数据,例如市场信息、价格和历史数据,并具有强大的错误处理和速率限制管理。

Category
访问服务器

Tools

get-market-info

Get detailed information about a specific prediction market

list-markets

Get a list of prediction markets with optional filters

get-market-prices

Get current prices and trading information for a market

get-market-history

Get historical price and volume data for a market

README

PolyMarket MCP 服务器

smithery badge

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

特性

  • 实时预测市场数据,包含当前价格和概率
  • 详细的市场信息,包括类别、结算日期和描述
  • 历史价格和交易量数据,具有可自定义的时间范围(1天、7天、30天、全部)
  • 内置错误处理和速率限制管理
  • 清晰的数据格式,易于使用

安装

通过 Smithery 安装

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

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

Claude Desktop

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

<summary>开发/未发布服务器配置</summary>

    "mcpServers": {
        "polymarket-mcp": {
            "command": "uv",
            "args": [
            "--directory",
            "/Users/{INSERT_USER}/YOUR/PATH/TO/polymarket-mcp",
            "run",
            "polymarket-mcp" //或者 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 仓库中:

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 仓库中:uv run src/polymarket_mcp/server.py

可用工具

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

  • get-market-info: 获取有关特定预测市场的详细信息
  • list-markets: 列出可用的预测市场,并提供过滤选项
  • get-market-prices: 获取当前价格和交易信息
  • get-market-history: 获取历史价格和交易量数据

get-market-info

输入模式:

{
    "market_id": {
        "type": "string",
        "description": "市场 ID 或 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...
---

list-markets

输入模式:

{
    "status": {
        "type": "string",
        "description": "按市场状态过滤",
        "enum": ["open", "closed", "resolved"]
    },
    "limit": {
        "type": "integer",
        "description": "要返回的市场数量",
        "default": 10,
        "minimum": 1,
        "maximum": 100
    },
    "offset": {
        "type": "integer",
        "description": "要跳过的市场数量(用于分页)",
        "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
---

get-market-prices

输入模式:

{
    "market_id": {
        "type": "string",
        "description": "市场 ID 或 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%
---

get-market-history

输入模式:

{
    "market_id": {
        "type": "string",
        "description": "市场 ID 或 slug"
    },
    "timeframe": {
        "type": "string",
        "description": "历史数据的时间段",
        "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-core
  • python-dotenv>=1.0.0

贡献

欢迎贡献!请随时提交 Pull Request。对于重大更改,请先打开一个 issue 讨论您想要更改的内容。

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

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

官方
精选