PO
OfficialSearch

Polymarket MCP Server Real-Time Market Prices

Monitor real-time prediction market prices with the MCP server, search markets, analyze prices, and spot trading opportunities on Polymarket.

Quick Install
npx -y @ozgureyilmaz/polymarket-mcp

Overview

The Polymarket MCP Server is a lightweight service for monitoring and searching real-time prediction market prices on Polymarket. It continuously ingests price updates, normalizes market metadata, and exposes search and streaming APIs so developer tools, dashboards, and trading bots can quickly find markets, analyze price movements, and identify trading opportunities.

Built for developers and data engineers, the MCP server is useful when you need low-latency market data without polling the public site. It centralizes price history, provides full-text market search, and supports realtime subscriptions so you can drive visualizations, alerts, and automated strategies against a consistent API.

Features

  • Real-time price ingestion and normalization for Polymarket markets
  • REST search API to find markets by title, tags, or category
  • WebSocket (or Server-Sent Events) stream for live price updates
  • Price history and simple time-series aggregation (candles, ticks)
  • Lightweight caching and pagination for efficient queries
  • Configurable thresholds and alert hooks for price movement detection
  • Docker-ready and environment-configurable for deployment

Installation / Configuration

Clone the repository and run locally, or use the provided Docker image.

  1. Clone and install (Node.js example)
git clone https://github.com/ozgureyilmaz/polymarket-mcp.git
cd polymarket-mcp
# install dependencies (npm or yarn)
npm install
npm run build
npm start
  1. Environment variables

Create a .env file or set environment variables as needed:

PORT=8080
POLYMARKET_API_URL=https://api.polymarket.com/graphql
INGEST_INTERVAL_MS=15000
CACHE_TTL_SECONDS=30
DATABASE_URL=postgres://user:pass@localhost:5432/polymarket
  1. Docker
# build
docker build -t polymarket-mcp .
# run
docker run -p 8080:8080 \
  -e POLYMARKET_API_URL=https://api.polymarket.com/graphql \
  -e PORT=8080 \
  polymarket-mcp

Note: Adjust INGEST_INTERVAL_MS and CACHE_TTL_SECONDS to tune freshness vs. API usage.

Available Resources

API endpoints (default base: http://localhost:8080)

MethodPathDescription
GET/healthHealth check
GET/markets/search?q={query}&limit=20Full-text search for markets
GET/markets/{marketId}Market metadata and current price
GET/markets/{marketId}/history?from=&to=&interval=1mPrice history (candles or ticks)
GET/prices/latestLatest prices for all cached markets (paginated)
WS/wsWebSocket endpoint for live price updates

Example search request:

curl 'http://localhost:8080/markets/search?q=inflation&limit=10'

Sample search response (JSON):

{
  "results": [
    {
      "id": "0xabc123",
      "title": "Will US inflation exceed 6% in 2024?",
      "category": "Economics",
      "lastPrice": 0.34,
      "24hChange": -0.02
    }
  ],
  "total": 1
}

WebSocket subscription example (wscat):

# install wscat (npm i -g wscat)
wscat -c ws://localhost:8080/ws
# Example subscription message:
{ "type": "subscribe", "markets": ["0xabc123", "0xdef456"] }
# Server will push:
{ "type": "price_update", "marketId": "0xabc123", "price": 0.352, "ts": 1650000000000 }

Use Cases

  • Market discovery dashboard

    • Use /markets/search to let users browse and filter markets by keywords, categories, or tags. Stream live prices through the WebSocket to update UI components with sub-second latency.
  • Arbitrage and trading signals

    • Run a continuous scan of /prices/latest combined with historical candles to detect sudden price divergences or cross-market patterns. Configure alert thresholds to trigger webhooks when opportunities appear.
  • Backtesting and analytics

    • Pull market history via /markets/{marketId}/history to compute indicators (moving averages, volatility) and validate strategies before committing capital.
  • Automated monitoring and notifications

    • Subscribe to specific markets on the WebSocket and forward large price movements to Slack, email, or a monitoring dashboard for traders and researchers.

Tips for Developers

  • Cache results on the client for infrequently changing metadata; only subscribe to WebSocket updates for price-sensitive workflows.
  • Use pagination on /prices/latest when scanning large lists to avoid memory spikes.
  • Honor rate limits for any upstream Polymarket APIs you configure; tune INGEST_INTERVAL_MS accordingly.

Repository and source code: https://github.com/ozgureyilmaz/polymarket-mcp

If you need schema details (OpenAPI or JSON schemas), check the repo’s docs/ or api/ directory for up-to-date contract definitions.

Tags:search