Polymarket MCP Server

Polymarket MCP Server

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.

Category
访问服务器

README

<p align="center"> <img src="https://polymarket.com/icons/favicon-196x196.png" width="80" height="80" alt="Polymarket logo" /> </p>

<h1 align="center">polymarket-mcp</h1>

<p align="center"> <strong>A production-grade MCP server for <a href="https://polymarket.com">Polymarket</a> prediction markets.</strong><br/> Give Claude (or any MCP client) full read access to every public Polymarket API. </p>

<p align="center"> <a href="#quick-start"><img src="https://img.shields.io/badge/Get_Started-blue?style=for-the-badge" alt="Get Started" /></a>  <a href="https://www.npmjs.com/package/@yigit/polymarket-mcp"><img src="https://img.shields.io/npm/v/@yigit/polymarket-mcp?style=for-the-badge&logo=npm&color=cb3837" alt="npm" /></a>  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=for-the-badge" alt="MIT License" /></a>  <a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/MCP-compatible-8A2BE2?style=for-the-badge" alt="MCP Compatible" /></a> </p>


Why?

Prediction markets are the best real-time signal for what the world thinks will happen next. This server puts that signal directly into your AI assistant's toolkit — no API keys, no auth tokens, no setup hassle.

23 tools5 resources4 promptsZero configZero dependencies beyond the MCP SDK


Quick Start

Option 1: Claude Desktop

Add to your claude_desktop_config.json (Settings > Developer > Edit Config):

{
  "mcpServers": {
    "polymarket": {
      "command": "npx",
      "args": ["-y", "@yigit/polymarket-mcp"]
    }
  }
}

Restart Claude Desktop. Done.

Option 2: Claude Code

claude mcp add polymarket -- npx -y @yigit/polymarket-mcp

Option 3: Build from source

git clone https://github.com/yigitabi5444/yigit_polymarket_mcp.git
cd yigit_polymarket_mcp
npm install && npm run build
node dist/index.js  # runs over stdio

Then point your MCP client at the built binary:

{
  "mcpServers": {
    "polymarket": {
      "command": "node",
      "args": ["/absolute/path/to/yigit_polymarket_mcp/dist/index.js"]
    }
  }
}

What Can It Do?

Gamma API — Events & Markets

Tool What it does
get_events List/filter events — paginate, sort by volume/liquidity, filter by tag/status
get_event Single event by ID or slug
get_markets List/filter markets with rich filtering (volume, liquidity, dates, tags)
get_market Single market by ID or slug
search Full-text search across events, markets, and profiles
get_tags List all category tags
get_series List event series (grouped collections)
get_series_by_id Get a specific series by ID
get_sports List available sports
get_sports_teams List teams for a sport

CLOB API — Prices & Order Books

Tool What it does
get_price Current price for a token (buy/sell side)
get_midpoint Midpoint price (best bid + best ask / 2)
get_last_trade_price Last executed trade price
get_price_history Historical price time series (configurable interval + fidelity)
get_order_book Full bid/ask depth for a token
get_order_books Batch order books for multiple tokens
get_order_book_summary Best bid, best ask, and spread at a glance
get_clob_market CLOB market details by condition ID
get_sampling_markets Markets eligible for liquidity rewards
get_sampling_simplified_markets Simplified sampled markets
get_tick_size Minimum price increment for a token

Data API — Trades & Holders

Tool What it does
get_market_trades Recent trades for a market
get_market_holders Top holders / position breakdown for a market

Resources (URI-based access)

URI Pattern Description
market://slug/{slug} Market JSON by slug
event://slug/{slug} Event JSON by slug
market://condition/{id} CLOB market by condition ID
orderbook://token/{id} Live order book for a token
tags://all All category tags (cached)

Prompts (guided workflows)

Prompt Description
analyze_market Deep-dive: probability, liquidity, order book depth, top holders
compare_markets Side-by-side comparison of multiple markets
trending_markets Find the hottest markets by volume right now
sports_overview Overview of sports prediction markets

Architecture

┌─────────────────────────────┐
│        MCP Client           │
│  (Claude Desktop / Code)    │
└─────────┬───────────────────┘
          │ stdio (JSON-RPC)
