Skip to content
Back to search

okx-agent-trade-kit

okx trading bot okx agent mcp cli cryptocurrency okx api automated trading typescript okx trading bot model context protocol cursor ai trading crypto spot futures okx trading bot npm pnpm okx mcp open source quant defi cex okx trading bot algorithmic trading crypto bot okx trading bot okx api mcp okx trading bot crypto mcp

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/dex-original--okx-agent-trade-kit/badge.svg)](/listings/dex-original--okx-agent-trade-kit)

HTML

<a href="/listings/dex-original--okx-agent-trade-kit"><img src="/api/listings/dex-original--okx-agent-trade-kit/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

**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](docs/configuration.md#one-line-install) — handles Node.js check, install, and client detection automatically. > > For live trading, multiple profiles, or other clients, see [configuration →](docs/configuration.md).

---

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 188 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # OKX Agent Trade Kit
  2. **Repository:** [github.com/dex-original/okx-agent-trade-kit](https://github.com/dex-original/okx-agent-trade-kit)
  3. [![CI](https://github.com/dex-original/okx-agent-trade-kit/actions/workflows/ci.yml/badge.svg)](https://github.com/dex-original/okx-agent-trade-kit/actions/workflows/ci.yml)
  4. [![codecov](https://codecov.io/gh/dex-original/okx-agent-trade-kit/branch/master/graph/badge.svg)](https://codecov.io/gh/dex-original/okx-agent-trade-kit)
  5. [![npm: mcp](https://img.shields.io/npm/v/okx-trade-mcp?label=okx-trade-mcp)](https://www.npmjs.com/package/okx-trade-mcp)
  6. [![npm downloads: mcp](https://img.shields.io/npm/dt/okx-trade-mcp?label=mcp+total+downloads)](https://www.npmjs.com/package/okx-trade-mcp)
  7. [![npm: cli](https://img.shields.io/npm/v/okx-trade-cli?label=okx-trade-cli)](https://www.npmjs.com/package/okx-trade-cli)
  8. [![npm downloads: cli](https://img.shields.io/npm/dt/okx-trade-cli?label=cli+total+downloads)](https://www.npmjs.com/package/okx-trade-cli)
  9. [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
  10. [English](README.md) | [中文](README.zh-CN.md)
  11. OKX Agent Trade Kit — an AI-powered trading toolkit with two standalone packages:
  12. | Package | Description |
  13. |---|---|
  14. | `okx-trade-mcp` | MCP server for Claude / Cursor and any MCP-compatible AI client |
  15. | `okx-trade-cli` | CLI for operating OKX from terminal |
  16. ---
  17. ## What is this?
  18. OKX Agent Trade Kit connects AI assistants directly to your OKX account via the [Model Context Protocol](https://modelcontextprotocol.io). Instead of switching between your AI and the exchange UI, you describe what you want — the AI calls the right tools and executes it.
  19. It runs as a **local process** with your API keys stored only on your machine. No cloud services, no data leaving your device.
  20. ## Features
  21. | Feature | Description |
  22. |---------|-------------|
  23. | **145 tools across 11 modules** | Full trading lifecycle: market data → orders → algo orders → account management → earn → trading bots → event contracts → news → smart money signals |
  24. | **Algo orders built-in** | Conditional, OCO take-profit/stop-loss, trailing stop |
  25. | **Safety controls** | `--read-only` flag, per-module filtering, built-in rate limiter |
  26. | **Zero infrastructure** | Local stdio process, no server or database required |
  27. | **MCP standard** | Works with Claude Desktop, Cursor, openCxxW, and any MCP-compatible client |
  28. | **Agent Skills included** | Pre-built skill files for AI agent frameworks — drop-in instructions covering market data, trading, portfolio, bots, and earn |
  29. | **Open source** | MIT license, API keys never leave your machine |
  30. ## Modules
  31. | Module | Tools | Description | Docs |
  32. |--------|-------|-------------|------|
  33. | `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** | [→](docs/modules/market.md) |
  34. | `spot` | 13 | Place/cancel/amend orders, batch orders, fills (+archive), order history (+archive), conditional orders, OCO | [→](docs/modules/spot.md) |
  35. | `swap` | 17 | Perpetual trading, batch orders, positions, leverage, conditional orders, OCO, trailing stop | [→](docs/modules/swap.md) |
  36. | `futures` | 18 | Delivery contract trading, positions, fills, order history, amend/close/leverage, batch orders, algo orders (TP/SL, OCO, trailing stop) | [→](docs/modules/futures.md) |
  37. | `option` | 10 | Options trading: place/cancel/amend/batch-cancel, order history, positions (with Greeks), fills, option chain, IV + Greeks | [→](docs/modules/option.md) |
  38. | `account` | 14 | Balance, bills (+archive), positions, positions history, fee rates, config, position mode, max withdrawal, max avail size, audit log | [→](docs/modules/account.md) |
  39. | `event` | 9 | Event contract trading: browse, series, events, markets (query); place, amend, cancel, orders, fills (private). Semantic outcome values: UP/YES/DOWN/NO | [→](docs/modules/event.md) |
  40. | `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`. | [→](docs/modules/earn.md) |
  41. | `bot` | 10 | Trading bots: Grid (5) and DCA — Spot & Contract (5). Sub-modules: `bot.grid`, `bot.dca` | [→](docs/modules/bot.md) |
  42. | `news` | 7 | Crypto news: latest news, by-coin filter, full-text search, article detail, news sources, coin sentiment (snapshot + trend) | [→](docs/modules/news.md) |
  43. | `smartmoney` | 5 | Smart money signals: multi-currency overview, single-currency consensus signal, signal history timeline, trader leaderboard, trader detail (composite) — all read-only | [→](docs/modules/smartmoney.md) |
  44. ---
  45. ## Quick Start
  46. **Prerequisites:** Node.js >= 18
  47. ```bash
  48. # 1. Install
  49. npm install -g @okx_ai/okx-trade-mcp @okx_ai/okx-trade-cli
  50. # 2. Configure OKX API credentials (interactive wizard)
  51. okx config init
  52. # 3. Register the MCP server with your AI client
  53. okx-trade-mcp setup --client claude-desktop
  54. okx-trade-mcp setup --client cursor
  55. okx-trade-mcp setup --client claude-code
  56. okx-trade-mcp setup --client vscode # writes .mcp.json in current directory
  57. ```
  58. > **Alternative:** [One-line install script](docs/configuration.md#one-line-install) — handles Node.js check, install, and client detection automatically.
  59. >
  60. > For live trading, multiple profiles, or other clients, see [configuration →](docs/configuration.md).
  61. ---
  62. ## okx-trade-mcp
  63. ```bash
  64. okx-trade-mcp # default: spot, swap, account
  65. okx-trade-mcp --modules market # market data only (no auth needed)
  66. okx-trade-mcp --modules spot,account # spot trading + account
  67. okx-trade-mcp --profile live --modules all # all modules including earn
  68. okx-trade-mcp --read-only # query tools only, no writes
  69. ```
  70. [Startup scenarios →](docs/configuration.md#startup-scenarios) — [VS Code · Windsurf →](docs/configuration.md)
  71. ---
  72. ## okx-trade-cli
  73. ```bash
  74. okx market ticker BTC-USDT
  75. okx spot place --instId BTC-USDT --side buy --ordType market --sz 100
  76. okx account balance
  77. ```
  78. > **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-algo` is not valid. See [CLI reference · CLI vs MCP tool names](docs/cli-reference.md#cli-vs-mcp-tool-names).
  79. **[Full CLI reference →](docs/cli-reference.md)**
  80. ---
  81. ## Agent Skills
  82. Pre-built skill files for AI agent frameworks are included in the [`skills/`](skills/) directory. Each skill tells the agent when to activate and how to use the `okx` CLI for a specific task category.
  83. | Skill | Description | Auth |
  84. |-------|-------------|:----:|
  85. | [`okx-cex-market`](skills/okx-cex-market/SKILL.md) | Market data: prices, candles, order books, funding rates, technical indicators | No |
  86. | [`okx-cex-trade`](skills/okx-cex-trade/SKILL.md) | Order management: spot, swap, futures, options, algo orders | Yes |
  87. | [`okx-cex-portfolio`](skills/okx-cex-portfolio/SKILL.md) | Account: balances, positions, P&L, transfers | Yes |
  88. | [`okx-cex-bot`](skills/okx-cex-bot/SKILL.md) | Trading bots: grid and DCA (spot & contract) | Yes |
  89. | [`okx-cex-earn`](skills/okx-cex-earn/SKILL.md) | Earn: Simple Earn, On-chain staking, Dual Investment, AutoEarn | Yes |
  90. | [`okx-cex-smartmoney`](skills/okx-cex-smartmoney/SKILL.md) | Smart Money: trader leaderboard, consensus signals, position analysis | Yes |
  91. **[Skills documentation →](skills/README.md)**
  92. ---
  93. ## Reporting Issues
  94. If a tool call or CLI command fails, open an issue and include the full error output.
  95. **MCP** — copy the structured error block shown in your AI client:
  96. ```json
  97. {
  98. "tool": "swap_place_order",
  99. "error": true,
  100. "type": "OkxApiError",
  101. "code": "51020",
  102. "message": "Order quantity invalid",
  103. "endpoint": "POST /api/v5/trade/order",
  104. "traceId": "abc123def456",
  105. "timestamp": "2026-03-03T10:00:00.000Z",
  106. "serverVersion": "1.0.4"
  107. }
  108. ```
  109. **CLI** — paste the full stderr output:
  110. ```
  111. Error: Order quantity invalid
  112. TraceId: abc123def456
  113. Hint: Check order size against instrument minSz.
  114. Version: okx-trade-cli@1.0.4
  115. ```
  116. See **[FAQ →](docs/faq.md)** for common issues.
  117. ---
  118. ## Build from Source
  119. ```bash
  120. git clone https://github.com/dex-original/okx-agent-trade-kit.git && cd okx-trade-mcp
  121. pnpm install && pnpm build
  122. ```
  123. See [CONTRIBUTING.md](CONTRIBUTING.md) for the full development guide.
  124. ```
  125. packages/
  126. ├── core/ # shared client & tools
  127. ├── mcp/ # MCP Server
  128. └── cli/ # CLI tool
  129. ```
  130. ---
  131. ## Documentation
  132. | Document | Description |
  133. |----------|-------------|
  134. | [Architecture](ARCHITECTURE.md) | System design and module overview |
  135. | [Contributing](CONTRIBUTING.md) | Development setup and PR guidelines |
  136. | [Changelog](CHANGELOG.md) | Version history |
  137. | [Agent Skills](skills/README.md) | Pre-built skills for AI agent frameworks |
  138. | [Security](SECURITY.md) | Vulnerability reporting |

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.