Skip to main content

Read-only Polymarket prediction market data for AI agents (MCP server).

Project description

Polymarket MCP

MCP server that exposes read-only Polymarket prediction market data to AI agents. Tools wrap Polymarket's public Gamma (market discovery) and Data (positions, portfolio, leaderboard) APIs. There is no CLOB integration — this server cannot place trades or read order books.

Tools

Tool Description
search_markets Search markets by title or description
get_market_details Full details for a single market (by slug or Polymarket URL)
get_user_positions Open positions for a wallet address
get_user_performance Portfolio value, P&L, volume, and leaderboard rank

All tools return markdown formatted for agent consumption. No API keys or wallet signing are required.

Requirements

  • Python 3.12+
  • uv (recommended) or Docker

Quick start

Clone the repo, install dependencies, and start the server:

git clone https://github.com/0xChron/polymarket-mcp.git
cd polymarket-mcp
uv sync
make run

The server listens on streamable HTTP at http://127.0.0.1:8000/mcp.

Verify it is running with the MCP Inspector:

make inspector

Connect the inspector to http://localhost:8000/mcp using the Streamable HTTP transport.

Connect from an MCP client

This server uses the streamable-http transport (not stdio). Start the server first, then point your client at the /mcp endpoint.

Cursor

Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project-scoped):

{
  "mcpServers": {
    "polymarket": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

Restart Cursor (or reload the window) after saving. The server must be running before the client connects.

Claude Desktop / other HTTP clients

Any MCP client that supports streamable HTTP can connect to the same URL. Refer to your client's documentation for remote server configuration.

Example agent prompts

Once connected, an agent can call tools naturally:

Docker

Build and run the container:

make build
docker run --rm -p 8000:8000 -e FASTMCP_HOST=0.0.0.0 polymarket-mcp

FASTMCP_HOST=0.0.0.0 is required so the server accepts connections from outside the container. Then connect your MCP client to http://localhost:8000/mcp.

Configuration

Optional environment variables override API endpoints and server settings:

Variable Default Description
GAMMA_URL https://gamma-api.polymarket.com Gamma API base URL
DATA_URL https://data-api.polymarket.com Data API base URL
DEFAULT_TIMEOUT 15 HTTP request timeout (seconds)
FASTMCP_HOST 127.0.0.1 Bind address (0.0.0.0 for Docker)
FASTMCP_PORT 8000 Listen port

Development

make run        # Start the server
make test       # Run tests
make inspector  # Open MCP Inspector
make build      # Build Docker image

See docs/PROJECT_KNOWLEDGE_BASE.md for architecture, conventions, and how to add new tools.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

0xchron_polymarket_mcp-0.1.1.tar.gz (45.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

0xchron_polymarket_mcp-0.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file 0xchron_polymarket_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: 0xchron_polymarket_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 45.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for 0xchron_polymarket_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 effb35f386d384fa02727d760c03492bcd7203967a359653b06901ad7a55fa9c
MD5 6ed08009ebf7cfa3c3a052931ac64a6a
BLAKE2b-256 8b9fff9422ffc26edee846ad1e004e2a2ef02bda1bfbadfb6c40778e2bf5b3ea

See more details on using hashes here.

File details

Details for the file 0xchron_polymarket_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: 0xchron_polymarket_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for 0xchron_polymarket_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6985f03d8f9c60887ae222f848626f569a96028b6f99bb8ab385e7dc57cf2f4a
MD5 45cd46a9211b9c8b4a857dca918b9500
BLAKE2b-256 62afc469090f965b9a6870c837ef0709f0ae229b64fdd5be53eeef8ae635ce3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page