polymarket-trader-mcp 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +65 -3
  2. package/dist/index.js +214 -52
  3. package/dist/index.js.map +1 -1
  4. package/dist/services/trade-executor.d.ts.map +1 -1
  5. package/dist/services/trade-executor.js +8 -1
  6. package/dist/services/trade-executor.js.map +1 -1
  7. package/dist/tools/analyze-trader.js +1 -1
  8. package/dist/tools/analyze-trader.js.map +1 -1
  9. package/dist/tools/backtest-trader.js +1 -1
  10. package/dist/tools/backtest-trader.js.map +1 -1
  11. package/dist/tools/batch-order.d.ts.map +1 -1
  12. package/dist/tools/batch-order.js +8 -0
  13. package/dist/tools/batch-order.js.map +1 -1
  14. package/dist/tools/buy.d.ts.map +1 -1
  15. package/dist/tools/buy.js +5 -0
  16. package/dist/tools/buy.js.map +1 -1
  17. package/dist/tools/find-related.js +1 -1
  18. package/dist/tools/find-related.js.map +1 -1
  19. package/dist/tools/get-market-events.js +1 -1
  20. package/dist/tools/get-market-events.js.map +1 -1
  21. package/dist/tools/get-trader-positions.js +1 -1
  22. package/dist/tools/get-trader-positions.js.map +1 -1
  23. package/dist/tools/log-cycle.d.ts +1 -1
  24. package/dist/tools/place-stink-bid.js +2 -2
  25. package/dist/tools/place-stink-bid.js.map +1 -1
  26. package/dist/tools/score-trader.js +1 -1
  27. package/dist/tools/score-trader.js.map +1 -1
  28. package/dist/tools/set-exit-rules.js +1 -1
  29. package/dist/tools/set-exit-rules.js.map +1 -1
  30. package/dist/tools/watch-market.js +3 -3
  31. package/dist/tools/watch-market.js.map +1 -1
  32. package/dist/utils/config.d.ts +1 -0
  33. package/dist/utils/config.d.ts.map +1 -1
  34. package/dist/utils/config.js +1 -0
  35. package/dist/utils/config.js.map +1 -1
  36. package/dist/utils/logger.d.ts +2 -0
  37. package/dist/utils/logger.d.ts.map +1 -1
  38. package/dist/utils/logger.js +24 -0
  39. package/dist/utils/logger.js.map +1 -1
  40. package/dist/utils/safety.d.ts +12 -0
  41. package/dist/utils/safety.d.ts.map +1 -0
  42. package/dist/utils/safety.js +23 -0
  43. package/dist/utils/safety.js.map +1 -0
  44. package/package.json +4 -1
package/README.md CHANGED
@@ -1,13 +1,20 @@
1
1
  # Polymarket Trader MCP Server
2
2
 
