MCP Hub
Back to servers

agent-trade-kit

OKX trading MCP server — connect AI agents to spot, swap, futures, options & grid bots via the Model Context Protocol.

GitHub
Stars
37
Forks
4
Updated
Mar 11, 2026
Validated
Mar 12, 2026

OKX Agent Trade Kit

CI codecov npm: mcp npm downloads: mcp npm: cli npm downloads: cli License: MIT

English | 中文

OKX Agent Trade Kit — an AI-powered trading toolkit with two standalone packages:

PackageDescription
okx-trade-mcpMCP server for Claude / Cursor and any MCP-compatible AI client
okx-trade-cliCLI for operating OKX from terminal

What is this?

OKX Agent Trade Kit connects AI assistants directly to your OKX account via the Model Context Protocol. Instead of switching between your AI and the exchange UI, you describe what you want — the AI calls the right tools and executes it.

It runs as a local process with your API keys stored only on your machine. No cloud services, no data leaving your device.

Features

FeatureDescription
82 tools across 7 modulesFull trading lifecycle: market data → orders → algo orders → account management → trading bots
Algo orders built-inConditional, OCO take-profit/stop-loss, trailing stop
Safety controls--read-only flag, per-module filtering, built-in rate limiter
Zero infrastructureLocal stdio process, no server or database required
MCP standardWorks with Claude Desktop, Cursor, openCxxW, and any MCP-compatible client
Open sourceMIT license, API keys never leave your machine

Modules

ModuleToolsDescriptionDocs
market12Ticker, orderbook, candles (+history), index ticker, index candles, price limit, funding rate, mark price, open interest
spot13Place/cancel/amend orders, batch orders, fills (+archive), order history (+archive), conditional orders, OCO
swap17Perpetual trading, batch orders, positions, leverage, conditional orders, OCO, trailing stop
futures6Delivery contract trading, positions, fills, order history
option10Options trading: place/cancel/amend/batch-cancel, order history, positions (with Greeks), fills, option chain, IV + Greeks
account14Balance, bills (+archive), positions, positions history, fee rates, config, position mode, max withdrawal, max avail size, audit log
bot10Trading bots: Grid (5) and DCA (5). Sub-modules: bot.grid, bot.dca

Quick Start

Prerequisites: Node.js >= 18

# 1. Install
npm install -g @okx_ai/okx-trade-mcp @okx_ai/okx-trade-cli

# 2. Configure OKX API credentials (interactive wizard)
okx config init

# 3. Register the MCP server with your AI client
okx-trade-mcp setup --client claude-desktop
okx-trade-mcp setup --client cursor
okx-trade-mcp setup --client claude-code
okx-trade-mcp setup --client vscode          # writes .mcp.json in current directory

Alternative: One-line install script — handles Node.js check, install, and client detection automatically.

For live trading, multiple profiles, or other clients, see configuration →.


okx-trade-mcp

okx-trade-mcp                                        # default: spot, swap, account
okx-trade-mcp --modules market                       # market data only (no auth needed)
okx-trade-mcp --modules spot,account                 # spot trading + account
okx-trade-mcp --profile live --modules all           # all modules, specific profile
okx-trade-mcp --read-only                            # query tools only, no writes

Startup scenarios →VS Code · Windsurf →


okx-trade-cli

okx market ticker BTC-USDT
okx spot place --instId BTC-USDT --side buy --ordType market --sz 100
okx account balance

Full CLI reference →


Reporting Issues

If a tool call or CLI command fails, open an issue and include the full error output.

MCP — copy the structured error block shown in your AI client:

{
  "tool": "swap_place_order",
  "error": true,
  "type": "OkxApiError",
  "code": "51020",
  "message": "Order quantity invalid",
  "endpoint": "POST /api/v5/trade/order",
  "traceId": "abc123def456",
  "timestamp": "2026-03-03T10:00:00.000Z",
  "serverVersion": "1.0.4"
}

CLI — paste the full stderr output:

Error: Order quantity invalid
TraceId: abc123def456
Hint: Check order size against instrument minSz.
Version: okx-trade-cli@1.0.4

See FAQ → for common issues.


Build from Source

git clone https://github.com/okx/agent-tradekit.git && cd okx-trade-mcp
pnpm install && pnpm build

See CONTRIBUTING.md for the full development guide.

packages/
├── core/    # shared client & tools
├── mcp/     # MCP Server
└── cli/     # CLI tool

Documentation

DocumentDescription
ArchitectureSystem design and module overview
ContributingDevelopment setup and PR guidelines
ChangelogVersion history
SecurityVulnerability reporting

Reviews

No reviews yet

Sign in to write a review