Polymarket MCP Server

平台与服务

by joinquantish

Self-hosted MCP server for AI agent trading on Polymarket prediction markets

什么是 Polymarket MCP Server

Self-hosted MCP server for AI agent trading on Polymarket prediction markets

README

Polymarket MCP Server

⚠️ Notice: Quantish is winding down. The Quantish platform (quantish.live) is shutting down. This MCP server is self-hosted and will continue to work independently, but the Quantish team will no longer be maintaining or updating this project. If you're building in the prediction market space and need real-time data infrastructure, check out polynode.dev.

Self-hosted MCP server for trading on Polymarket prediction markets.

Overview

This package provides an MCP (Model Context Protocol) server that enables AI agents to trade on Polymarket prediction markets via the Polygon network.

Features

  • Full Polymarket Trading - Buy/sell on any Polymarket market
  • Polygon Wallet Management - Generate and manage wallets with Safe integration
  • Gasless Transactions - Most operations use Polymarket's relayer (no MATIC needed)
  • MCP Compatible - Works with Claude, Cursor, and any MCP client
  • Self-Hostable - Run on Railway, Fly.io, or any Node.js host

Quick Start

bash
git clone https://github.com/joinQuantish/polymarket-mcp
cd polymarket-mcp
npm install

Environment Variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string
ENCRYPTION_KEYYes32-byte hex string for wallet encryption
POLYGON_RPC_URLYesPolygon RPC endpoint
BOT_SIGNING_SECRETNoSecret for trusted bot HMAC authentication
PORTNoServer port (defaults to 3000)

Generate Encryption Keys

bash
# Generate ENCRYPTION_KEY (32 bytes = 64 hex chars)
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

# Generate BOT_SIGNING_SECRET (for trusted bot auth)
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Database Setup

Any PostgreSQL database works. Options:

ProviderNotes
RailwayAdd PostgreSQL service, copy DATABASE_URL from variables
SupabaseFree tier at supabase.com, copy connection string from Settings > Database
NeonServerless Postgres at neon.tech, free tier available
Local Dockerdocker run -e POSTGRES_PASSWORD=pass -p 5432:5432 postgres

Set your DATABASE_URL then run:

bash
# Generate Prisma client
npm run db:generate

# Create tables
npm run db:push

Running the Server

bash
# Development
npm run dev

# Production
npm run build
npm start

Available Tools

Account & Wallet

ToolDescription
request_api_keyCreate account with new wallet (or recover existing)
setup_walletDeploy Safe wallet and set approvals
get_wallet_statusCheck wallet deployment and approval status
get_balancesGet USDC/MATIC balances
get_deposit_addressesGet addresses for depositing (EVM, Solana, BTC)
export_private_keyExport wallet private key
import_private_keyImport existing wallet

Trading

ToolDescription
place_orderPlace buy/sell order
cancel_orderCancel an open order
cancel_all_ordersCancel all open orders
get_ordersGet order history
execute_atomic_ordersExecute multiple orders atomically
get_orderbookGet market bids/asks
get_priceGet market midpoint price

Positions

ToolDescription
get_positionsGet your positions
sync_positionsSync positions from Polymarket API
get_claimable_winningsCheck redeemable winnings
claim_winningsClaim resolved market winnings
get_onchain_sharesGet all ERC-1155 holdings (including gifted)

Transfers & Swaps

ToolDescription
transfer_usdcSend bridged USDC
transfer_native_usdcSend Circle native USDC
transfer_sharesSend ERC-1155 shares
send_maticSend MATIC from EOA
swap_tokensSwap tokens via LI.FI
get_swap_quoteGet swap quote

API Keys

ToolDescription
list_api_keysList your API keys
create_additional_api_keyCreate new API key
revoke_api_keyRevoke an API key

Note: Market search tools (search_markets, get_market, get_active_markets) are available via the Discovery MCP.

API Format

The server exposes a JSON-RPC 2.0 endpoint at /mcp:

bash
curl -X POST https://your-server.com/mcp \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "get_balances",
      "arguments": {}
    },
    "id": 1
  }'

MCP Client Configuration

Claude Desktop / Cursor

json
{
  "mcpServers": {
    "polymarket": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://your-server.com/mcp",
        "--header",
        "x-api-key: YOUR_API_KEY"
      ]
    }
  }
}

Security

Returning Users

For security, returning users (existing externalId) cannot get new API keys without authentication. Options:

  1. Use existing API key - If you have it saved
  2. HMAC Authentication (trusted bots only) - Sign with BOT_SIGNING_SECRET:
    code
    signature = HMAC-SHA256(externalId:timestamp, BOT_SIGNING_SECRET)
    
  3. New Account - Use a different externalId

Development

bash
# Install dependencies
npm install

# Generate Prisma client
npm run db:generate

# Run migrations
npm run db:push

# Start development server
npm run dev

Resources

License

This project is licensed under the PolyForm Noncommercial License 1.0.0.

Free for personal use, research, and non-commercial purposes. Commercial use requires explicit permission from Quantish Inc. Contact hello@quantish.live for commercial licensing.


Built by Quantish Inc.

常见问题

Polymarket MCP Server 是什么?

Self-hosted MCP server for AI agent trading on Polymarket prediction markets

相关 Skills

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描123.0k

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描123.0k

邮件模板

by alirezarezvani

Universal
热门

快速搭建生产可用的事务邮件系统:生成 React Email/MJML 模板,接入 Resend、Postmark、SendGrid 或 AWS SES,并支持本地预览、i18n、暗色模式、反垃圾优化与追踪埋点。

面向营销与服务场景,快速搭建高质量邮件模板,省去反复设计与切图成本,成熟度和社区认可都很高。

平台与服务
未扫描12.5k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
84.2k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
78.5k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
38.1k

评论