Polymarket MCP Server

Polymarket MCP Server

Enables AI agents to browse, search, and trade on Polymarket prediction markets, including viewing markets, order books, balances, and placing/canceling orders.

Category
Visit Server

README

@c0pilot/mcp-polymarket

MCP (Model Context Protocol) server and client library for Polymarket prediction markets.

npm version

Features

  • MCP Server: Run as a standalone MCP server for AI agents
  • Client Library: Import and use in your own projects
  • Browse and search prediction markets
  • View order books and market prices
  • Check wallet balance and positions
  • Place and cancel orders
  • Full integration with Polymarket's CLOB API

Installation

npm install @c0pilot/mcp-polymarket

Usage

As MCP Server

With Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "polymarket": {
      "command": "npx",
      "args": ["mcp-polymarket"],
      "env": {
        "POLYMARKET_PRIVATE_KEY": "0x...",
        "POLYMARKET_FUNDER": "0x..."
      }
    }
  }
}

Standalone

export POLYMARKET_PRIVATE_KEY="0x..."
export POLYMARKET_FUNDER="0x..."
npx mcp-polymarket

As Library

import { ClobClientWrapper } from 'mcp-polymarket/client';
import { createConfig } from 'mcp-polymarket/config';

// Create config
const config = createConfig({
  privateKey: '0x...',
  funder: '0x...',      // optional
  readonly: false,       // optional
});

// Initialize client
const client = new ClobClientWrapper(config);
await client.initialize();

// Use the client
const clobClient = client.getClient();
const orderbook = await clobClient.getOrderBook(tokenId);

Configuration

Environment Variables

Variable Required Default Description
POLYMARKET_PRIVATE_KEY Yes - Wallet private key for signing
POLYMARKET_FUNDER No derived Proxy wallet address
POLYMARKET_API_KEY No derived API key (auto-derived if not set)
POLYMARKET_API_SECRET No derived API secret (auto-derived if not set)
POLYMARKET_PASSPHRASE No derived API passphrase (auto-derived if not set)
POLYMARKET_CHAIN_ID No 137 Polygon mainnet
POLYMARKET_READONLY No false Disable trading tools

Finding Your Funder Address

Your "funder" is your Polymarket proxy wallet - the address shown on polymarket.com when logged in. If you deposited through Polymarket's UI, funds are in this proxy wallet.

Available MCP Tools

Read-Only

Tool Description
polymarket_get_markets List active prediction markets
polymarket_get_market Get details for a specific market
polymarket_get_orderbook View order book for a token
polymarket_get_balance Check wallet USDC balance
polymarket_get_positions View open orders and positions
polymarket_get_trades Get recent trade history

Trading

Tool Description
polymarket_place_order Place a limit order (BUY/SELL)
polymarket_cancel_order Cancel an open order

API Exports

// Main MCP server entry
import mcp from '@c0pilot/mcp-polymarket';

// Client wrapper for Polymarket CLOB
import { ClobClientWrapper } from '@c0pilot/mcp-polymarket/client';

// Configuration utilities
import { createConfig, getConfig, Config } from '@c0pilot/mcp-polymarket/config';

// Type definitions
import { MarketInfo, OrderbookInfo, Position } from '@c0pilot/mcp-polymarket/types';

Security

  • Private keys are never logged
  • Use POLYMARKET_READONLY=true for safe exploration
  • API credentials auto-derived from private key
  • Input validation on all parameters

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Run E2E tests (requires env vars)
npm run test:e2e

Related

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured