Skip to main content
Glama
Mavline

Polymarket Gamma MCP Server

by Mavline

Polymarket Gamma MCP Server

用于与 Polymarket Gamma Markets API 交互的 MCP 服务器——获取预测市场、事件和分析数据。

🚀 功能特性

📊 核心功能:

  • 热门市场 - 获取高交易量的热门市场

  • 市场搜索 - 在问题和描述中按文本搜索

  • 按类别筛选 - 按标签(Politics、Sports、Crypto)筛选市场

  • 市场详情 - 特定市场的完整信息

  • 事件 - 获取关联市场的事件

  • API 使用情况 - 跟踪请求使用量

🔧 技术特性:

  • 无需 API 密钥 - Gamma API 的公共访问

  • TypeScript - 严格类型化和数据验证

  • 重试逻辑 - 网络错误时自动重试

  • 格式化输出 - 以俄语方便地显示数据

  • 限制跟踪 - 监控 API 使用情况

Related MCP server: Polymarket MCP Server

📦 安装

# Клонировать и установить зависимости
npm install

# Собрать проект
npm run build

# Запустить тесты
npm test

🛠️ 可用工具

1. get_trending_markets

获取高交易量的热门市场。

参数:

  • limit(数字,默认值:20)- 市场数量

响应示例:

{
  "summary": "Найдено 5 трендовых рынков",
  "apiUsage": "4/1000 запросов использовано, 996 осталось",
  "markets": "1. Will Joe Biden get Coronavirus before the election?\n   💰 Объём: $32,257 | 💧 Ликвидность: $0\n   🏷️ Теги: US-current-affairs\n   📊 Цены: Yes: 0.0% | No: 0.0%",
  "rawData": [...]
}

2. get_markets_by_category

按类别/标签获取市场。

参数:

  • tags(字符串数组,必填)- 用于筛选的类别

  • limit(数字,默认值:50)- 市场数量

示例:

{
  "tags": ["Politics", "US Election"],
  "limit": 20
}

3. search_markets

按文本查询搜索市场。

参数:

  • query(字符串,必填)- 搜索查询

  • limit(数字,默认值:30)- 结果数量

4. get_market_details

获取特定市场的详细信息。

参数:

  • marketId(字符串,必填)- 市场 ID

5. get_events

获取关联市场的事件。

参数:

  • limit(数字,默认值:20)- 事件数量

  • active(布尔值,默认值:true)- 仅限活跃事件

  • orderBy(字符串)- 排序方式:volume、liquidity、endDate、createdAt

6. get_event_details

获取事件的详细信息。

参数:

  • eventId(字符串,必填)- 事件 ID

7. get_api_usage

获取 API 使用统计信息。

🔗 API 端点

服务器使用以下 Gamma API 端点:

  • GET /markets - 市场列表

  • GET /markets/{id} - 市场详情

  • GET /events - 事件列表

  • GET /events/{id} - 事件详情

基础 URL: https://gamma-api.polymarket.com

📊 数据结构

ProcessedMarket

{
  id: string;
  question: string;
  description?: string;
  outcomes: string[];
  prices: number[];
  volume: number;
  liquidity: number;
  endDate: string;
  tags: string[];
  active: boolean;
  closed: boolean;
  resolved: boolean;
  negRisk: boolean;
  spread?: number;
  slug: string;
  tokens: Array<{
    id: string;
    outcome: string;
    price: number;
    winner?: boolean;
  }>;
}

ProcessedEvent

{
  id: string;
  title: string;
  description?: string;
  slug: string;
  tags: string[];
  startDate?: string;
  endDate?: string;
  active: boolean;
  closed: boolean;
  volume?: number;
  liquidity?: number;
  marketsCount: number;
  topMarkets?: ProcessedMarket[];
}

🧪 测试

# Основные тесты
npm test

# Отладка API структуры
node test/debug-api.js

⚠️ 限制

  1. 公共 API - 无需密钥,但有合理限制

  2. 只读 - 无法下订单(需要 CLOB API)

  3. 简化搜索 - 暂不支持全文搜索

  4. 数据有延迟 - 非实时报价

🔄 与 Windsurf 集成

添加到 mcp_config.json:

{
  "mcpServers": {
    "polymarket-gamma": {
      "command": "node",
      "args": ["C:/Users/pavelk/Desktop/Projects/my_own/Bet/polymarket/mcp-servers/polymarket-gamma-server/dist/index.js"],
      "cwd": "C:/Users/pavelk/Desktop/Projects/my_own/Bet/polymarket/mcp-servers/polymarket-gamma-server"
    }
  }
}

📈 使用场景

该服务器非常适合:

  • 市场分析 - 研究趋势和交易量

  • 事件监控 - 跟踪新市场

  • 研究 - 收集数据用于分析

  • 机会筛选 - 寻找感兴趣的市场

如需实际交易,请使用单独的 CLOB MCP 服务器。

