Polymarket MCP Server
Polymarket MCP Server
⚠️ 注意:Quantish 正在逐步关闭。 Quantish 平台(quantish.live)即将停止运营。该 MCP 服务器是自托管的,仍可独立运行,但 Quantish 团队将不再维护或更新此项目。如果你正在预测市场领域进行开发,并且需要实时数据基础设施,可以看看 polynode.dev。
用于在 Polymarket 预测市场进行交易的自托管 MCP 服务器。
概述
该包提供了一个 MCP(模型上下文协议)服务器,使 AI 智能体能够通过 Polygon 网络在 Polymarket 预测市场进行交易。
Related MCP server: polymarket-mcp
功能
完整 Polymarket 交易 - 在任何 Polymarket 市场上买入/卖出
Polygon 钱包管理 - 通过 Safe 集成生成和管理钱包
无 Gas 交易 - 大多数操作使用 Polymarket 的中继器(无需 MATIC)
MCP 兼容 - 可与 Claude、Cursor 以及任何 MCP 客户端配合使用
可自托管 - 可在 Railway、Fly.io 或任何 Node.js 主机上运行
快速开始
git clone https://github.com/joinQuantish/polymarket-mcp
cd polymarket-mcp
npm install环境变量
变量 | 必需 | 描述 |
| 是 | PostgreSQL 连接字符串 |
| 是 | 用于钱包加密的 32 字节十六进制字符串 |
| 是 | Polygon RPC 端点 |
| 否 | 用于受信任机器人 HMAC 身份验证的密钥 |
| 否 | 服务器端口(默认为 3000) |
生成加密密钥
# 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'))"数据库设置
任何 PostgreSQL 数据库都可以使用。可选方案:
提供方 | 备注 |
Railway | 添加 PostgreSQL 服务,从变量中复制 |
Supabase | supabase.com 提供免费套餐,从 Settings > Database 复制连接字符串 |
Neon | neon.tech 提供无服务器 Postgres,有免费套餐 |
本地 Docker |
|
设置好 DATABASE_URL 后运行:
# Generate Prisma client
npm run db:generate
# Create tables
npm run db:push运行服务器
# Development
npm run dev
# Production
npm run build
npm start可用工具
账户与钱包
工具 | 描述 |
| 使用新钱包创建账户(或恢复现有账户) |
| 部署 Safe 钱包并设置授权 |
| 检查钱包部署和授权状态 |
| 获取 USDC/MATIC 余额 |
| 获取存款地址(EVM、Solana、BTC) |
| 导出钱包私钥 |
| 导入现有钱包 |
交易
工具 | 描述 |
| 下买单或卖单 |
| 取消挂单 |
| 取消所有挂单 |
| 获取订单历史 |
| 以原子方式执行多个订单 |
| 获取市场买盘/卖盘 |
| 获取市场中间价 |
持仓
工具 | 描述 |
| 获取你的持仓 |
| 从 Polymarket API 同步持仓 |
| 检查可领取的奖金 |
| 领取已结算市场的奖金 |
| 获取所有 ERC-1155 持仓(包括赠送的) |
转账与兑换
工具 | 描述 |
| 发送桥接 USDC |
| 发送 Circle 原生 USDC |
| 发送 ERC-1155 份额 |
| 从 EOA 发送 MATIC |
| 通过 LI.FI 兑换代币 |
| 获取兑换报价 |
API 密钥
工具 | 描述 |
| 列出你的 API 密钥 |
| 创建新的 API 密钥 |
| 撤销 API 密钥 |
注意: 市场搜索工具(
search_markets、get_market、get_active_markets)可通过 Discovery MCP 使用。
API 格式
服务器在 /mcp 上提供 JSON-RPC 2.0 端点:
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 客户端配置
Claude Desktop / Cursor
{
"mcpServers": {
"polymarket": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://your-server.com/mcp",
"--header",
"x-api-key: YOUR_API_KEY"
]
}
}
}安全
老用户
出于安全原因,老用户(已有 externalId)在未通过身份验证的情况下无法获取新的 API 密钥。可选方案:
使用现有 API 密钥 - 如果你已保存
HMAC 身份验证(仅限受信任的机器人)- 使用
BOT_SIGNING_SECRET签名:signature = HMAC-SHA256(externalId:timestamp, BOT_SIGNING_SECRET)新账户 - 使用不同的
externalId
开发
# Install dependencies
npm install
# Generate Prisma client
npm run db:generate
# Run migrations
npm run db:push
# Start development server
npm run dev资源
GitHub:joinQuantish/polymarket-mcp
Discovery MCP:joinQuantish/quantish-discovery
Polymarket 文档:docs.polymarket.com
许可证
本项目采用 PolyForm Noncommercial License 1.0.0 授权。
免费供个人使用、研究和非商业用途。 商业用途需获得 Quantish Inc. 的明确许可。如需商业授权,请联系 hello@quantish.live。
由 Quantish Inc. 构建
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceAn MCP server that gives AI agents direct access to Polymarket Crypto prediction markets, enriched with live spot prices. Discover markets, analyze order books, paper trade strategies, track activity, and execute live trades — all through natural language.1AGPL 3.0
- Alicense-qualityBmaintenanceAn MCP server and Python toolkit that provides AI agents with real-time tools for Polymarket prediction markets, including liquidity scanning, arbitrage detection, and slippage estimation. It also offers advanced wallet intelligence, portfolio risk calculation, and probabilistic reasoning to enhance market analysis and strategy.1MIT
- AlicenseCqualityBmaintenanceMCP server that provides a unified prediction market API for multiple venues like Polymarket and Kalshi, allowing AI agents to discover markets, fetch order books, and execute trades through a single interface.324388MIT
- Alicense-qualityCmaintenanceAgent-native, self-hosted MCP server for crypto trading and DeFi management. Enables agents to query balances, execute trades, and manage positions with a policy engine and secure key storage.7Apache 2.0
Related MCP Connectors
No-KYC managed MCP for AI agents: sandboxed TypeScript trading SDK, isolated sub-accounts, futures.
HiveCapital MCP Server — autonomous investment layer for AI agents
Polymarket + Hyperliquid + macro for AI agents. 38 tools, signal backtest, SSE streaming. Free tier.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/joinQuantish/polymarket-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server