┌─────────▼───────────────────┐
│      polymarket-mcp         │
│                             │
│  ┌──────────┐ ┌──────────┐  │
│  │  Tools   │ │Resources │  │
│  │ (22)     │ │  (5)     │  │
│  └────┬─────┘ └────┬─────┘  │
│       │             │        │
│  ┌────▼─────────────▼─────┐  │
│  │     API Client         │  │
│  │  ┌───────┐ ┌────────┐  │  │
│  │  │ Rate  │ │ Cache  │  │  │
│  │  │Limiter│ │ (TTL)  │  │  │
│  │  └───┬───┘ └───┬────┘  │  │
│  │      │         │       │  │
│  │  ┌───▼─────────▼────┐  │  │
│  │  │  Retry + Backoff │  │  │
│  │  └──────────────────┘  │  │
│  └────────────────────────┘  │
└──────────┬───────────────────┘
           │ HTTPS
┌──────────▼───────────────────┐
│     Polymarket APIs          │
│  gamma-api · clob · data-api │
└──────────────────────────────┘

Smart Defaults

List endpoints (get_markets, get_events) default to active=true, closed=false, order=volume descending — you get the hottest live markets out of the box, not ancient resolved ones from 2020. Override any default explicitly when you need historical data.

Clean Responses

Raw Polymarket API responses contain 50+ fields per market (including gems like pagerDutyNotificationEnabled and mailchimpTag). This server strips the noise and returns a curated subset. JSON-encoded strings like outcomes and outcomePrices are parsed into real arrays — ["Yes", "No"] not "[\"Yes\", \"No\"]".

Production Hardening

Feature Implementation
Rate limiting Token-bucket per API endpoint (Gamma: 4k/10s, CLOB: 9k/10s, Data: 1k/10s)
Caching In-memory TTL cache (order books: 5s, markets: 30s, tags: 5min)
Retries Exponential backoff with jitter on 429s and 5xx errors (3 retries max)
Timeouts 15s request timeout on all API calls
No auth Only hits public endpoints — zero secrets to manage
No deps Uses native fetch — no axios, no node-fetch, just the MCP SDK + Zod
Type safety Full TypeScript with strict mode, Zod validation on all inputs

Configuration

Environment Variable Default Description
POLYMARKET_CACHE_DISABLED false Set to true to disable all caching

That's it. No API keys, no tokens, no config files. It just works.


Development

npm install          # install dependencies
npm run build        # compile TypeScript
npm run dev          # run with tsx (auto-reload)
npm test             # run test suite
npm run test:watch   # tests in watch mode

Project Structure

src/
├── index.ts              # stdio entrypoint
├── server.ts             # MCP server factory
├── config.ts             # rate limits, cache TTLs, timeouts
├── api/
│   ├── client.ts         # HTTP client with retry + rate limiting
│   ├── cache.ts          # TTL cache implementation
│   ├── rate-limiter.ts   # token-bucket rate limiter
│   ├── gamma.ts          # Gamma API wrapper
│   ├── clob.ts           # CLOB API wrapper
│   └── data.ts           # Data API wrapper
├── tools/
│   ├── gamma/            # 6 Gamma tools
│   ├── clob/             # 4 CLOB tools
│   └── data/             # 2 Data tools
├── resources/            # 5 URI-based resources
├── prompts/              # 4 guided analysis prompts
└── types/                # TypeScript type definitions

Example Conversations

You: What are the hottest prediction markets right now?

Claude: uses get_markets sorted by volume, then get_order_book for depth analysis

You: What's the current probability that Bitcoin hits $200k this year?

Claude: uses search("bitcoin 200k"), then get_price for live odds

You: Compare the presidential election markets

Claude: uses the compare_markets prompt with relevant slugs

You: Show me the order book for the top sports market

Claude: uses get_sportsget_marketsget_order_book


Contributing

PRs welcome! Please:

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/awesome)
  3. Add tests for new functionality
  4. Make sure npm test passes
  5. Submit a PR

License

MIT — do whatever you want with it.


<p align="center"> <sub>Built with the <a href="https://modelcontextprotocol.io">Model Context Protocol</a></sub> </p>

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选