Skip to main content
Glama

agent-trade

MCP server for AI agent trading β€” any agent, any venue.

Give your AI agent the ability to trade across prediction markets, pre-markets, and DEXs through a single Model Context Protocol server.

Features

  • πŸ”Œ Multi-venue β€” One MCP server, multiple trading venues

  • πŸ€– Agent Mode β€” Auto-sign trades with a dedicated wallet

  • πŸ‘€ User Mode β€” Preview trades, sign manually

  • πŸ›‘οΈ Safety built-in β€” Spend limits, price sanity checks, persistent tracking

  • πŸ”— Multi-chain β€” Solana, Polygon, 20+ EVM chains

  • πŸ“– Read-only works instantly β€” No API keys needed for market data

Related MCP server: forge-agent-gate

Supported Venues

Venue

Type

Read

Trade

Chain

Polymarket

Prediction Market

βœ…

βœ…

Polygon

Whales Market

Pre-market OTC

βœ…

βœ…

Solana, 20+ EVM

Quick Start

With Claude Desktop / Cursor

Add to your MCP config:

{
  "mcpServers": {
    "agent-trade": {
      "command": "npx",
      "args": ["-y", "agent-trade"],
      "env": {}
    }
  }
}

That's it β€” market data works immediately with zero config.

With Claude Code

claude mcp add agent-trade -- npx -y agent-trade

With OpenClaw

mcporter add agent-trade --command "npx -y agent-trade"

Tools

Universal Tools (all venues)

Tool

Description

list_venues

List available trading venues and their status

search_markets

Search markets across venues

get_market

Get detailed market info

get_order_book

Get order book (bids/asks)

get_recent_trades

Get recent trades

trade

Place a buy/sell order

cancel

Cancel an open order

get_positions

Get portfolio positions

get_orders

Get open orders

wallet_status

Check wallet balance and spend limits

setup_wallet

Generate or configure wallet

Polymarket Tools

Tool

Description

pm_list_tags

List market categories/tags

pm_get_event

Get event with all markets by slug

pm_derive_api_key

Derive API credentials (one-time)

Whales Market Tools

Tool

Description

wm_get_token_chart

Token price chart data

wm_get_market_stats

Market statistics & overview

wm_get_wallet_info

Wallet info by address

wm_get_upcoming_tokens

Upcoming token listings

Configuration

Environment Variables

Global

Variable

Description

Default

AGENT_TRADE_VENUES

Enabled venues (comma-separated)

All available

AT_WALLET_TYPE

Wallet type: solana or evm

solana

AT_AGENT_PRIVATE_KEY

Agent wallet private key

β€”

AT_SPEND_LIMIT_PER_TX

Max spend per transaction (USD)

50

AT_DAILY_LIMIT

Max daily spend (USD)

200

AT_SOLANA_RPC

Custom Solana RPC URL

Public RPC

AT_EVM_RPC

Custom EVM RPC URL

Public RPC

MCP_HTTP_PORT

Enable HTTP transport on this port

β€” (stdio)

MCP_HTTP_HOST

HTTP bind address

127.0.0.1

Polymarket

Variable

Description

Required

PM_PRIVATE_KEY

Polygon wallet private key

For trading

PM_API_KEY

Derived API key

For trading

PM_API_SECRET

Derived API secret

For trading

PM_API_PASSPHRASE

Derived API passphrase

For trading

Read-only mode needs zero config. Set PM_PRIVATE_KEY to enable trading. Use pm_derive_api_key tool to generate API credentials.

Whales Market

Variable

Description

Required

WM_API_URL

API base URL

No (defaults to mainnet)

WM_AUTH_TOKEN

Auth token for private endpoints

For portfolio

Trading Modes

User Mode (default)

Agent previews the trade, you sign and execute manually:

You: "Buy 10 YES shares on 'Bitcoin above 100k by July?'"
Agent: "Preview: Buy 10 YES @ $0.62 = $6.20 total. Confirm?"

Agent Mode

Agent signs and executes trades autonomously with a dedicated wallet:

You: "Find underpriced markets and buy"
Agent: [executes trade on-chain] "Bought 10 YES @ $0.62, tx: 0x..."

Safety features:

  • Per-transaction spend limit (default $50)

  • Daily spend limit (default $200)

  • Price sanity checks against market data

  • Persistent spend tracking across restarts

  • Private key never exposed in responses

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     AI Agent (Claude, etc)  β”‚
β”‚         MCP Client          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚ MCP Protocol
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       agent-trade           β”‚
β”‚    Universal MCP Tools      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Wallet  β”‚ β”‚  Safety   β”‚  β”‚
β”‚  β”‚ Manager β”‚ β”‚ (Spend    β”‚  β”‚
β”‚  β”‚         β”‚ β”‚  Tracker) β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜  β”‚
β”‚       β”‚    Adapter  β”‚        β”‚
β”‚       β”‚   Registry  β”‚        β”‚
β”‚  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚Polymar- β”‚ β”‚  Whales   β”‚  β”‚
β”‚  β”‚  ket    β”‚ β”‚  Market   β”‚  β”‚
β”‚  β”‚ Gamma + β”‚ β”‚ API +     β”‚  β”‚
β”‚  β”‚  CLOB   β”‚ β”‚ Solana +  β”‚  β”‚
β”‚  β”‚         β”‚ β”‚ EVM       β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Adding New Venues

