@predictengine/mcp-server
v1.0.9
Published
MCP server for PredictEngine institutional API — enables AI agents to trade prediction markets
Maintainers
Readme
@predictengine/mcp-server
Model Context Protocol (MCP) server for the PredictEngine institutional API. Enables AI agents (Claude, GPT, Cursor, etc.) to interact with prediction markets — browse markets, place trades, manage portfolios, and access analytics.
Features
19 tools across four categories:
| Category | Tools |
|----------|-------|
| Markets | list_markets, get_market, get_orderbook, get_market_prices, search_markets |
| Trading | place_order, place_bulk_orders, cancel_order, cancel_all_orders |
| Portfolio | get_positions, get_portfolio_summary, get_pnl, get_trade_history |
| Analytics | get_whale_alerts, get_volume_leaders, get_price_movers, get_news, get_fees |
3 resources for live context:
| URI | Description |
|-----|-------------|
| predictengine://markets | Live market list with prices |
| predictengine://portfolio | Portfolio summary |
| predictengine://positions | Open positions |
Prerequisites
- Node.js 18+ (uses native
fetch) - PredictEngine institutional API credentials (API key + secret)
Installation
cd mcp-server
npm install
npm run buildConfiguration
Set your API credentials as environment variables:
export PE_API_KEY="your_api_key_here"
export PE_API_SECRET="your_api_secret_here"Usage with Claude Desktop
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"predictengine": {
"command": "node",
"args": ["/absolute/path/to/mcp-server/build/index.js"],
"env": {
"PE_API_KEY": "your_api_key",
"PE_API_SECRET": "your_api_secret"
}
}
}
}Restart Claude Desktop after saving.
Usage with Claude Code (CLI)
Add to your .claude/settings.json or project settings:
{
"mcpServers": {
"predictengine": {
"command": "node",
"args": ["/absolute/path/to/mcp-server/build/index.js"],
"env": {
"PE_API_KEY": "your_api_key",
"PE_API_SECRET": "your_api_secret"
}
}
}
}Usage with Cursor
Open Cursor Settings > MCP Servers and add:
{
"predictengine": {
"command": "node",
"args": ["/absolute/path/to/mcp-server/build/index.js"],
"env": {
"PE_API_KEY": "your_api_key",
"PE_API_SECRET": "your_api_secret"
}
}
}Usage with Other MCP Clients
The server uses stdio transport and follows the MCP specification. Any MCP-compatible client can connect by spawning the process:
PE_API_KEY=xxx PE_API_SECRET=xxx node /path/to/build/index.jsThe server communicates via JSON-RPC over stdin/stdout.
Tool Reference
Market Tools
list_markets
Get a paginated list of active prediction markets.
limit(number, 1-100, default 20) — Number of marketsoffset(number, default 0) — Pagination offsetcategory(string, optional) — Filter by category
get_market
Get detailed info about a specific market.
condition_id(string, required) — Market condition ID
get_orderbook
Get L2 order book (bids/asks) for a token.
token_id(string, required) — Token ID for a specific outcome
get_market_prices
Get OHLCV price history candles.
condition_id(string, required) — Market condition IDinterval(enum: 1m/5m/15m/1h/4h/1d, default 1h) — Candle intervallimit(number, 1-1000, default 100) — Number of candles
search_markets
Search markets by keyword.
query(string, required) — Search querylimit(number, 1-50, default 10) — Max results
Trading Tools
place_order
Place a single order on a prediction market.
condition_id(string, required) — Market condition IDtoken_id(string, required) — Token ID for the outcomeside(enum: BUY/SELL) — Order sideprice(number, 0.01-0.99) — Limit price (probability)size(number, min 1) — Number of sharesorder_type(enum: LIMIT/MARKET, default LIMIT) — Order type
place_bulk_orders
Place up to 200 orders in a single batch.
orders(array, required) — Array of order objects (same fields asplace_order)
cancel_order
Cancel a single open order.
order_id(string, required) — Order ID to cancel
cancel_all_orders
Cancel all open orders.
condition_id(string, optional) — Only cancel orders in this market
Portfolio Tools
get_positions
Get positions.
status(enum: open/closed/all, default open) — Position status filterlimit(number, 1-100, default 50) — Max positions
get_portfolio_summary
Get balance, exposure, P&L, fees, and volume. No parameters.
get_pnl
Get P&L breakdown.
group_by(enum: market/day/week/month, default market) — Groupingperiod(enum: 1d/7d/30d/90d/all, default 30d) — Time period
get_trade_history
Get recent trades.
condition_id(string, optional) — Filter by marketside(enum: BUY/SELL, optional) — Filter by sidelimit(number, 1-200, default 50) — Max tradesoffset(number, default 0) — Pagination offset
Analytics Tools
get_whale_alerts
Get recent large trades.
limit(number, 1-50, default 20) — Number of alertsmin_size(number, optional) — Minimum trade size in USDC
get_volume_leaders
Get top markets by volume.
period(enum: 1h/24h/7d/30d, default 24h) — Time periodlimit(number, 1-50, default 10) — Number of markets
get_price_movers
Get biggest price changes.
period(enum: 1h/24h/7d, default 24h) — Time perioddirection(enum: up/down/both, default both) — Price directionlimit(number, 1-50, default 10) — Number of markets
get_news
Get market news feed.
category(string, optional) — Filter by categorylimit(number, 1-50, default 20) — Number of items
get_fees
Get current fee tier and schedule. No parameters.
Development
# Watch mode (auto-recompile on changes)
npm run dev
# Build once
npm run build
# Test manually (set env vars first)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | PE_API_KEY=xxx PE_API_SECRET=xxx node build/index.jsAPI Reference
This MCP server connects to the PredictEngine Institutional API:
- Base URL:
https://api.predictengine.ai/api/v2/ - Authentication:
X-API-KeyandX-API-Secretheaders - Documentation: https://predictengine.ai/docs/api
License
MIT
