[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-76288":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":10,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},76288,"polymarket-mcp-server","japp-fi\u002Fpolymarket-mcp-server","japp-fi","polymarket mcp server market discovery and analysis via public APIs; optional authenticated trading and portfolio tools when your wallet derives (or supplies) CLOB L2 credentials polymarket mcp server market discovery and analysis via public APIs; optional authenticated trading and portfolio tools when your wallet derives (or supplies) CLOB L2","",null,"TypeScript",142,2959,101,0,51,10,false,"main",true,[22,23,24,5],"mcp-server","mcp-servers","polymarket","2026-06-12 02:03:41","# Polymarket MCP Server\n\nModel Context Protocol (MCP) server for [**Polymarket**](https:\u002F\u002Fpolymarket.com): market discovery and analysis via public APIs; optional authenticated trading and portfolio tools when your wallet derives (or supplies) CLOB L2 credentials.\n\nRequires **Node.js 18+**.\n\n## Features\n\n| Area | Requires L2 \u002F wallet |\n|------|----------------------|\n| **Resources** (`polymarket:\u002F\u002Fstatus`, `polymarket:\u002F\u002Fconfig`, `polymarket:\u002F\u002Frate-limits`) | Partial (status reflects auth) |\n| **Market discovery** (search, trending, categories, …) | No |\n| **Market analysis** (order book, prices, volume, …) | No (some calls use anonymous CLOB) |\n| **Trading** (place\u002Fcancel orders, smart trade, …) | Yes |\n| **Portfolio** (positions, PnL, history, …) | Yes |\n| **Realtime WebSocket subscriptions** | User streams need API credentials + auth |\n\nTrading and portfolio handlers are registered only after the CLOB client has L2 credentials (derived from your signing key via `deriveApiKey` with a **`createApiKey` fallback**, or supplied manually — see below).\n\nThis codebase does **not** bundle [`@jsr\u002Fhk__polymarket`](https:\u002F\u002Fjsr.io) or `fastmcp`; Gamma\u002FData API flows use plain HTTP like the rest of the server.\n\nFeature parity additions inspired by `@iqai\u002Fmcp-polymarket` include: **`POLYGON_RPC_URL`**, **`POLYMARKET_PRIVATE_KEY`** (alias), **`CHAIN_ID`** \u002F **`CLOB_API_BASE`**, **`POLYMARKET_FUNDER`** \u002F **`FUNDER_ADDRESS`**, **`SIGNATURE_TYPE`** (defaults to GNOSIS-safe style when a funder is set), Gamma tools (`get_market_by_slug`, `get_event_by_slug`, `gamma_public_search`, tag listing, paginated markets), **`get_positions`** (Data API), CLOB **`get_balance_allowance` \u002F `update_balance_allowance`**, **`place_limit_order_token` \u002F `place_market_order_token`**, **`approve_allowances`**, **`redeem_positions`**, optional **approval checks** before mutating trades, and **NegRisk-aware** Polygon contract addresses.\n\n## Setup\n\nFrom the repo root:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fjapp-fi\u002Fpolymarket-mcp-server\ncd polymarket-mcp-server\n```\n\n```bash\nnpm install\nnpm run build\n```\n\nDevelopment (TypeScript directly):\n\n```bash\nnpm run dev\n```\n\nProduction (compiled):\n\n```bash\nnpm start\n```\n\n## Configuration\n\nThe server reads environment variables via [`dotenv`](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fdotenv) (place a `.env` file in the working directory).\n\n### `.env.example`\n\nCopy `.env.example` to `.env` and fill in values. **Never commit real keys.**\n\n### Modes\n\n1. **`DEMO_MODE=true`** skips a funded wallet. Gamma\u002FData discovery (including **`get_positions`**) remains available unless a tool explicitly needs credentials.\n\n2. **Live trading**\n\n   Provide **`POLYGON_ADDRESS`** plus **`POLYGON_PRIVATE_KEY`** (or **`POLYMARKET_PRIVATE_KEY`**, IQAI-compatible alias). Optionally set **`POLYGON_RPC_URL`** (defaults `https:\u002F\u002Fpolygon-rpc.com`) for on-chain `approve_allowances` \u002F `redeem_positions`.\n\n### Proxy wallets (IQAI-style)\n\nBrowser-wallet users commonly fund a **Polymarket proxy \u002F Safe** separately from the EIP-1193 signer. Mirror their env:\n\n- **`POLYMARKET_FUNDER` or `FUNDER_ADDRESS`** – USDC custodian address shown in the Polymarket UI (`0x…`)\n- **`SIGNATURE_TYPE`** – `2` selects `POLY_GNOSIS_SAFE` ordering (the default whenever a non-empty `POLYMARKET_FUNDER` is present). Use `1` (`POLY_PROXY`) for Magic-email flows.\n\n### Environment reference (extras)\n\n| Variable | Meaning |\n|---------|---------|\n| `POLYGON_RPC_URL` | JSON-RPC endpoint for Polygon (on-chain tooling + faster reads) |\n| `POLYMARKET_PRIVATE_KEY` | Alias of `POLYGON_PRIVATE_KEY` |\n| `CHAIN_ID` | Overrides `POLYMARKET_CHAIN_ID` when supplied |\n| `CLOB_API_BASE` | Overrides \u002F fills `CLOB_API_URL` (IQAI spelling) |\n\n### Explicit CLOB API credentials (optional)\n\nPolymarket’s `ApiKeyCreds` have **three separate** fields: `key`, `secret`, and `passphrase`. Set:\n\n| Variable | Maps to |\n|----------|---------|\n| `POLYMARKET_API_KEY` | API key (`key`) |\n| `POLYMARKET_SECRET` | HMAC secret (`secret`) |\n| `POLYMARKET_PASSPHRASE` | Passphrase (`passphrase`) |\n\nIf you previously used `POLYMARKET_API_KEY_NAME` as the key string, you can still set only that (with `POLYMARKET_API_KEY` empty) — it is treated as an alias for `key`. You **must** also set `POLYMARKET_SECRET` and `POLYMARKET_PASSPHRASE`; the secret and passphrase are not interchangeable.\n\nIf any of the three are missing, the server falls back to **derive** from the wallet (recommended in the [official CLOB client README](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@polymarket\u002Fclob-client)).\n\n### Safety and limits (optional)\n\nDefaults are in `src\u002Fconfig.ts`. Notable env vars:\n\n- `MAX_ORDER_SIZE_USD`, `MAX_TOTAL_EXPOSURE_USD`, `MAX_POSITION_SIZE_PER_MARKET`\n- `MIN_LIQUIDITY_REQUIRED`, `MAX_SPREAD_TOLERANCE`\n- `ENABLE_AUTONOMOUS_TRADING`, `REQUIRE_CONFIRMATION_ABOVE_USD`, `AUTO_CANCEL_ON_LARGE_SPREAD`\n- `CLOB_API_URL`, `GAMMA_API_URL` (defaults point at Polymarket production)\n\n## Wire it to Cursor (or any MCP client)\n\nThis server speaks **stdio** MCP. Example for Cursor `mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"polymarket\": {\n      \"command\": \"node\",\n      \"args\": [\"\u002Fabsolute\u002Fpath\u002Fto\u002Fpolymarket-mcp-server\u002Fdist\u002Fserver.js\"],\n      \"env\": {\n        \"DEMO_MODE\": \"true\"\n      }\n    }\n  }\n}\n```\n\nFor live trading, remove `DEMO_MODE` and pass `POLYGON_PRIVATE_KEY` (or `POLYMARKET_PRIVATE_KEY`), `POLYGON_ADDRESS`, optional `POLYGON_RPC_URL` \u002F `POLYMARKET_FUNDER` \u002F `SIGNATURE_TYPE`, and optionally explicit CLOB credentials via `env` or a `.env` next to the process working directory.\n\n## Operational notes\n\n- **Stdio only:** log lines meant for operators go to **stderr**; JSON-RPC uses **stdout**. Do not pipe debug output into stdout in production.\n- **WebSockets:** the server attempts CLOB and live-data WebSocket connections at startup; failures are logged and discovery\u002Fanalysis via HTTP usually still works.\n- **Security:** keys grant account access — use least privilege, `.env` only on trusted machines, and review Polymarket’s own docs for key rotation.\n\n## License\n\nMIT (see package metadata).\n","Polymarket MCP Server 是一个用于市场发现和分析的服务器，通过公共API提供服务，并在用户钱包提供或生成CLOB L2凭证时，支持认证交易和投资组合工具。核心功能包括无需认证即可访问的市场发现与分析（如订单簿、价格、成交量等），以及需要认证才能使用的交易和投资组合管理功能。项目采用TypeScript编写，要求Node.js 18及以上版本。适用于希望利用Polymarket平台进行市场研究、交易执行及资产管理的开发者或交易者。",2,"2026-05-19 02:31:40","CREATED_QUERY"]