okx-trade-mcp
MCP server connecting AI assistants to OKX exchange, enabling trading, market data, account management, and more via 150+ tools across 11 modules.
README
OKX Agent Trade Kit
OKX Agent Trade Kit — an AI-powered trading toolkit with two standalone packages:
| Package | Description |
|---|---|
okx-trade-mcp |
MCP server for Claude / Cursor and any MCP-compatible AI client |
okx-trade-cli |
CLI 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
| Feature | Description |
|---|---|
| 150 tools across 11 modules | Full trading lifecycle: market data → orders → algo orders → account management → earn → trading bots → event contracts → news → smart money signals |
| Algo orders built-in | Conditional, OCO take-profit/stop-loss, trailing stop |
| Safety controls | --read-only flag, per-module filtering, built-in rate limiter |
| Zero infrastructure | Local stdio process, no server or database required |
| MCP standard | Works with Claude Desktop, Cursor, openCxxW, and any MCP-compatible client |
| Agent Skills included | Pre-built skill files for AI agent frameworks — drop-in instructions covering market data, trading, portfolio, bots, and earn |
| Open source | MIT license, API keys never leave your machine |
Modules
| Module | Tools | Description | Docs |
|---|---|---|---|
market |
19 | Ticker, orderbook, candles (+history), index ticker, index candles, price limit, funding rate, mark price, open interest, stock tokens, technical indicators (70+ indicators: MA/EMA/RSI/MACD/BB/ATR/KDJ/BTCRAINBOW/AHR999 and more — no auth required), indicator list, market filter (screen by price/change/marketCap/volume/fundingRate/OI), OI history, OI change filter | → |
spot |
13 | Place/cancel/amend orders, batch orders, fills (+archive), order history (+archive), conditional orders, OCO | → |
swap |
17 | Perpetual trading, batch orders, positions, leverage, conditional orders, OCO, trailing stop | → |
futures |
18 | Delivery contract trading, positions, fills, order history, amend/close/leverage, batch orders, algo orders (TP/SL, OCO, trailing stop) | → |
option |
10 | Options trading: place/cancel/amend/batch-cancel, order history, positions (with Greeks), fills, option chain, IV + Greeks | → |
account |
14 | Balance, bills (+archive), positions, positions history, fee rates, config, position mode, max withdrawal, max avail size, audit log | → |
event |
9 | Event contract trading: browse, series, events, markets (query); place, amend, cancel, orders, fills (private). Semantic outcome values: UP/YES/DOWN/NO | → |
earn |
23 | Simple Earn: balance, purchase, redeem, lending rate, fixed-term orders (10). On-chain staking/DeFi (6). Dual Currency Deposit/双币赢 (6). Flash Earn (1). Sub-modules: earn.savings, earn.onchain, earn.dcd, earn.flash. Included in all. |
→ |
bot |
10 | Trading bots: Grid (5) and DCA — Spot & Contract (5). Sub-modules: bot.grid, bot.dca |
→ |
news |
7 | Crypto news: latest news, by-coin filter, full-text search, article detail, news sources, coin sentiment (snapshot + trend) | → |
smartmoney |
10 | Smart money analytics: leaderboard ranking, trader performance / positions / position history / order history, top-coin signals, single-asset signal (by coin / by traders), signal history (by coin / by traders) — all read-only, split by entry mode for AI-agent disambiguation | → |
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 including earn
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
Naming note — CLI subcommands use spaces (
okx swap algo place). AI agents see the same features under underscored MCP tool names (swap_place_algo_order). Do not convert MCP identifiers into hyphen-joined CLI commands —okx swap place-algois not valid. See CLI reference · CLI vs MCP tool names.
Agent Skills
Pre-built skill files for AI agent frameworks are included in the skills/ directory. Each skill tells the agent when to activate and how to use the okx CLI for a specific task category.
| Skill | Description | Auth |
|---|---|---|
okx-cex-market |
Market data: prices, candles, order books, funding rates, technical indicators | No |
okx-cex-trade |
Order management: spot, swap, futures, options, algo orders | Yes |
okx-cex-portfolio |
Account: balances, positions, P&L, transfers | Yes |
okx-cex-bot |
Trading bots: grid and DCA (spot & contract) | Yes |
okx-cex-earn |
Earn: Simple Earn, On-chain staking, Dual Investment, AutoEarn | Yes |
okx-cex-smartmoney |
Smart Money: trader leaderboard, consensus signals, position analysis | Yes |
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
| Document | Description |
|---|---|
| Architecture | System design and module overview |
| Contributing | Development setup and PR guidelines |
| Changelog | Version history |
| Agent Skills | Pre-built skills for AI agent frameworks |
| Security | Vulnerability reporting |
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。