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:
- "Search Polymarket for active markets about Bitcoin ETFs"
- "Get details for https://polymarket.com/event/will-bitcoin-hit-100k"
- "Show open positions for wallet
0x…" - "What is the all-time P&L and leaderboard rank for
0x…?"
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.
Publishing to the MCP Registry
The MCP Registry hosts server metadata so clients can discover and install MCP servers. This project is set up for GitHub-based publishing under the name io.github.0xChron/polymarket-mcp.
1. Publish a package artifact
The registry stores metadata only — you must publish the server to a supported package registry first. Options:
PyPI (recommended for Python users):
- Ensure this README contains the ownership marker (already included above as an HTML comment).
- Publish to PyPI:
uv build && uv publish - Users can then run with
uvx 0xchron-polymarket-mcpafter the package is available.
Docker (OCI):
-
Push the image to a public registry (e.g. Docker Hub or GHCR).
-
Add the registry label to your image:
LABEL io.modelcontextprotocol.server.name="io.github.0xChron/polymarket-mcp"
2. Create server.json
Install the publisher CLI and generate a template:
brew install mcp-publisher
# or: curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher && sudo mv mcp-publisher /usr/local/bin/
mcp-publisher init
Edit server.json — example for a PyPI package with streamable HTTP:
{
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.0xChron/polymarket-mcp",
"description": "Read-only Polymarket prediction market data for AI agents.",
"repository": {
"url": "https://github.com/0xChron/polymarket-mcp",
"source": "github"
},
"version": "0.1.0",
"packages": [
{
"registryType": "pypi",
"registryBaseUrl": "https://pypi.org",
"identifier": "0xchron-polymarket-mcp",
"version": "0.1.0",
"runtimeHint": "uvx",
"transport": {
"type": "streamable-http",
"url": "http://localhost:8000/mcp"
}
}
]
}
For a Docker image, use "registryType": "oci" and set "identifier" to your image reference (e.g. ghcr.io/0xchron/polymarket-mcp:0.1.0).
The name in server.json must match the mcp-name in this README (PyPI) or the Docker label (OCI).
3. Authenticate and publish
mcp-publisher login github
mcp-publisher publish --dry-run # validate first
mcp-publisher publish
With GitHub auth, the server name must start with io.github.0xChron/. See the registry quickstart for full details.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file 0xchron_polymarket_mcp-0.1.0.tar.gz.
File metadata
- Download URL: 0xchron_polymarket_mcp-0.1.0.tar.gz
- Upload date:
- Size: 47.0 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6a53e0ad53a7ef7261e13bb61213eb290179ec0a1d9c8f10822e5a626c2c841
|
|
| MD5 |
27bc19d4df11bbad433ed470d685901e
|
|
| BLAKE2b-256 |
3e5ac813370f8219abd523df616768989865974ba4284306dd51e15ab14c39d9
|
File details
Details for the file 0xchron_polymarket_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: 0xchron_polymarket_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6eb4297efebeb3676349703b164954b775b7838600e46736c5e3d49b0ea3a702
|
|
| MD5 |
4d1a0465f2918a3bd58f2c0578edb054
|
|
| BLAKE2b-256 |
497201849c48cb9f159d4662cb39e880bed2a48721009442dcca519da942a693
|