polymarket-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@polymarket-mcp Find active markets about the Fed rate decision"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
polymarket-mcp
AI-agent ready FastMCP server for Polymarket market discovery, wallet analytics, and public CLOB data.
polymarket-mcp gives MCP clients a typed, read-only interface for asking questions like:
"Find active markets about inflation and summarize liquidity."
"Inspect this wallet's current positions and recent activity."
"Compare order book depth, midpoint, and spread for these outcome tokens."
"Pull historical prices so an agent can reason about market movement."
This project is intentionally read-only in 0.1.x. It does not place trades, sign orders, manage keys, or require wallet credentials.
Package identities
Purpose | Value |
PyPI distribution |
|
Python package |
|
CLI command |
|
Docs |
Related MCP server: polymarket-mcp
Why agents use it
Typed outputs reduce brittle prompt parsing and normalize inconsistent upstream JSON.
Tool docstrings are written for LLM routing, so agents can choose the right surface quickly.
Namespaces keep workflows clear:
gammafor discovery,datafor wallets,clobfor live market microstructure.Real MCP end-to-end tests exercise both in-process client sessions and subprocess stdio transport.
No authenticated trading actions are exposed, which keeps exploratory agents inside a safer read-only boundary.
Agent workflow
flowchart LR
Agent["AI agent / MCP client"] --> MCP["polymarket-mcp"]
MCP --> Gamma["gamma: discover markets and events"]
MCP --> Data["data: inspect wallets and trades"]
MCP --> Clob["clob: read books, quotes, history"]
Gamma --> GAPI["Gamma API"]
Data --> DAPI["Data API"]
Clob --> CAPI["Public CLOB API"]Tool surfaces
Surface | Agent job | Example outputs |
| discover and inspect markets/events | market metadata, event details, tags |
| analyze public wallet behavior | positions, activity, trades |
| reason about live prices and liquidity | books, quotes, midpoint, spread, history |
Install
pip install polymarket-mcp-server
polymarket-mcpRun ephemerally with uvx:
uvx --from polymarket-mcp-server polymarket-mcpMCP client config
Use this stdio entry in an MCP client configuration:
{
"mcpServers": {
"polymarket": {
"command": "uvx",
"args": ["--from", "polymarket-mcp-server", "polymarket-mcp"]
}
}
}Local development
This repository uses PDM.
pdm install -G dev
pdm install -G docs
pdm run mcp-inspect # inspect the composed MCP surface
pdm run mcp-run # run the stdio MCP server
pdm run test # run pytest
pdm run test-mcp # run real MCP client/server e2e tests
pdm run all # tests + strict docs + MCP inspectRun the package entrypoint directly:
pdm run python -m polymarket_mcp.serverSafety model
polymarket-mcp is built for research, monitoring, and agent reasoning over public data. It intentionally excludes:
private key handling
authenticated trading
order placement or cancellation
wallet mutation
custody or signing flows
If you build a trading layer on top, keep it separate from this read-only server and require explicit human authorization.
Project layout
src/polymarket_mcp/
models/ Pydantic domain and tool I/O models
services/ upstream API normalization layers
servers/ FastMCP tool and resource surfaces
server.py composed parent MCP server
tests/ unit and MCP end-to-end coverage
docs/ Sphinx documentationDocumentation
Hosted docs: https://polymarket-mcp.readthedocs.io/en/latest/
Docs source:
docs/using native Sphinx reStructuredTextLocal build:
pdm run docsLocal preview:
pdm run docs-serve
Release notes
Releases publish from Git tags through GitHub Actions trusted publishing. PyPI trusted publishing is configured for pr1m8/polymarket-mcp, workflow release.yml, environment pypi.
Available Tools
22 toolsclob_get_bookA
Fetch the current order book for one token.
Use this tool when the user wants live market microstructure such as bids, asks, depth, spread, or liquidity around the current price.
Prefer this tool over get_price when depth matters, not just the current
quote. Do not use this tool for market discovery; Gamma tools are better
for finding the right market or token first.
The input should be a single CLOB token ID, not a market slug or wallet address. A common next step is to summarize book depth or compare books across multiple tokens.
Inputs: args (required). Returns: Tool output for one order book.
clob_get_booksA
Fetch current order books for multiple tokens.
Use this tool when the user wants to compare liquidity or depth across several known tokens at once.
Prefer this tool over repeated single-token lookups when you already know multiple token IDs. Do not use this tool if you still need to identify which market or token is relevant.
The input should be a list of CLOB token IDs. A common next step is to rank the returned books by spread, depth, or visible liquidity.
Inputs: args (required). Returns: result
clob_get_midpointA
Fetch the midpoint for one token.
Use this tool when the user specifically wants the midpoint rather than a full order book or generic quote.
Prefer this tool when reasoning about fair value between best bid and best
ask. If depth matters too, use get_book instead.
The input should be a single CLOB token ID.
Inputs: args (required). Returns: Tool output for one price quote.
clob_get_priceA
Fetch a current price quote for one token.
Use this tool when the user wants the current quoted price or implied level for a known token but does not need the full order book.
Prefer this tool over get_book when a lightweight spot quote is enough.
Prefer get_midpoint or get_spread when the question is specifically
about those metrics.
The input should be a single CLOB token ID. A common next step is to compare the quote with historical prices or fetch the full book.
Inputs: args (required). Returns: Tool output for one price quote.
clob_get_price_historyA
Fetch historical price points for one token.
Use this tool when the user wants trend, momentum, or time-series context for a known token.
Prefer this tool over get_price when the question is about change over
time rather than the current quote. Do not use this tool if the token ID is
not yet known; use Gamma discovery first.
The input should be a single CLOB token ID plus an interval and optional time bounds. A common next step is to summarize the trend or compare recent history with the current quote or spread.
Inputs: args (required). Returns: Tool output for historical prices.
clob_get_pricesA
Fetch current price quotes for multiple tokens.
Use this tool when the user wants a quick multi-token quote snapshot without needing full order books for each token.
Prefer this tool over repeated single-token quote calls when several token IDs are already known. Do not use this tool for discovery or wallet-level analysis.
The input should be a list of CLOB token IDs. A common next step is to rank
tokens by price or follow up with get_book on the most interesting ones.
Inputs: args (required). Returns: Tool output for multiple price quotes.
clob_get_spreadA
Fetch the spread for one token.
Use this tool when the user specifically wants transaction tightness, execution quality hints, or a quick liquidity proxy.
Prefer this tool over get_book when only the spread is needed. If the
user wants depth and book shape too, use get_book.
The input should be a single CLOB token ID.
Inputs: args (required). Returns: Tool output for one price quote.
data_get_activityA
Fetch recent activity for one wallet.
Use this tool when the user wants to know what a wallet has been doing recently, including buying, selling, or other account-level actions.
Prefer this tool over get_positions when the question is about recent
behavior rather than current holdings. Prefer get_trades when the user
specifically wants trade rows rather than broader account activity.
The input should be a wallet address, typically in 0x... format. A
common next step is to inspect affected markets through Gamma or CLOB tools.
Inputs: args (required). Returns: Tool output for wallet activity.
data_get_closed_positionsA
Fetch closed positions for one wallet.
Use this tool when the user wants completed or no-longer-open positions, such as reviewing realized exposure or prior bets.
Prefer this tool over get_positions when historical closed exposure is
specifically requested. A common next step is get_activity or
get_trades to explain how the wallet entered and exited those markets.
The input should be a wallet address, typically in 0x... format.
Inputs: args (required). Returns: Tool output for current or closed wallet positions.
data_get_positionsA
Fetch current positions for one wallet.
Use this tool when the user wants to know what a wallet currently holds, which markets it is exposed to, or its current directional footprint.
Prefer this tool over get_activity when the question is about present
state rather than historical actions. Do not use this tool if you still
need to discover which market exists; that belongs to Gamma tools.
The input should be a wallet address, typically in 0x... format. A
common next step is get_activity for recent changes or CLOB/Gamma tools
for deeper inspection of the markets referenced by the positions.
Inputs: args (required). Returns: Tool output for current or closed wallet positions.
data_get_tradesA
Fetch trade rows for a wallet or market filter.
Use this tool when the user wants trade-level records rather than current holdings or general wallet activity. This is useful for detailed flow analysis and execution history.
Prefer this tool over get_activity when exact trade rows matter. Prefer
Gamma tools when you still need to discover the right market first.
The input can include a wallet address, a market filter, or both, depending on what the user already knows. A common next step is to summarize the trade flow or compare it with current positions.
Inputs: args (required). Returns: Tool output for trade queries.
gamma_get_event_by_slugA
Fetch one canonical event by its slug.
Use this tool when you already know the event slug and want the full event-level context, including any nested markets returned by Gamma.
Prefer this tool when the question is about an event grouping rather than a
single market. If you only know the topic in natural language, use
search_public or list_events first.
The slug should be the event slug string from the Polymarket URL path, not the full URL. This tool is especially helpful for finding all related markets under one event before selecting a specific market for deeper analysis.
Inputs: slug (required). Returns: Tool output for a single event lookup. Args: event: The normalized event payloa…
gamma_get_market_by_slugA
Fetch one canonical market by its slug.
Use this tool when you already know the exact market slug and want the clearest single-market lookup. This is the preferred tool after a search step has identified the correct market.
Do not use this tool for broad discovery across a topic; use
search_public or list_markets first in that case. The slug should
be the market slug string from the Polymarket URL path, not the full URL.
This tool is often followed by CLOB book or price lookups if you want live market state, or by event lookup if you want the parent event context.
Inputs: slug (required). Returns: Tool output for a single market lookup. Args: market: The normalized market pay…
gamma_list_eventsA
List or filter event groups that contain one or more markets.
Use this tool when you want broader event-level discovery rather than individual market-level discovery. Events often provide better context for finding clusters of related markets under one theme.
Prefer this tool over list_markets when the user asks about a broader
topic and you want grouped context first. Prefer get_event_by_slug when
you already know the exact event slug.
Event results may include nested market objects, which makes this tool a good starting point for collecting related market slugs and token IDs.
Inputs: args (required). Returns: Tool output for Gamma event listing. Args: events: Matching normalized events.…
gamma_list_marketsA
List or filter markets when you already have structured constraints.
Use this tool when you want market discovery with explicit filters such as active-only results, a tag ID, a series slug, or an exact slug. This is more structured than free-text search.
Prefer this tool over search_public when you already know the filtering
dimension. Prefer get_market_by_slug when you already know the exact
market slug and want a single canonical result.
A slug should be the Polymarket slug string from the URL, not the full URL
itself. This tool returns normalized market objects that may include
clob_token_ids for later live-price lookups in the CLOB server.
Inputs: args (required). Returns: Tool output for public Gamma search. Args: query: Original search query. market…
gamma_list_seriesA
List available series metadata for structured discovery.
Use this tool when the user refers to a known series or recurring grouping and you need series metadata before filtering markets with a series slug.
Prefer this tool when discovery is series-oriented rather than free-text
topic-oriented. For general search, use search_public instead.
Args: None.
Returns: list[dict[str, object]]: Raw series payloads from Gamma.
Raises: httpx.HTTPError: If the upstream Gamma request fails.
Examples: .. code-block:: python
series = await list_series()Inputs: no named parameters. Returns: result
gamma_list_sportsA
List sports metadata for sports-related discovery flows.
Use this tool when the user is exploring sports markets and you need sport metadata before narrowing to teams, events, or markets.
Prefer this tool when the question is explicitly sports-oriented. For a
direct market/topic search, search_public is usually a faster first
step.
Args: None.
Returns: list[dict[str, object]]: Raw sports payloads from Gamma.
Raises: httpx.HTTPError: If the upstream Gamma request fails.
Examples: .. code-block:: python
sports = await list_sports()Inputs: no named parameters. Returns: result
gamma_list_tagsA
List available discovery tags for category-based exploration.
Use this tool when you need category metadata such as politics, crypto, or sports-style groupings and want to drive a later structured market query.
Prefer this tool before list_markets when the user wants markets from a
category but you do not yet know the numeric tag identifier. Once the tag
is known, switch to a structured market listing tool.
Args: None.
Returns: list[dict[str, object]]: Raw tag payloads from Gamma.
Raises: httpx.HTTPError: If the upstream Gamma request fails.
Examples: .. code-block:: python
tags = await list_tags()Inputs: no named parameters. Returns: result
gamma_list_teamsA
List team metadata for sports-market exploration.
Use this tool when a sports workflow needs team-level metadata before finding related events or markets.
Prefer this tool after identifying a sport or when the user explicitly asks about teams. For non-sports discovery, use other Gamma tools instead.
Args: None.
Returns: list[dict[str, object]]: Raw team payloads from Gamma.
Raises: httpx.HTTPError: If the upstream Gamma request fails.
Examples: .. code-block:: python
teams = await list_teams()Inputs: no named parameters. Returns: result
gamma_search_publicA
Search Polymarket discovery data by free-text topic.
Use this tool when you know a topic or phrase but do not yet know the exact market slug. This is the best first step for queries like "Fed decision", "NBA finals", or "election odds".
Prefer this tool over get_market_by_slug when you only have a natural
language description. Prefer list_markets when you already have a more
structured filter such as a known tag or exact slug.
The query should be plain human text, not a full URL. The result
returns normalized markets that can be followed up with
get_market_by_slug for a more precise single-market lookup. If you need
live pricing or the order book next, use the CLOB public server after you
obtain the market's token IDs.
Inputs: args (required). Returns: Tool output for public Gamma search. Args: query: Original search query. market…
list_resourcesARead-only
List all available resources and resource templates.
Returns JSON with resource metadata. Static resources have a 'uri' field, while templates have a 'uri_template' field with placeholders like {name}.
Inputs: no named parameters. Returns: result
read_resourceARead-only
Read a resource by its URI.
For static resources, provide the exact URI. For templated resources, provide the URI with template parameters filled in.
Returns the resource content as a string. Binary content is base64-encoded.
Inputs: uri (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Tools are clearly separated by prefixes (clob_, data_, gamma_) and each has a distinct purpose. Even similar sounding tools like clob_get_price, clob_get_midpoint, and clob_get_spread have well-defined differences described in their help text.
All tools follow a consistent snake_case pattern with a domain prefix and verb_noun structure (e.g., clob_get_book, data_get_positions, gamma_list_events). The only exceptions are the standard MCP resources tools which are minor and acceptable.
With 22 tools, the count is slightly above the typical 3-15 range but is justified by the need to cover market discovery (Gamma), live pricing (CLOB), and user data (Data). The set feels well-scoped for a comprehensive data-oriented MCP server.
The tools cover market discovery, live order book data, price history, and user positions/activity/trades thoroughly. However, there are no write operations such as placing orders or creating markets, which may be intentional but leaves a gap for trading workflows.
Maintenance
Related MCP Connectors
Historical tick, order book and settlement data for Polymarket and Predict.fun crypto up/down markets, plus smart-money lists and backtest quotes, over a read-only MCP server.
Polymarket in your AI: market rules, real fill costs, who is trading, top traders. Read-only.
Read-only Polymarket search, market details, order books, price history, and market cards.
Polymarket MCP — prediction-market data via Gamma + CLOB + Data public APIs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceRead-only MCP server for investigating Polymarket wallets, markets, and cross-wallet patterns using 21 tools backed by public APIs and an optional SQLite cache.MIT
- AlicenseAqualityCmaintenanceA read-only MCP server exposing Polymarket's public prediction-market data. Search markets, read live odds and order books, pull historical probability time-series, and inspect public wallet positions.14MIT
- AlicenseBqualityCmaintenanceMCP server for Polymarket prediction markets enabling query of markets, events, narratives, arbitrage, and more via MCP or HTTP.91MIT
- AlicenseBqualityDmaintenanceMCP server to query Polymarket prediction market data via The Graph subgraphs and REST APIs, enabling AI agents to search markets, get live prices, order books, on-chain analytics, and trader profiles.32MIT