🚀 后续步骤

  1. ✅ Gamma API 服务器 - 已完成并测试

  2. 🔄 CLOB API 服务器 - 用于交易操作

  3. 🔄 WebSocket 服务器 - 用于实时数据

  4. 🔄 统一服务器 - 整合所有功能

Available Tools

8 tools
get_api_usageA

Get current API usage statistics and rate limits

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavioral traits. It implies a read-only operation via 'Get' but does not explicitly state safety, side effects, or any limits. It is adequate for a simple getter but lacks explicit reassurance beyond the verb.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no redundant words. It front-loads the action and resource, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter tool with no annotations or output schema, the description states the core functionality. However, it does not elaborate on the exact nature of the statistics or the structure of the response, which could be useful. It is mostly complete but leaves some ambiguity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so the description does not need to add parameter meaning. Baseline for 0 params is 4, and the description mentions 'statistics and rate limits' which hints at the data returned, not parameters. This is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Get') and clearly names the resource ('API usage statistics and rate limits'). It differentiates from sibling tools focused on market/event data, and the tool name reinforces the purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool relative to alternatives or any context about typical use cases (e.g., checking quota before requests). The description only states what it does, not when it should be invoked.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_event_detailsA

Get detailed information about a specific event by ID

ParametersJSON Schema
NameRequiredDescriptionDefault
eventIdYesUnique event ID

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description must carry the full burden of behavioral disclosure. It only states the action and does not mention that the operation is read-only, what happens if the event ID is invalid or not found, or any error behavior. While the name implies a read operation, the description lacks explicit transparency about side effects (or lack thereof).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence with zero filler. It front-loads the action and resource, making it instantly parseable. There is no wasted text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one required parameter, no nested objects, no output schema), the description is sufficient to convey the tool's purpose. It does not explain return format, but the absence of an output schema lowers the expectation. Overall, the description covers what is needed for this simple tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already fully describes the single parameter 'eventId' as 'Unique event ID' (100% coverage). The description does not add any additional meaning or usage details beyond the schema, so a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and the resource ('detailed information about a specific event') with the criterion 'by ID'. This distinguishes it from sibling tools like get_events (which lists events) and get_market_details (which focuses on markets).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the appropriate use case: when you have a specific event ID and need detailed information. It does not explicitly name alternatives or state 'use this instead of get_events', but the context is clear enough for an agent to infer when to invoke it. No exclusions are mentioned, but the guidance is adequate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_eventsB

Get events with their associated markets

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of events to return (default: 20)
activeNoFilter for active events only (default: true)
orderByNoSort events by field (default: volume)volume

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. The verb 'Get' implies a read-only operation, but the description does not explicitly state side effects, permissions, or any constraints. It is adequate but not detailed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that effectively communicates the core functionality without unnecessary words or preamble.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description explains that events come with associated markets, which provides some context. However, it does not mention return format, pagination, or any caveats. For a simple retrieval tool, it is moderately complete but could be more informative.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema covers all three parameters with descriptions (limit, active, orderBy), so coverage is 100%. The tool description adds no extra meaning beyond the schema, but the parameter descriptions are sufficient, so a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'events', with the additional detail of including 'associated markets', which distinguishes it from sibling tools like get_trending_markets or get_sports_events. It is specific enough to understand the tool's function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not mention when to use this tool versus alternatives. It lacks guidance on when this is preferred over other event-related tools, so the agent has to infer from the name and parameters.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_market_detailsB

Get detailed information about a specific market by ID

ParametersJSON Schema
NameRequiredDescriptionDefault
marketIdYesUnique market ID

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavior on its own. It only says 'detailed information' without specifying what fields are returned, whether the operation is read-only, or what happens for invalid IDs. The safety profile of a get operation is somewhat implied, but the burden is not fully met.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single clear sentence with no wasted words. It is front-loaded and immediately communicates the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and no annotations, the description's mention of 'detailed information' is vague. The agent is left without knowledge of the return structure or edge-case behavior, which matters for a tool that is meant to provide details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with 'Unique market ID' documenting the parameter. The description adds no extra meaning beyond echoing 'by ID', so it meets the baseline but does not enhance understanding of the parameter's format or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (get), the resource (detailed information about a market), and the specific scope (by ID). It distinguishes this tool from sibling tools like get_trending_markets or search_markets by emphasizing the ID-based lookup.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when a specific market ID is known and detailed information is needed, but it does not explicitly mention when not to use it or provide alternatives. No exclusions or comparisons to sibling tools are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_markets_by_categoryA

Get markets filtered by category/tags (Politics, Sports, Crypto, etc.)

ParametersJSON Schema
NameRequiredDescriptionDefault
tagsYesCategory tags to filter by (e.g., ["Politics", "US Election"])
limitNoNumber of markets to return (default: 50)

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It indicates a read operation ('Get') but does not disclose how the filtering works (e.g., match all vs any tags), return format, pagination, or sorting behavior. This leaves significant behavioral ambiguity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that immediately states the purpose. It wastes no words and is appropriately sized for a filtered-list tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