agent-trade uses an adapter pattern. To add a new venue:

  1. Create src/adapters/your-venue/index.ts implementing TradingAdapter

  2. Register in src/registry.ts

  3. That's it β€” universal tools work automatically

import { TradingAdapter, Market, TradeIntent, TradeResult } from '../adapter.js';

export class YourVenueAdapter implements TradingAdapter {
  name = 'your-venue';
  displayName = 'Your Venue';

  isConfigured(): boolean { return true; }
  async searchMarkets(params): Promise<Market[]> { /* ... */ }
  async trade(intent: TradeIntent): Promise<TradeResult> { /* ... */ }
  // ... implement remaining methods
}

Development

git clone https://github.com/bigbearman/agent-trade.git
cd agent-trade
npm install
npm run build
npm run dev  # watch mode

Test with MCP Inspector

npm run inspect

License

MIT

Available Tools

24 tools
cancelC

Cancel an open order/offer.

Inputs: order_id (required), venue, chain_id.

get_marketC

Get detailed information about a specific market/token.

Inputs: market_id (required), venue.

get_order_bookB

Get the order book for a market: bids, asks, spread.

Inputs: market_id (required), depth, venue.

get_ordersC

Get open orders for your wallet or a specific address.

Inputs: venue, address.

get_positionsC

Get portfolio/positions for your wallet or a specific address.

Inputs: venue, address.

get_recent_tradesB

Get recent trades for a market or across all markets.

Inputs: limit, venue, market_id.

list_venuesA

List all available and configured trading venues.

Inputs: no named parameters.

pm_derive_api_keyA

Derive Polymarket API credentials from your private key (one-time setup). Requires PM_PRIVATE_KEY.

Inputs: no named parameters.

pm_get_eventA

Get a full Polymarket event with all its markets by slug

Inputs: slug.

pm_list_tagsB

List available Polymarket tags/categories for filtering markets

Inputs: no named parameters.

pm_price_historyB

Get price history for a Polymarket market. Returns time series data for trend analysis.

Inputs: slug, fidelity, interval.

search_marketsB

Search and list markets across trading venues. Filter by venue, category, name/symbol.

Inputs: page, take, venue, search, +5 more.

setup_walletB

Wallet setup guide. Check config, generate a new agent wallet, or show setup instructions.

Inputs: action, wallet_type.

tradeB

Create a buy/sell order. Agent mode: validates limits, signs, and executes. User mode: returns preview.

Inputs: side (required), price (required), amount (required), market_id (required), +2 more.

wallet_statusB

Get wallet configuration, balance, and spend limits.

Inputs: no named parameters.

wm_cancel_orderA

Cancel an unfilled order on Whales Market (settleCancelled on-chain)

Inputs: symbol, dry_run, chain_id, order_id.

wm_check_offer_statusB

Check the status of an offer on Whales Market

Inputs: offer_id.

wm_get_leaderboardC

Get Whales Market referral leaderboard and live stats

Inputs: page, take.

wm_get_market_statsB

Get Whales Market overall statistics and volume data

Inputs: no named parameters.

wm_get_networksA

List supported blockchain networks on Whales Market

Inputs: no named parameters.

wm_get_token_chartB

Get historical price chart data for a Whales Market token

Inputs: to, from, token_id, resolution.

wm_get_upcoming_tokensB

Get upcoming tokens on Whales Market

Inputs: no named parameters.

wm_get_wallet_infoC

Get Whales Market wallet info, tier, discount for an address

Inputs: address.

wm_react_to_offerC

Accept/fill an existing offer on Whales Market (agent mode only)

Inputs: amount, symbol, dry_run, chain_id, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 24 tools

    Disambiguation3/5

    Most tools target recognizable resources, but there is real overlap between generic and venue-specific operations. In particular, cancel vs wm_cancel_order, get_market vs venue-specific market/token tools, and wallet_status vs wm_get_wallet_info require careful reading to choose correctly.

    Naming Consistency4/5

    Names are consistently snake_case and mostly follow a verb_noun or prefix_verb_noun pattern, with wm_ and pm_ prefixes clearly marking venue-specific tools. Minor deviations like bare cancel/trade and noun-style wallet_status keep it from being fully uniform.

    Tool Count3/5

    At 24 tools the surface is heavy and verges on overloaded. The count is somewhat justified because the server spans generic trading plus Whales Market and Polymarket-specific operations, but there is still visible duplication across categories.

    Completeness3/5

    Core market, order, position, wallet, and basic trading workflows are covered, and Whales Market has useful offer support. However, gaps remain around personal trade history/order status, order modification, funds movement, and Polymarket-specific trading lifecycle operations beyond market data and API setup.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Trade and monitor prediction markets across Polymarket, Kalshi, Opinion, Limitless, and PredictFun from any AI agent. Unified real-time data, live orderbook streaming, and order execution β€” one API key, one interface, five exchanges.
      -
    • A
      license
      Not graded
      quality
      F
      maintenance
      Enables AI agents to execute prediction-market trades through a risk-control gateway that enforces signed mandates and generates proof trails for accountability.
      0
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to autonomously trade, analyze, and manage positions on Polymarket prediction markets with 45 tools, real-time WebSocket monitoring, and enterprise-grade safety features.
      MIT