3
+ <a href="https://glama.ai/mcp/servers/demwick/polymarket-trader-mcp">
4
+ <img src="https://glama.ai/mcp/servers/demwick/polymarket-trader-mcp/badges/card.svg" alt="polymarket-trader-mcp MCP server" />
5
+ </a>
6
+
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3
8
  [![Node.js](https://img.shields.io/badge/node-18%2B-brightgreen)](https://nodejs.org)
4
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue)](https://www.typescriptlang.org)
5
10
  [![MCP Protocol](https://img.shields.io/badge/MCP-1.0-purple)](https://modelcontextprotocol.io)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
+ [![Tools](https://img.shields.io/badge/tools-48-orange)]()
7
12
  [![Tests](https://img.shields.io/badge/tests-200%2B%20passing-brightgreen)]()
8
- [![Tools](https://img.shields.io/badge/tools-49-orange)]()
13
+ [![SafeSkill 94/100](https://img.shields.io/badge/SafeSkill-94%2F100_Verified%20Safe-brightgreen)](https://safeskill.dev/scan/demwick-polymarket-trader-mcp)
14
+ [![Socket Badge](https://socket.dev/api/badge/npm/package/polymarket-trader-mcp)](https://socket.dev/npm/package/polymarket-trader-mcp)
15
+ [![Snyk](https://snyk.io/test/github/demwick/polymarket-trader-mcp/badge.svg)](https://snyk.io/test/github/demwick/polymarket-trader-mcp)
16
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/demwick/polymarket-trader-mcp/badge)](https://securityscorecards.dev/viewer/?uri=github.com/demwick/polymarket-trader-mcp)
9
17
  [![MCP Marketplace](https://mcp-marketplace.io/api/badge?slug=polymarket-mcp-server)](https://mcp-marketplace.io/server/polymarket-mcp-server)
10
- [![polymarket-trader-mcp MCP server](https://glama.ai/mcp/servers/demwick/polymarket-trader-mcp/badges/card.svg)](https://glama.ai/mcp/servers/demwick/polymarket-trader-mcp)
11
18
 
12
19
  **Trade, analyze, and automate Polymarket prediction markets through AI.**
13
20
 
@@ -207,6 +214,61 @@ Claude Code / Cursor / AI Client
207
214
 
208
215
  ---
209
216
 
217
+ ## HTTP Transport & Deployment
218
+
219
+ The server supports two transport modes:
220
+
221
+ | Mode | Activation | Use case |
222
+ |------|-----------|----------|
223
+ | **stdio** (default) | `npx polymarket-trader-mcp` | Claude Code, Cursor, local MCP clients |
224
+ | **HTTP** | `--http` flag or `PORT` env var | Smithery, Railway, Docker, remote hosting |
225
+
226
+ ### Starting in HTTP mode
227
+
228
+ ```bash
229
+ # Flag
230
+ node dist/index.js --http
231
+
232
+ # Or set PORT (defaults to 3000)
233
+ PORT=8080 node dist/index.js
234
+ ```
235
+
236
+ ### Endpoints
237
+
238
+ | Path | Method | Description |
239
+ |------|--------|-------------|
240
+ | `/mcp` | POST | MCP protocol endpoint (Streamable HTTP transport) |
241
+ | `/health` | GET | Health check — returns `{ status, version, db }` |
242
+ | `/.well-known/mcp/server-card.json` | GET | Server discovery card for Smithery |
243
+ | `/` | GET | Server info with version and endpoint list |
244
+
245
+ ### Authentication
246
+
247
+ Set `MCP_API_KEY` to require Bearer token auth on the `/mcp` endpoint:
248
+
249
+ ```bash
250
+ MCP_API_KEY=my-secret-key node dist/index.js --http
251
+ # Clients must send: Authorization: Bearer my-secret-key
252
+ ```
253
+
254
+ When `MCP_API_KEY` is not set, the `/mcp` endpoint is open (suitable for local/private networks).
255
+
256
+ ### Docker deployment
257
+
258
+ The included `Dockerfile` builds a multi-stage production image that runs in HTTP mode:
259
+
260
+ ```bash
261
+ docker build -t polymarket-mcp .
262
+ docker run -p 3000:3000 -v mcp-data:/app/data \
263
+ -e MCP_API_KEY=my-secret-key \
264
+ -e DAILY_BUDGET=50 \
265
+ polymarket-mcp
266
+ ```
267
+
268
+ `DB_PATH` (default `/app/data/copytrader.db`) controls where SQLite data is persisted — mount a volume to keep it across restarts.
269
+
270
+ ---
271
+
210
272
  ## Configuration
211
273
 
212
274
  | Variable | Required | Default | Description |
package/dist/index.js CHANGED
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ import { z } from "zod";
2
3
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
+ import { completable } from "@modelcontextprotocol/sdk/server/completable.js";
3
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
7
+ import { createServer } from "http";
8
+ import { readFileSync } from "fs";
4
9
  import Database from "better-sqlite3";
5
10
  import path from "path";
6
11
  import { fileURLToPath } from "url";
@@ -8,8 +13,9 @@ import { createRequire } from "module";
8
13
  const require = createRequire(import.meta.url);
9
14
  const pkg = require("../package.json");
10
15
  import { initializeDb } from "./db/schema.js";
16
+ import { getWatchlist, getOpenPositions } from "./db/queries.js";
11
17
  import { getConfig, hasLiveCredentials, validateLiveCredentials } from "./utils/config.js";
12
- import { log } from "./utils/logger.js";
18
+ import { log, setMcpServer } from "./utils/logger.js";
13
19
  import { safe } from "./utils/tool-wrapper.js";
14
20
  import { BudgetManager } from "./services/budget-manager.js";
15
21
  import { TradeExecutor } from "./services/trade-executor.js";
@@ -65,7 +71,7 @@ import { featuredMarketsSchema, handleFeaturedMarkets } from "./tools/featured-m
65
71
  import { optimizePortfolioSchema, handleOptimizePortfolio } from "./tools/optimize-portfolio.js";
66
72
  import { watchPriceSchema, handleWatchPrice } from "./tools/watch-price.js";
67
73
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
68
- const DB_PATH = path.join(__dirname, "..", "copytrader.db");
74
+ const DB_PATH = process.env.DB_PATH || path.join(__dirname, "..", "copytrader.db");
69
75
  const config = getConfig();
70
76
  const db = new Database(DB_PATH);
71
77
  initializeDb(db);
@@ -78,55 +84,131 @@ const server = new McpServer({
78
84
  name: "polymarket-trader-mcp",
79
85
  version: pkg.version,
80
86
  });
81
- server.tool("discover_traders", "Fetch top traders from the Polymarket leaderboard ranked by PnL, volume, and ROI. Use this to find profitable traders worth copying. Returns trader address, PnL, volume, and win rate. Use auto_watch to add them to your watchlist directly.", discoverTradersSchema.shape, safe("discover_traders", async (input) => ({ content: [{ type: "text", text: await handleDiscoverTraders(db, discoverTradersSchema.parse(input)) }] })));
82
- server.tool("watch_wallet", "Add or remove an Ethereum wallet address from the copy trading watchlist. Watched wallets are monitored for new trades when the monitor is running. Use discover_traders first to find good wallets to watch.", watchWalletSchema.shape, safe("watch_wallet", async (input) => ({ content: [{ type: "text", text: await handleWatchWallet(db, watchWalletSchema.parse(input)) }] })));
83
- server.tool("list_watchlist", "Show all wallet addresses currently on the copy trading watchlist with their aliases and status. Returns a table of watched wallets. No parameters needed.", {}, safe("list_watchlist", async () => ({ content: [{ type: "text", text: await handleListWatchlist(db) }] })));
84
- server.tool("start_monitor", "Start a background loop that polls watched wallets for new trades and automatically copies them. Runs continuously at the specified interval until stop_monitor is called. Requires at least one wallet on the watchlist. Pro feature.", startMonitorSchema.shape, safe("start_monitor", async (input) => ({ content: [{ type: "text", text: await handleStartMonitor(db, walletMonitor, startMonitorSchema.parse(input)) }] })));
85
- server.tool("stop_monitor", "Stop the background wallet monitoring loop started by start_monitor. No parameters needed. Safe to call even if monitor is not running.", {}, safe("stop_monitor", async () => ({ content: [{ type: "text", text: await handleStopMonitor(walletMonitor) }] })));
86
- server.tool("get_dashboard", "Get a comprehensive dashboard showing daily budget usage, total P&L, recent trades, watchlist status, and monitor state. No parameters needed. Use this for a quick overview of your trading activity.", {}, safe("get_dashboard", async () => ({ content: [{ type: "text", text: await handleGetDashboard(db, budgetManager, walletMonitor, tradeExecutor.getMode()) }] })));
87
- server.tool("get_trade_history", "Retrieve past copy trades from the database with optional filters by trader address or status. Returns trade details including entry price, P&L, and market info. Pro feature.", tradeHistorySchema.shape, safe("get_trade_history", async (input) => ({ content: [{ type: "text", text: await handleGetTradeHistory(db, tradeHistorySchema.parse(input)) }] })));
88
- server.tool("set_config", "Update bot configuration at runtime. Supports daily_budget (max USDC per day) and min_conviction (minimum trade size to copy). Changes take effect immediately and persist across restarts. Pro feature.", setConfigSchema.shape, safe("set_config", async (input) => ({ content: [{ type: "text", text: await handleSetConfig(db, budgetManager, setConfigSchema.parse(input)) }] })));
89
- server.tool("go_live", "Switch from preview (simulated) to live trading mode where real orders are placed on Polymarket. Requires POLY_API_KEY, POLY_API_SECRET, POLY_API_PASSPHRASE, and POLY_PRIVATE_KEY in environment. This action uses real money. Pro feature.", goLiveSchema.shape, safe("go_live", async (input) => ({ content: [{ type: "text", text: await handleGoLive(tradeExecutor, goLiveSchema.parse(input)) }] })));
90
- server.tool("analyze_trader", "Analyze a Polymarket trader by wallet address. Returns profile stats, active positions, win rate, volume, PnL, and recent trade activity. Use before adding a trader to your watchlist to assess their quality.", analyzeTraderSchema.shape, safe("analyze_trader", async (input) => ({ content: [{ type: "text", text: await handleAnalyzeTrader(analyzeTraderSchema.parse(input)) }] })));
91
- server.tool("get_trader_positions", "View another trader's current open positions on Polymarket by their wallet address. Shows market name, outcome, size, and current price. Useful for due diligence before copy trading. Pro feature.", getTraderPositionsSchema.shape, safe("get_trader_positions", async (input) => ({ content: [{ type: "text", text: await handleGetTraderPositions(getTraderPositionsSchema.parse(input)) }] })));
92
- server.tool("get_positions", "View your own copy trading positions filtered by status (open, closed, or all). Returns market name, entry price, current price, P&L, and exit rules for each position.", getPositionsSchema.shape, safe("get_positions", async (input) => ({ content: [{ type: "text", text: await handleGetPositions(db, getPositionsSchema.parse(input)) }] })));
93
- server.tool("close_position", "Manually close a copy trading position by trade ID. In live mode, places a sell order on Polymarket. In preview mode, marks the position as closed in the database. Use get_positions to find the trade_id. Pro feature.", closePositionSchema.shape, safe("close_position", async (input) => ({ content: [{ type: "text", text: await handleClosePosition(db, closePositionSchema.parse(input)) }] })));
94
- server.tool("discover_markets", "Find active Polymarket prediction markets filtered by resolution deadline and category. Returns market question, price, volume, and end date. Use ending='today' for fast-resolving markets, or 'all' to browse everything.", discoverMarketsSchema.shape, safe("discover_markets", async (input) => ({ content: [{ type: "text", text: await handleDiscoverMarkets(discoverMarketsSchema.parse(input)) }] })));
95
- server.tool("get_price", "Get live bid/ask/spread prices from the CLOB order book for a specific market by condition_id. If no condition_id is given and show_positions is true, returns current prices for all open positions.", getPriceSchema.shape, safe("get_price", async (input) => ({ content: [{ type: "text", text: await handleGetPrice(db, getPriceSchema.parse(input)) }] })));
96
- server.tool("discover_wta", "Find today's WTA tennis match markets on Polymarket where the favorite is available at a discount. Returns matches with current price vs fair price and the discount percentage. Use place_stink_bid to act on these opportunities. Pro feature.", discoverWtaSchema.shape, safe("discover_wta", async (input) => ({ content: [{ type: "text", text: await handleDiscoverWta(discoverWtaSchema.parse(input)) }] })));
97
- server.tool("place_stink_bid", "Place limit orders (stink bids) at a discount on WTA tennis match favorites. Orders sit in the order book until filled at your target price. In preview mode, simulates the orders. In live mode, places real CLOB orders. Pro feature.", placeStinkBidSchema.shape, safe("place_stink_bid", async (input) => ({ content: [{ type: "text", text: await handlePlaceStinkBid(db, tradeExecutor, placeStinkBidSchema.parse(input)) }] })));
98
- server.tool("cancel_orders", "Cancel all open/pending limit orders on Polymarket. Only works in live mode. Returns the number of cancelled orders. No parameters needed. Pro feature.", cancelOrdersSchema.shape, safe("cancel_orders", async () => ({ content: [{ type: "text", text: await handleCancelOrders(tradeExecutor) }] })));
99
- server.tool("check_exits", "Scan all open positions for exit conditions: market resolution, stop-loss/take-profit triggers, or the original trader exiting. Updates P&L and closes positions that meet exit criteria. No parameters needed.", {}, safe("check_exits", async () => ({ content: [{ type: "text", text: await handleCheckExits(db) }] })));
100
- server.tool("log_cycle", "Record an AI agent's trading cycle metrics to the database for dashboard tracking and performance analysis. Stores PnL, win rate, positions, budget usage, and notes. Call this after each automated trading cycle.", logCycleSchema.shape, safe("log_cycle", (input) => ({ content: [{ type: "text", text: handleLogCycle(db, logCycleSchema.parse(input)) }] })));
101
- server.tool("set_exit_rules", "Set stop-loss and/or take-profit price levels on an open position. When the market price crosses these levels, check_exits will automatically close the position. Use get_positions to find trade IDs. Pro feature.", setExitRulesSchema.shape, safe("set_exit_rules", async (input) => ({ content: [{ type: "text", text: await handleSetExitRules(db, setExitRulesSchema.parse(input)) }] })));
102
- server.tool("get_portfolio", "Get a comprehensive portfolio overview showing all positions grouped by copied wallet, with per-wallet P&L, individual position details, and active exit rules. No parameters needed.", {}, safe("get_portfolio", async () => ({ content: [{ type: "text", text: await handleGetPortfolio(db) }] })));
103
- server.tool("backtest_trader", "Simulate copying a trader's historical trades to calculate hypothetical P&L. Shows what you would have earned if you had copy-traded this wallet. Use before adding a trader to your watchlist to validate their performance. Pro feature.", backtestTraderSchema.shape, safe("backtest_trader", async (input) => ({ content: [{ type: "text", text: await handleBacktestTrader(backtestTraderSchema.parse(input)) }] })));
104
- server.tool("score_trader", "Calculate a conviction score (0-100) for a trader across 5 dimensions: win rate, volume, consistency, experience, and diversity. Higher scores indicate more reliable traders for copy trading. Pro feature.", scoreTraderSchema.shape, safe("score_trader", async (input) => ({ content: [{ type: "text", text: await handleScoreTrader(scoreTraderSchema.parse(input)) }] })));
105
- server.tool("check_market", "Evaluate market quality by checking bid/ask spread, order book depth, and price range. Returns a pass/fail with specific reasons. Use before placing trades to avoid illiquid or wide-spread markets. Pro feature.", checkMarketSchema.shape, safe("check_market", async (input) => ({ content: [{ type: "text", text: await handleCheckMarket(checkMarketSchema.parse(input)) }] })));
106
- server.tool("discover_flow", "Scan top leaderboard traders for smart money convergence signals. Identifies markets where multiple top traders are buying the same outcome simultaneously, indicating strong conviction. Pro feature.", discoverFlowSchema.shape, safe("discover_flow", async (input) => ({ content: [{ type: "text", text: await handleDiscoverFlow(discoverFlowSchema.parse(input)) }] })));
107
- server.tool("get_price_history", "Fetch historical OHLC price data for a market token over a configurable time window (1h to 1m). Returns price points with a sparkline visualization showing the price trend. Pro feature.", getPriceHistorySchema.shape, safe("get_price_history", async (input) => ({ content: [{ type: "text", text: await handleGetPriceHistory(getPriceHistorySchema.parse(input)) }] })));
108
- server.tool("watch_market", "Manage your market watchlist: add, remove, or list watched markets with optional price alert thresholds. When a market crosses your alert price, it shows up in check_exits.", watchMarketSchema.shape, safe("watch_market", async (input) => ({ content: [{ type: "text", text: await handleWatchMarket(db, watchMarketSchema.parse(input)) }] })));
109
- server.tool("rebalance", "Analyze all traders on your watchlist and remove underperformers whose conviction score or win rate falls below your threshold. Use to keep your watchlist focused on high-quality traders. Pro feature.", rebalanceSchema.shape, safe("rebalance", async (input) => ({ content: [{ type: "text", text: await handleRebalance(db, rebalanceSchema.parse(input)) }] })));
110
- server.tool("buy", "Buy outcome shares on a Polymarket market. Specify condition_id, USDC amount, and optionally a limit price. Runs a market quality check before executing. In preview mode, simulates the trade. In live mode, places a real CLOB order.", buySchema.shape, safe("buy", async (input) => ({ content: [{ type: "text", text: await handleBuy(db, tradeExecutor, buySchema.parse(input)) }] })));
111
- server.tool("sell", "Sell an open position by trade_id (from get_positions) or condition_id. In live mode, places a sell order on Polymarket. In preview mode, marks the position as sold in the database and calculates realized P&L.", sellSchema.shape, safe("sell", async (input) => ({ content: [{ type: "text", text: await handleSell(db, tradeExecutor, sellSchema.parse(input)) }] })));
112
- server.tool("get_balance", "View account balance summary: daily budget remaining, total invested, realized and unrealized P&L. No parameters needed. Use this to check how much budget is left before placing new trades.", {}, safe("get_balance", async () => ({ content: [{ type: "text", text: await handleGetBalance(db, budgetManager) }] })));
113
- server.tool("search_markets", "Search Polymarket markets by keyword query. Returns matching markets with question, price, volume, and condition_id. Use the condition_id from results with buy, get_price, or analyze_opportunity.", searchMarketsSchema.shape, safe("search_markets", async (input) => ({ content: [{ type: "text", text: await handleSearchMarkets(searchMarketsSchema.parse(input)) }] })));
114
- server.tool("detect_arbitrage", "Scan active Polymarket markets for arbitrage opportunities where YES + NO prices don't sum to $1.00. Returns markets with the price gap and potential profit percentage.", detectArbitrageSchema.shape, safe("detect_arbitrage", async (input) => ({ content: [{ type: "text", text: await handleDetectArbitrage(detectArbitrageSchema.parse(input)) }] })));
115
- server.tool("find_related", "Find Polymarket markets related to a given condition_id or topic keyword. Useful for discovering correlated markets or building a diversified position across related events.", findRelatedSchema.shape, safe("find_related", async (input) => ({ content: [{ type: "text", text: await handleFindRelated(findRelatedSchema.parse(input)) }] })));
116
- server.tool("get_top_holders", "View the largest position holders in a Polymarket market by condition_id. Shows wallet address, position size, and side (YES/NO). Useful for gauging smart money sentiment on a market.", getTopHoldersSchema.shape, safe("get_top_holders", async (input) => ({ content: [{ type: "text", text: await handleGetTopHolders(getTopHoldersSchema.parse(input)) }] })));
117
- server.tool("trending_markets", "List trending Polymarket markets ranked by trading volume over a configurable period (24h, 7d, or 30d). Filter by category to focus on specific topics. Returns market question, price, and volume.", trendingMarketsSchema.shape, safe("trending_markets", async (input) => ({ content: [{ type: "text", text: await handleTrendingMarkets(trendingMarketsSchema.parse(input)) }] })));
118
- server.tool("analyze_opportunity", "Generate a BUY/SELL/HOLD recommendation for a Polymarket market by analyzing price, spread, price trend, and liquidity depth. Returns a score with detailed reasoning. Read-only analysis, does not place trades.", analyzeOpportunitySchema.shape, safe("analyze_opportunity", async (input) => ({ content: [{ type: "text", text: await handleAnalyzeOpportunity(analyzeOpportunitySchema.parse(input)) }] })));
119
- server.tool("assess_risk", "Assess portfolio risk across 4 dimensions: position concentration, market diversification, stop-loss/take-profit coverage, and daily budget utilization. Returns a risk score with specific warnings. No parameters needed.", {}, safe("assess_risk", async () => ({ content: [{ type: "text", text: await handleAssessRisk(db, budgetManager) }] })));
120
- server.tool("batch_order", "Execute multiple buy/sell orders in a single call (max 10 orders). Each order specifies a condition_id, amount, optional price, and side. Returns per-order results with success/failure status.", batchOrderSchema.shape, safe("batch_order", async (input) => ({ content: [{ type: "text", text: await handleBatchOrder(db, tradeExecutor, batchOrderSchema.parse(input)) }] })));
121
- server.tool("set_safety_limits", "Configure trading safety guardrails: maximum order size in USDC, total exposure cap, and maximum spread tolerance. These limits are enforced on all subsequent buy/sell operations. Changes persist in the database.", setSafetyLimitsSchema.shape, safe("set_safety_limits", (input) => ({ content: [{ type: "text", text: handleSetSafetyLimits(db, setSafetyLimitsSchema.parse(input)) }] })));
122
- server.tool("get_open_orders", "View all pending limit orders on Polymarket that have not yet been filled. Only returns results in live mode. No parameters needed.", {}, safe("get_open_orders", async () => ({ content: [{ type: "text", text: await handleGetOpenOrders(tradeExecutor) }] })));
123
- server.tool("get_order_status", "Check the current status of a specific Polymarket order by order ID. Returns fill status, price, and amount. Only works in live mode.", getOrderStatusSchema.shape, safe("get_order_status", async (input) => ({ content: [{ type: "text", text: await handleGetOrderStatus(tradeExecutor, getOrderStatusSchema.parse(input)) }] })));
124
- server.tool("get_market_events", "Browse Polymarket event groups to find all markets under a single event (e.g. 'US Election', 'UFC 300', 'NBA Finals'). Returns the event with all its sub-markets and their current prices.", getMarketEventsSchema.shape, safe("get_market_events", async (input) => ({ content: [{ type: "text", text: await handleGetMarketEvents(getMarketEventsSchema.parse(input)) }] })));
125
- server.tool("compare_markets", "Compare 2-5 Polymarket markets side by side. Shows price, spread, order book depth, volume, and quality score for each market. Useful for choosing the best market to trade among similar options.", compareMarketsSchema.shape, safe("compare_markets", async (input) => ({ content: [{ type: "text", text: await handleCompareMarkets(compareMarketsSchema.parse(input)) }] })));
126
- server.tool("featured_markets", "List top Polymarket markets ranked by liquidity with optional category filter (politics, sports, crypto, pop-culture, business, science). Returns the most liquid and actively traded markets.", featuredMarketsSchema.shape, safe("featured_markets", async (input) => ({ content: [{ type: "text", text: await handleFeaturedMarkets(featuredMarketsSchema.parse(input)) }] })));
127
- server.tool("optimize_portfolio", "Analyze your open positions and generate optimization recommendations based on your chosen strategy (conservative, balanced, or aggressive). Returns SL/TP suggestions, concentration warnings, and cut/hold/take-profit actions for each position.", optimizePortfolioSchema.shape, safe("optimize_portfolio", async (input) => ({ content: [{ type: "text", text: await handleOptimizePortfolio(db, optimizePortfolioSchema.parse(input)) }] })));
128
- server.tool("watch_price", "Manage live WebSocket price subscriptions for real-time market updates. Subscribe to a token_id to start streaming price changes, unsubscribe to stop, or check connection status.", watchPriceSchema.shape, safe("watch_price", (input) => ({ content: [{ type: "text", text: handleWatchPrice(priceStream, watchPriceSchema.parse(input)) }] })));
87
+ setMcpServer(server);
88
+ // MCP Prompts
89
+ server.prompt("daily-trading-cycle", "Run a complete daily trading cycle: check portfolio, scan smart money, discover opportunities, and manage positions", () => ({
90
+ messages: [{
91
+ role: "user",
92
+ content: {
93
+ type: "text",
94
+ text: `Run my daily Polymarket trading cycle:
95
+ 1. Call dashboard.get for current status
96
+ 2. Call portfolio.get to review open positions
97
+ 3. Call positions.check_exits to handle stop-loss/take-profit triggers
98
+ 4. Call flow.discover to scan smart money convergence signals
99
+ 5. Call markets.trending to find high-volume opportunities
100
+ 6. Call portfolio.risk to check portfolio health
101
+ 7. Summarize findings and suggest next actions`
102
+ }
103
+ }]
104
+ }));
105
+ server.prompt("evaluate-trader", "Deep evaluation of a trader before adding to watchlist", {
106
+ address: completable(z.string().describe("Ethereum wallet address of the trader to evaluate"), (value) => {
107
+ const rows = getWatchlist(db);
108
+ const addresses = rows.map(r => r.address);
109
+ if (!value)
110
+ return addresses;
111
+ const lower = value.toLowerCase();
112
+ return addresses.filter(a => a.toLowerCase().startsWith(lower));
113
+ }),
114
+ }, (input) => ({
115
+ messages: [{
116
+ role: "user",
117
+ content: {
118
+ type: "text",
119
+ text: `Evaluate trader ${input.address} for copy trading:
120
+ 1. Call traders.analyze with this address for profile and stats
121
+ 2. Call traders.score to get conviction score across 5 dimensions
122
+ 3. Call traders.positions to see their current positions
123
+ 4. Call traders.backtest to simulate historical performance
124
+ 5. Based on all data, recommend whether to add this trader to the watchlist`
125
+ }
126
+ }]
127
+ }));
128
+ server.tool("traders.discover", "Fetch top traders from the Polymarket leaderboard ranked by PnL, volume, and ROI. Use this to find profitable traders worth copying. Returns trader address, PnL, volume, and win rate. Use auto_watch to add them to your watchlist directly.", discoverTradersSchema.shape, safe("traders.discover", async (input) => ({ content: [{ type: "text", text: await handleDiscoverTraders(db, discoverTradersSchema.parse(input)) }] })));
129
+ server.tool("watchlist.add", "Add or remove an Ethereum wallet address from the copy trading watchlist. Watched wallets are monitored for new trades when the monitor is running. Use discover_traders first to find good wallets to watch.", watchWalletSchema.shape, safe("watchlist.add", async (input) => ({ content: [{ type: "text", text: await handleWatchWallet(db, watchWalletSchema.parse(input)) }] })));
130
+ server.tool("watchlist.list", "Show all wallet addresses currently on the copy trading watchlist with their aliases and status. Returns a table of watched wallets. No parameters needed.", {}, safe("watchlist.list", async () => ({ content: [{ type: "text", text: await handleListWatchlist(db) }] })));
131
+ server.tool("monitor.start", "Start a background loop that polls watched wallets for new trades and automatically copies them. Runs continuously at the specified interval until stop_monitor is called. Requires at least one wallet on the watchlist. Pro feature.", startMonitorSchema.shape, safe("monitor.start", async (input) => ({ content: [{ type: "text", text: await handleStartMonitor(db, walletMonitor, startMonitorSchema.parse(input)) }] })));
132
+ server.tool("monitor.stop", "Stop the background wallet monitoring loop started by start_monitor. No parameters needed. Safe to call even if monitor is not running.", {}, safe("monitor.stop", async () => ({ content: [{ type: "text", text: await handleStopMonitor(walletMonitor) }] })));
133
+ server.tool("dashboard.get", "Get a comprehensive dashboard showing daily budget usage, total P&L, recent trades, watchlist status, and monitor state. No parameters needed. Use this for a quick overview of your trading activity.", {}, safe("dashboard.get", async () => ({ content: [{ type: "text", text: await handleGetDashboard(db, budgetManager, walletMonitor, tradeExecutor.getMode()) }] })));
134
+ server.tool("trades.history", "Retrieve past copy trades from the database with optional filters by trader address or status. Returns trade details including entry price, P&L, and market info. Pro feature.", tradeHistorySchema.shape, safe("trades.history", async (input) => ({ content: [{ type: "text", text: await handleGetTradeHistory(db, tradeHistorySchema.parse(input)) }] })));
135
+ server.tool("config.set", "Update bot configuration at runtime. Supports daily_budget (max USDC per day) and min_conviction (minimum trade size to copy). Changes take effect immediately and persist across restarts. Pro feature.", setConfigSchema.shape, safe("config.set", async (input) => ({ content: [{ type: "text", text: await handleSetConfig(db, budgetManager, setConfigSchema.parse(input)) }] })));
136
+ server.tool("config.go_live", "Switch from preview (simulated) to live trading mode where real orders are placed on Polymarket. Requires POLY_API_KEY, POLY_API_SECRET, POLY_API_PASSPHRASE, and POLY_PRIVATE_KEY in environment. This action uses real money. Pro feature.", goLiveSchema.shape, safe("config.go_live", async (input) => ({ content: [{ type: "text", text: await handleGoLive(tradeExecutor, goLiveSchema.parse(input)) }] })));
137
+ server.tool("traders.analyze", "Analyze a Polymarket trader by wallet address. Returns profile stats, active positions, win rate, volume, PnL, and recent trade activity. Use before adding a trader to your watchlist to assess their quality.", analyzeTraderSchema.shape, safe("traders.analyze", async (input) => ({ content: [{ type: "text", text: await handleAnalyzeTrader(analyzeTraderSchema.parse(input)) }] })));
138
+ server.tool("traders.positions", "View another trader's current open positions on Polymarket by their wallet address. Shows market name, outcome, size, and current price. Useful for due diligence before copy trading. Pro feature.", getTraderPositionsSchema.shape, safe("traders.positions", async (input) => ({ content: [{ type: "text", text: await handleGetTraderPositions(getTraderPositionsSchema.parse(input)) }] })));
139
+ server.tool("positions.list", "View your own copy trading positions filtered by status (open, closed, or all). Returns market name, entry price, current price, P&L, and exit rules for each position.", getPositionsSchema.shape, safe("positions.list", async (input) => ({ content: [{ type: "text", text: await handleGetPositions(db, getPositionsSchema.parse(input)) }] })));
140
+ server.tool("positions.close", "Manually close a copy trading position by trade ID. In live mode, places a sell order on Polymarket. In preview mode, marks the position as closed in the database. Use get_positions to find the trade_id. Pro feature.", closePositionSchema.shape, safe("positions.close", async (input) => ({ content: [{ type: "text", text: await handleClosePosition(db, closePositionSchema.parse(input)) }] })));
141
+ server.tool("markets.discover", "Find active Polymarket prediction markets filtered by resolution deadline and category. Returns market question, price, volume, and end date. Use ending='today' for fast-resolving markets, or 'all' to browse everything.", discoverMarketsSchema.shape, safe("markets.discover", async (input) => ({ content: [{ type: "text", text: await handleDiscoverMarkets(discoverMarketsSchema.parse(input)) }] })));
142
+ server.tool("markets.price", "Get live bid/ask/spread prices from the CLOB order book for a specific market by condition_id. If no condition_id is given and show_positions is true, returns current prices for all open positions.", getPriceSchema.shape, safe("markets.price", async (input) => ({ content: [{ type: "text", text: await handleGetPrice(db, getPriceSchema.parse(input)) }] })));
143
+ server.tool("wta.discover", "Find today's WTA tennis match markets on Polymarket where the favorite is available at a discount. Returns matches with current price vs fair price and the discount percentage. Use place_stink_bid to act on these opportunities. Pro feature.", discoverWtaSchema.shape, safe("wta.discover", async (input) => ({ content: [{ type: "text", text: await handleDiscoverWta(discoverWtaSchema.parse(input)) }] })));
144
+ server.tool("wta.bid", "Place limit orders (stink bids) at a discount on WTA tennis match favorites. Orders sit in the order book until filled at your target price. In preview mode, simulates the orders. In live mode, places real CLOB orders. Pro feature.", placeStinkBidSchema.shape, safe("wta.bid", async (input) => ({ content: [{ type: "text", text: await handlePlaceStinkBid(db, tradeExecutor, placeStinkBidSchema.parse(input)) }] })));
145
+ server.tool("orders.cancel", "Cancel all open/pending limit orders on Polymarket. Only works in live mode. Returns the number of cancelled orders. No parameters needed. Pro feature.", cancelOrdersSchema.shape, safe("orders.cancel", async () => ({ content: [{ type: "text", text: await handleCancelOrders(tradeExecutor) }] })));
146
+ server.tool("positions.check_exits", "Scan all open positions for exit conditions: market resolution, stop-loss/take-profit triggers, or the original trader exiting. Updates P&L and closes positions that meet exit criteria. No parameters needed.", {}, safe("positions.check_exits", async () => ({ content: [{ type: "text", text: await handleCheckExits(db) }] })));
147
+ server.tool("agent.log_cycle", "Record an AI agent's trading cycle metrics to the database for dashboard tracking and performance analysis. Stores PnL, win rate, positions, budget usage, and notes. Call this after each automated trading cycle.", logCycleSchema.shape, safe("agent.log_cycle", (input) => ({ content: [{ type: "text", text: handleLogCycle(db, logCycleSchema.parse(input)) }] })));
148
+ server.tool("positions.set_exit_rules", "Set stop-loss and/or take-profit price levels on an open position. When the market price crosses these levels, check_exits will automatically close the position. Use get_positions to find trade IDs. Pro feature.", setExitRulesSchema.shape, safe("positions.set_exit_rules", async (input) => ({ content: [{ type: "text", text: await handleSetExitRules(db, setExitRulesSchema.parse(input)) }] })));
149
+ server.tool("portfolio.get", "Get a comprehensive portfolio overview showing all positions grouped by copied wallet, with per-wallet P&L, individual position details, and active exit rules. No parameters needed.", {}, safe("portfolio.get", async () => ({ content: [{ type: "text", text: await handleGetPortfolio(db) }] })));
150
+ server.tool("traders.backtest", "Simulate copying a trader's historical trades to calculate hypothetical P&L. Shows what you would have earned if you had copy-traded this wallet. Use before adding a trader to your watchlist to validate their performance. Pro feature.", backtestTraderSchema.shape, safe("traders.backtest", async (input) => ({ content: [{ type: "text", text: await handleBacktestTrader(backtestTraderSchema.parse(input)) }] })));
151
+ server.tool("traders.score", "Calculate a conviction score (0-100) for a trader across 5 dimensions: win rate, volume, consistency, experience, and diversity. Higher scores indicate more reliable traders for copy trading. Pro feature.", scoreTraderSchema.shape, safe("traders.score", async (input) => ({ content: [{ type: "text", text: await handleScoreTrader(scoreTraderSchema.parse(input)) }] })));
152
+ server.tool("markets.check", "Evaluate market quality by checking bid/ask spread, order book depth, and price range. Returns a pass/fail with specific reasons. Use before placing trades to avoid illiquid or wide-spread markets. Pro feature.", checkMarketSchema.shape, safe("markets.check", async (input) => ({ content: [{ type: "text", text: await handleCheckMarket(checkMarketSchema.parse(input)) }] })));
153
+ server.tool("flow.discover", "Scan top leaderboard traders for smart money convergence signals. Identifies markets where multiple top traders are buying the same outcome simultaneously, indicating strong conviction. Pro feature.", discoverFlowSchema.shape, safe("flow.discover", async (input) => ({ content: [{ type: "text", text: await handleDiscoverFlow(discoverFlowSchema.parse(input)) }] })));
154
+ server.tool("markets.price_history", "Fetch historical OHLC price data for a market token over a configurable time window (1h to 1m). Returns price points with a sparkline visualization showing the price trend. Pro feature.", getPriceHistorySchema.shape, safe("markets.price_history", async (input) => ({ content: [{ type: "text", text: await handleGetPriceHistory(getPriceHistorySchema.parse(input)) }] })));
155
+ server.tool("markets.watch", "Manage your market watchlist: add, remove, or list watched markets with optional price alert thresholds. When a market crosses your alert price, it shows up in check_exits.", watchMarketSchema.shape, safe("markets.watch", async (input) => ({ content: [{ type: "text", text: await handleWatchMarket(db, watchMarketSchema.parse(input)) }] })));
156
+ server.tool("watchlist.rebalance", "Analyze all traders on your watchlist and remove underperformers whose conviction score or win rate falls below your threshold. Use to keep your watchlist focused on high-quality traders. Pro feature.", rebalanceSchema.shape, safe("watchlist.rebalance", async (input) => ({ content: [{ type: "text", text: await handleRebalance(db, rebalanceSchema.parse(input)) }] })));
157
+ server.tool("orders.buy", "Buy outcome shares on a Polymarket market. Specify condition_id, USDC amount, and optionally a limit price. Runs a market quality check before executing. In preview mode, simulates the trade. In live mode, places a real CLOB order.", buySchema.shape, safe("orders.buy", async (input) => ({ content: [{ type: "text", text: await handleBuy(db, tradeExecutor, buySchema.parse(input)) }] })));
158
+ server.tool("orders.sell", "Sell an open position by trade_id (from get_positions) or condition_id. In live mode, places a sell order on Polymarket. In preview mode, marks the position as sold in the database and calculates realized P&L.", sellSchema.shape, safe("orders.sell", async (input) => ({ content: [{ type: "text", text: await handleSell(db, tradeExecutor, sellSchema.parse(input)) }] })));
159
+ server.tool("portfolio.balance", "View account balance summary: daily budget remaining, total invested, realized and unrealized P&L. No parameters needed. Use this to check how much budget is left before placing new trades.", {}, safe("portfolio.balance", async () => ({ content: [{ type: "text", text: await handleGetBalance(db, budgetManager) }] })));
160
+ server.tool("markets.search", "Search Polymarket markets by keyword query. Returns matching markets with question, price, volume, and condition_id. Use the condition_id from results with buy, get_price, or analyze_opportunity.", searchMarketsSchema.shape, safe("markets.search", async (input) => ({ content: [{ type: "text", text: await handleSearchMarkets(searchMarketsSchema.parse(input)) }] })));
161
+ server.tool("markets.arbitrage", "Scan active Polymarket markets for arbitrage opportunities where YES + NO prices don't sum to $1.00. Returns markets with the price gap and potential profit percentage.", detectArbitrageSchema.shape, safe("markets.arbitrage", async (input) => ({ content: [{ type: "text", text: await handleDetectArbitrage(detectArbitrageSchema.parse(input)) }] })));
162
+ server.tool("markets.related", "Find Polymarket markets related to a given condition_id or topic keyword. Useful for discovering correlated markets or building a diversified position across related events.", findRelatedSchema.shape, safe("markets.related", async (input) => ({ content: [{ type: "text", text: await handleFindRelated(findRelatedSchema.parse(input)) }] })));
163
+ server.tool("markets.holders", "View the largest position holders in a Polymarket market by condition_id. Shows wallet address, position size, and side (YES/NO). Useful for gauging smart money sentiment on a market.", getTopHoldersSchema.shape, safe("markets.holders", async (input) => ({ content: [{ type: "text", text: await handleGetTopHolders(getTopHoldersSchema.parse(input)) }] })));
164
+ server.tool("markets.trending", "List trending Polymarket markets ranked by trading volume over a configurable period (24h, 7d, or 30d). Filter by category to focus on specific topics. Returns market question, price, and volume.", trendingMarketsSchema.shape, safe("markets.trending", async (input) => ({ content: [{ type: "text", text: await handleTrendingMarkets(trendingMarketsSchema.parse(input)) }] })));
165
+ server.tool("markets.analyze", "Generate a BUY/SELL/HOLD recommendation for a Polymarket market by analyzing price, spread, price trend, and liquidity depth. Returns a score with detailed reasoning. Read-only analysis, does not place trades.", analyzeOpportunitySchema.shape, safe("markets.analyze", async (input) => ({ content: [{ type: "text", text: await handleAnalyzeOpportunity(analyzeOpportunitySchema.parse(input)) }] })));
166
+ server.tool("portfolio.risk", "Assess portfolio risk across 4 dimensions: position concentration, market diversification, stop-loss/take-profit coverage, and daily budget utilization. Returns a risk score with specific warnings. No parameters needed.", {}, safe("portfolio.risk", async () => ({ content: [{ type: "text", text: await handleAssessRisk(db, budgetManager) }] })));
167
+ server.tool("orders.batch", "Execute multiple buy/sell orders in a single call (max 10 orders). Each order specifies a condition_id, amount, optional price, and side. Returns per-order results with success/failure status.", batchOrderSchema.shape, safe("orders.batch", async (input) => ({ content: [{ type: "text", text: await handleBatchOrder(db, tradeExecutor, batchOrderSchema.parse(input)) }] })));
168
+ server.tool("config.safety_limits", "Configure trading safety guardrails: maximum order size in USDC, total exposure cap, and maximum spread tolerance. These limits are enforced on all subsequent buy/sell operations. Changes persist in the database.", setSafetyLimitsSchema.shape, safe("config.safety_limits", (input) => ({ content: [{ type: "text", text: handleSetSafetyLimits(db, setSafetyLimitsSchema.parse(input)) }] })));
169
+ server.tool("orders.list", "View all pending limit orders on Polymarket that have not yet been filled. Only returns results in live mode. No parameters needed.", {}, safe("orders.list", async () => ({ content: [{ type: "text", text: await handleGetOpenOrders(tradeExecutor) }] })));
170
+ server.tool("orders.status", "Check the current status of a specific Polymarket order by order ID. Returns fill status, price, and amount. Only works in live mode.", getOrderStatusSchema.shape, safe("orders.status", async (input) => ({ content: [{ type: "text", text: await handleGetOrderStatus(tradeExecutor, getOrderStatusSchema.parse(input)) }] })));
171
+ server.tool("markets.events", "Browse Polymarket event groups to find all markets under a single event (e.g. 'US Election', 'UFC 300', 'NBA Finals'). Returns the event with all its sub-markets and their current prices.", getMarketEventsSchema.shape, safe("markets.events", async (input) => ({ content: [{ type: "text", text: await handleGetMarketEvents(getMarketEventsSchema.parse(input)) }] })));
172
+ server.tool("markets.compare", "Compare 2-5 Polymarket markets side by side. Shows price, spread, order book depth, volume, and quality score for each market. Useful for choosing the best market to trade among similar options.", compareMarketsSchema.shape, safe("markets.compare", async (input) => ({ content: [{ type: "text", text: await handleCompareMarkets(compareMarketsSchema.parse(input)) }] })));
173
+ server.tool("markets.featured", "List top Polymarket markets ranked by liquidity with optional category filter (politics, sports, crypto, pop-culture, business, science). Returns the most liquid and actively traded markets.", featuredMarketsSchema.shape, safe("markets.featured", async (input) => ({ content: [{ type: "text", text: await handleFeaturedMarkets(featuredMarketsSchema.parse(input)) }] })));
174
+ server.tool("portfolio.optimize", "Analyze your open positions and generate optimization recommendations based on your chosen strategy (conservative, balanced, or aggressive). Returns SL/TP suggestions, concentration warnings, and cut/hold/take-profit actions for each position.", optimizePortfolioSchema.shape, safe("portfolio.optimize", async (input) => ({ content: [{ type: "text", text: await handleOptimizePortfolio(db, optimizePortfolioSchema.parse(input)) }] })));
175
+ server.tool("markets.watch_price", "Manage live WebSocket price subscriptions for real-time market updates. Subscribe to a token_id to start streaming price changes, unsubscribe to stop, or check connection status.", watchPriceSchema.shape, safe("markets.watch_price", (input) => ({ content: [{ type: "text", text: handleWatchPrice(priceStream, watchPriceSchema.parse(input)) }] })));
176
+ // MCP Resources
177
+ server.resource("watchlist", "polymarket://watchlist", { description: "Current copy trading watchlist with trader addresses, aliases, and performance stats", mimeType: "application/json" }, async () => ({
178
+ contents: [{
179
+ uri: "polymarket://watchlist",
180
+ mimeType: "application/json",
181
+ text: JSON.stringify(getWatchlist(db), null, 2),
182
+ }],
183
+ }));
184
+ server.resource("positions", "polymarket://positions", { description: "All open trading positions with entry price, current status, and exit rules", mimeType: "application/json" }, async () => ({
185
+ contents: [{
186
+ uri: "polymarket://positions",
187
+ mimeType: "application/json",
188
+ text: JSON.stringify(getOpenPositions(db), null, 2),
189
+ }],
190
+ }));
191
+ server.resource("budget", "polymarket://budget/today", { description: "Today's budget usage, remaining allowance, and daily limit", mimeType: "application/json" }, async () => {
192
+ const remaining = budgetManager.getRemainingBudget();
193
+ const today = new Date().toISOString().slice(0, 10);
194
+ const row = db.prepare("SELECT COALESCE(SUM(amount), 0) as spent FROM daily_budget WHERE date = ?").get(today);
195
+ return {
196
+ contents: [{
197
+ uri: "polymarket://budget/today",
198
+ mimeType: "application/json",
199
+ text: JSON.stringify({ daily_limit: config.DAILY_BUDGET, spent: row.spent, remaining, date: today }, null, 2),
200
+ }],
201
+ };
202
+ });
203
+ server.resource("trades", "polymarket://trades/recent", { description: "Recent trade history with P&L and execution details", mimeType: "application/json" }, async () => ({
204
+ contents: [{
205
+ uri: "polymarket://trades/recent",
206
+ mimeType: "application/json",
207
+ text: JSON.stringify(db.prepare("SELECT * FROM trades ORDER BY created_at DESC LIMIT 50").all(), null, 2),
208
+ }],
209
+ }));
129
210
  // Start MCP server
211
+ const useHttp = process.argv.includes("--http") || !!process.env.PORT;
130
212
  async function main() {
131
213
  log("info", "Starting Polymarket Trader MCP Server");
132
214
  log("info", `Mode: ${config.COPY_MODE} | Budget: $${config.DAILY_BUDGET}/day`);
@@ -137,8 +219,88 @@ async function main() {
137
219
  if (!config.MCP_LICENSE_KEY) {
138
220
  log("info", "No MCP_LICENSE_KEY set — running in Free tier. Pro features are locked.");
139
221
  }
140
- const transport = new StdioServerTransport();
141
- await server.connect(transport);
222
+ if (useHttp) {
223
+ await startHttpServer();
224
+ }
225
+ else {
226
+ const transport = new StdioServerTransport();
227
+ await server.connect(transport);
228
+ }
229
+ }
230
+ async function startHttpServer() {
231
+ const port = parseInt(process.env.PORT || "3000", 10);
232
+ const httpTransport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
233
+ await server.connect(httpTransport);
234
+ const httpServer = createServer(async (req, res) => {
235
+ const url = new URL(req.url || "/", `http://${req.headers.host}`);
236
+ // Server card for Smithery discovery
237
+ if (url.pathname === "/.well-known/mcp/server-card.json") {
238
+ try {
239
+ const card = readFileSync(path.join(__dirname, "..", ".well-known", "mcp", "server-card.json"), "utf-8");
240
+ res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": "*" });
241
+ res.end(card);
242
+ }
243
+ catch {
244
+ res.writeHead(404);
245
+ res.end("Not Found");
246
+ }
247
+ return;
248
+ }
249
+ // Health check
250
+ if (url.pathname === "/health") {
251
+ try {
252
+ db.prepare("SELECT 1").get();
253
+ res.writeHead(200, { "Content-Type": "application/json" });
254
+ res.end(JSON.stringify({ status: "ok", version: pkg.version, db: "connected" }));
255
+ }
256
+ catch {
257
+ res.writeHead(503, { "Content-Type": "application/json" });
258
+ res.end(JSON.stringify({ status: "degraded", version: pkg.version, db: "error" }));
259
+ }
260
+ return;
261
+ }
262
+ // MCP endpoint
263
+ if (url.pathname === "/mcp") {
264
+ // Bearer token auth when MCP_API_KEY is configured
265
+ const apiKey = process.env.MCP_API_KEY;
266
+ if (apiKey) {
267
+ const authHeader = req.headers.authorization;
268
+ if (!authHeader || authHeader !== `Bearer ${apiKey}`) {
269
+ res.writeHead(401, { "Content-Type": "application/json" });
270
+ res.end(JSON.stringify({ error: "Unauthorized", message: "Valid Bearer token required" }));
271
+ return;
272
+ }
273
+ }
274
+ try {
275
+ await httpTransport.handleRequest(req, res);
276
+ }
277
+ catch (err) {
278
+ log("error", `MCP request error: ${err}`);
279
+ if (!res.headersSent) {
280
+ res.writeHead(500, { "Content-Type": "application/json" });
281
+ res.end(JSON.stringify({ error: "Internal server error" }));
282
+ }
283
+ }
284
+ return;
285
+ }
286
+ // Root info
287
+ if (url.pathname === "/") {
288
+ res.writeHead(200, { "Content-Type": "application/json" });
289
+ res.end(JSON.stringify({
290
+ name: "polymarket-trader-mcp",
291
+ version: pkg.version,
292
+ mcp: "/mcp",
293
+ health: "/health",
294
+ }));
295
+ return;
296
+ }
297
+ res.writeHead(404);
298
+ res.end("Not Found");
299
+ });
300
+ httpServer.listen(port, () => {
301
+ log("info", `HTTP transport listening on port ${port}`);
302
+ log("info", `MCP endpoint: http://localhost:${port}/mcp`);
303
+ });
142
304
  }
143
305
  main().catch((err) => {
144
306
  console.error("Fatal error:", err);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,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,4EAA4E;IAC5E,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CACpE;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IACzB,MAAM,EAAE,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,aAAa;IAItB,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,IAAI;IAJd,OAAO,CAAC,UAAU,CAA2B;gBAGnC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,IAAI,EAAE,SAAS,GAAG,MAAM;IAG5B,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;IAOtD,OAAO,CAAC,aAAa;YA2BP,gBAAgB;YA2DhB,aAAa;IAqBrB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;IAsB1D,OAAO,CAAC,iBAAiB;IAgBnB,eAAe,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAQvD,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI;IAKvC,OAAO,IAAI,MAAM;CAGlB"}
@@ -3,6 +3,12 @@ import { Wallet } from "@ethersproject/wallet";
3
3
  import { recordTrade, recordTradeWithBudget } from "../db/queries.js";
4
4
  import { getConfig, hasLiveCredentials } from "../utils/config.js";
5
5
  import { log } from "../utils/logger.js";
6
+ /** Redact private keys and hex secrets from error messages to prevent leaks in logs. */
7
+ function sanitizeError(msg) {
8
+ // Remove anything that looks like a private key or hex secret (32+ hex chars)
9
+ return msg.replace(/0x[a-fA-F0-9]{32,}/g, "0x[REDACTED]")
10
+ .replace(/[a-fA-F0-9]{64,}/g, "[REDACTED]");
11
+ }
6
12
  export class TradeExecutor {
7
13
  db;
8
14
  mode;
@@ -84,7 +90,8 @@ export class TradeExecutor {
84
90
  return { tradeId, mode: "live", status: "executed", message: `Executed: ${order.orderSide ?? "BUY"} $${order.amount} @ ${order.price}` };
85
91
  }
86
92
  catch (err) {
87
- const message = err?.message ?? String(err);
93
+ const rawMessage = err?.message ?? String(err);
94
+ const message = sanitizeError(rawMessage);
88
95
  log("error", `[LIVE] Failed ${order.orderSide ?? "BUY"} on ${order.marketSlug}: ${message}`);
89
96
  return this.recordFailedTrade(order, message);
90
97
  }