This is a low-complexity tool with full schema coverage for both parameters, so the core functionality is described. However, the lack of behavioral details (like tag matching semantics, return shape, or pagination) and the absence of annotations keep it from being fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already describes both parameters with 100% coverage, so the description adds little beyond example tags. The description's examples of categories (Politics, Sports, Crypto) give a flavor of valid values but do not add deeper meaning beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies a verb ('Get'), a resource ('markets'), and a specific filter dimension ('category/tags'). Examples of categories (Politics, Sports, Crypto) distinguish this tool from siblings like search_markets or get_trending_markets.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool should be used when filtering markets by category/tags, but it does not explicitly state when to prefer this over alternatives or when not to use it. No exclusions or alternative tool names are mentioned, leaving the usage context only implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_sports_eventsC

Получить спортивные события с Polymarket (ПРАВИЛЬНЫЕ параметры)

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoКоличество событий (default: 25)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full responsibility for behavioral disclosure, but it only says 'Get' implying a read operation. It does not mention auth requirements, rate limits, output format, or any side effects. The parenthetical about 'correct parameters' is vague and adds no behavioral clarity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one short sentence, front-loaded with the core purpose. However, the parenthetical '(CORRECT parameters)' is unclear and adds noise, slightly reducing clarity. Still, it is concise and to the point.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with one parameter and no output schema, but the description is minimal and does not explain what constitutes sports events, how they relate to other market tools, or what the response looks like. The ambiguous parenthetical further detracts from completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the single 'limit' parameter is described in the schema. The description adds no additional meaning beyond the schema, which is acceptable but does not enhance the agent's understanding of how the parameter behaves in context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves sports events from Polymarket, which is a specific verb+resource. However, it does not distinguish itself from sibling tools like get_events, and the parenthetical '(CORRECT parameters)' adds ambiguity rather than clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like get_events or search_markets. The description does not mention any context, prerequisites, or exclusions, leaving the agent without direction on tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_marketsA

Search markets by text query in question/description

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of results to return (default: 30)
queryYesSearch query text

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It adds a useful detail about searching within question/description fields, but it does not disclose any quirks, result ordering, pagination behavior, or whether it's a read-only operation. This is adequate but not thorough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that conveys the essential purpose without any fluff or repetition. It is front-loaded and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple search tool with only two parameters and no output schema, the description is sufficient. It explains what fields are searched and the schema covers the limit parameter. It does not need to enumerate return values since no output schema exists, and the tool's behavior is straightforward.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides 100% coverage for both `query` and `limit` with descriptive text. The description adds extra semantics by specifying that the search applies to 'question/description', which clarifies the scope of the query parameter beyond the schema's generic 'Search query text'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action ('Search'), the resource ('markets'), and the specific mechanism ('by text query in question/description'). This distinguishes it from sibling tools like get_markets_by_category or get_trending_markets, which retrieve markets through different criteria.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this tool is for free-text searching within market questions/descriptions, which provides clear context for when to use it. However, it does not explicitly mention alternatives or when not to use this tool, so it falls short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 8 tool updatesv1.0.0
    • First observedget_api_usage
    • First observedget_event_details
    • First observedget_events
    • First observedget_market_details
    • First observedget_markets_by_category
    • First observedget_sports_events
    • First observedget_trending_markets
    • First observedsearch_markets

TDQS

A3.7/5.0

Scored across 8 tools

Disambiguation4/5

Most tools are distinct: trending, category, search, details, events, event details, API usage. However, get_events and get_sports_events overlap somewhat, though the descriptions clarify sports is a subset. Search and category are clearly different. Overall, boundaries are mostly clear.

Naming Consistency5/5

All tools follow the consistent pattern of 'get_' + noun, with clear nouns like 'trending_markets', 'market_details', 'events', etc. No mixed conventions or unexpected verbs.

Tool Count5/5

8 tools are well-scoped for a read-only market data server. Each covers a distinct query type, and none feel redundant or excessive.

Completeness4/5

The surface covers market retrieval (trending, by category, search), market details, event listings and details, and API usage. Minor gaps like historical price data or market resolution info exist, but core read-only workflows are complete.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables access to Polymarket's prediction markets for analyzing market probabilities, trading activity, and event outcomes across politics, sports, crypto, and other categories through natural language queries.
    34 npm
    10
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables 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.
    34 npm
    6
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    Enables comprehensive read access to Polymarket prediction market data, including live prices, order books, and market statistics. It allows AI assistants to analyze events, search markets, and monitor real-time signals without requiring API keys or authentication.
    22
    1
    MIT
  • F
    license
    Not graded
    quality
    C
    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
    -