AI Trading Co-Pilot MCP Server
Provides AI-powered cryptocurrency trading assistance with real-time OKX exchange integration, including market data, account management, AI analysis, trading execution, and customizable rules for automated trading.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AI Trading Co-Pilot MCP Server Run a full analysis on BTC"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
#AI Trading Co-Pilot — MCP Server
AI-powered cryptocurrency trading assistant for OpenClaw and any MCP-compatible client (Claude Desktop, etc.).
4-agent analysis system (macro + technical + risk + portfolio manager) with real-time OKX exchange integration, smart rules engine, and autonomous trading capabilities.
⚡ Quick Start (3 minutes)
1. Install
npm install @okx-trade/mcp-serverOr clone and install locally:
cd mcp/
npm install2. Configure API Keys
# OKX Exchange API Key (required for trading & account data)
export OKX_DEMO_API_KEY="your-api-key"
export OKX_DEMO_SECRET_KEY="your-secret-key"
export OKX_DEMO_PASSPHRASE="your-passphrase"
# LLM API Key (required for AI analysis)
export MINIMAX_API_KEY="your-minimax-key"
# Optional settings
export OKX_MODE="demo" # "demo" (default) or "live"
export OKX_TRADE_CONFIRM="true" # Require confirmation before trades3. Start the MCP Server
node bin/okx-trade-mcp.mjsOr add to your MCP client config:
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"okx-trade": {
"command": "node",
"args": ["/path/to/mcp/bin/okx-trade-mcp.mjs"],
"env": {
"OKX_DEMO_API_KEY": "your-key",
"OKX_DEMO_SECRET_KEY": "your-secret",
"OKX_DEMO_PASSPHRASE": "your-pass",
"MINIMAX_API_KEY": "your-minimax-key",
"OKX_MODE": "demo"
}
}
}
}OpenClaw: Install via ClawHub or add manually in Settings → MCP Servers.
4. Start Chatting
"What's the BTC price?"
"Run a full analysis on BTC"
"Show me ETH technical analysis with 4H candles"
"Open a 10x long BTC position"Related MCP server: Bybit AI Trader
🔑 Configuration
OKX API Key (Required for Trading)
Log in to OKX
Go to API Management → Create API Key
Permissions needed: Read + Trade (do NOT enable Withdraw)
Important: Do NOT set IP whitelist (MCP runs locally with dynamic IPs)
Demo mode (default): Uses OKX demo trading environment — no real money involved.
Env Variable | Description |
| Demo API Key |
| Demo Secret Key |
| Demo Passphrase |
| Live API Key (when OKX_MODE=live) |
| Live Secret Key |
| Live Passphrase |
LLM API Key (Required for AI Analysis)
The AI co-pilot uses MiniMax M2.5 for multi-agent analysis.
Sign up at MiniMax Platform
Create an API Key
Set
MINIMAX_API_KEYenvironment variable
Without LLM key: Market Data, Account, Trading, and Rules tools still work. Only AI Copilot tools require the LLM key.
Optional Settings
Env Variable | Default | Description |
|
|
|
|
|
|
|
| Custom data directory for rules, prompts, config |
🛠 Available Tools (19)
Market Data (4 tools) — No API key needed
Tool | Description | Example |
| Real-time price, 24h change, volume | "What's the BTC price?" |
| OHLCV candle data (1m~1D, up to 300) | "Show me ETH 4H candles" |
| RSI, MACD, Bollinger Bands, Moving Averages | "Technical analysis for SOL" |
| Open Interest, Long/Short Ratio, Funding Rate | "What's the BTC funding rate?" |
Account (2 tools) — Requires OKX API key
Tool | Description | Example |
| All currencies with USD equivalent | "What's my balance?" |
| Open positions + PnL + leverage + margin | "Show my positions" |
AI Analysis (3 tools) — Requires LLM key
Tool | Description | Example |
| Full 4-agent analysis → signal + conviction | "Analyze BTC for me" |
| Run one agent (macro/technical/risk) | "What does the macro agent think about ETH?" |
| Detailed plan: entry, SL, TP, risk/reward | "Generate a trading plan" |
Trading (2 tools) — Requires OKX API key
Tool | Description | Example |
| Market order with leverage + SL/TP | "Open 10x long BTC, SL at 70000" |
| Close an existing position | "Close my ETH position" |
Rules (3 tools)
Tool | Description | Example |
| View all hard + soft trading rules | "List my rules" |
| Check if a trade passes hard rules | "Can I go long BTC now?" |
| Add rule via natural language | "Block trades when funding > 0.1%" |
Skills & Config (5 tools)
Tool | Description | Example |
| View 6 analysis skills and status | "What skills are available?" |
| Enable/disable skills per agent | "Enable fibonacci for technical agent" |
| View agent system prompts | "Show me the current prompts" |
| Customize an agent's prompt | "Make technical agent focus on volume" |
| Configure temperature, max tokens | "Set temperature to 0.3" |
💬 Usage Examples
Market Analysis
"What's the current BTC price and 24h change?"
"Show me ETH technical analysis with 4H candles"
"What's the current funding rate for BTC?"
"Get the open interest and long/short ratio for SOL"AI Co-Pilot
"Run a full analysis on BTC"
"What does the macro agent think about ETH?"
"Run technical analysis only for SOL"
"Generate a trading plan based on the analysis"Trading
"Open a 10x long BTC position with 10 contracts"
"Place a short ETH order with SL at 4000 and TP at 3500"
"Close my BTC-USDT-SWAP position"
"Show my current positions and P&L"Rules Management
"Add a rule: block all trades when funding rate > 0.1%"
"Add a rule: don't go long when L/S ratio > 2"
"List my trading rules"
"Check if a BTC long trade would pass my rules"Customization
"Show me the current agent prompts"
"Update the technical agent prompt to focus more on volume analysis"
"Enable fibonacci and candlestick-patterns skills for technical agent"
"Disable the fear-greed-index skill"
"Set LLM temperature to 0.3"🤖 AI Agents
The co-pilot runs 4 AI agents:
Agent | Role | Focus |
🌐 Macro Analyst | Macro environment | Fed policy, DXY, ETF flows, on-chain data |
📊 Technical Analyst | Chart analysis | RSI, MACD, Bollinger Bands, trend, key levels |
🛡️ Risk Manager | Risk assessment | Position sizing, leverage, stop-loss, max risk |
👔 Portfolio Manager | Final decision | Synthesizes all reports → LONG/SHORT/HOLD + conviction |
Workflow: Macro + Technical + Risk run in parallel → Portfolio Manager synthesizes → Final signal
⚙️ Analysis Skills (6)
Skill | Description | Agents |
| Fibonacci retracement from swing H/L | Technical, Manager |
| Doji, Engulfing, Hammer detection | Technical, Manager |
| Volume distribution + POC | Technical, Risk |
| OI changes, L/S ratio trends | Technical, Risk, Manager |
| Classify Low/Normal/High/Extreme | Risk, Manager |
| Crypto market sentiment (0-100) | Macro, Manager |
All skills are enabled by default. Use okx_configure_skills to customize.
🎨 Canvas Dashboard
For OpenClaw users, two HTML templates are included for visual rendering:
dashboard.html— Main trading dashboard (price, positions, signal, chart)analysis-report.html— Full analysis report (agent cards, trading plan, reasoning)
Ask the agent: "Show me the dashboard" or "Render the analysis report"
📋 Supported Instruments
Instrument | SWAP | SPOT |
BTC-USDT | ✅ | ✅ |
ETH-USDT | ✅ | ✅ |
SOL-USDT | ✅ | ✅ |
OKB-USDT | ✅ | ✅ |
🔒 Security
✅ All API keys stay local — stored in environment variables, never transmitted
✅ Zero hardcoded credentials — npm package contains no secrets
✅ Tool responses never include API keys — all sensitive data stripped
✅ Default demo mode — must explicitly opt-in to live trading
✅ Trade confirmation — optional preview before execution
✅ No third-party data sharing — only connects to OKX API and LLM provider
✅ Hard rules auto-enforcement — programmatic blocks cannot be bypassed
🔧 Testing
MCP Inspector
npx @modelcontextprotocol/inspector node bin/okx-trade-mcp.mjsClaude Desktop
Add to claude_desktop_config.json and restart Claude Desktop.
OpenClaw
Install the plugin from ClawHub or add as custom MCP server.
📄 License
MIT
🌐 Links
Available Tools
19 toolsokx_add_ruleA
Add a new trading rule using natural language. The system auto-classifies it as hard (quantitative) or soft (qualitative). Examples: "Block all trades when funding rate > 0.1%", "Prefer to follow the trend".
Inputs: text (required).
okx_close_positionA
Close an open position by placing a reduce-only market order in the opposite direction
Inputs: instrument (required), confirm.
okx_configure_skillsA
Enable or disable specific skills for specific agents. Saves configuration persistently.
Inputs: agentId (required), enabledSkills (required).
okx_evaluate_rulesA
Evaluate hard rules against current market state. Returns whether a proposed trade (signal) would be allowed or blocked.
Inputs: signal (required), instrument.
okx_generate_trading_planA
Generate a detailed executable trading plan from a co-pilot analysis result. Must run okx_run_copilot first to get the analysis result, then pass it here.
Inputs: coPilotResult (required), instrument.
okx_get_balanceA
Get account balance — all currencies with USD equivalent. Requires OKX API key configured.
Inputs: no named parameters.
okx_get_candlesB
Fetch OHLCV candle data for chart analysis. Returns up to 300 candles.
Inputs: bar, limit, instType, instrument.
okx_get_market_dataA
Get derivatives market data: Open Interest, Long/Short Ratio, and Funding Rate for perpetual contracts
Inputs: instrument.
okx_get_positionsB
Get all open positions with P&L, leverage, margin ratio. Requires OKX API key.
Inputs: instType.
okx_get_promptsA
View the current system prompts for all 4 AI agents. Shows both default and custom prompts.
Inputs: agentId.
okx_get_tickerA
Get current price, 24h change, and volume for any OKX instrument (BTC-USDT, ETH-USDT, SOL-USDT, OKB-USDT)
Inputs: instType, instrument.
okx_list_rulesA
List all user trading rules. Hard rules are programmatic checks (metric + operator + threshold → block/allow). Soft rules are natural language injected into AI prompts.
Inputs: no named parameters.
okx_list_skillsA
List all 6 available analysis skills with descriptions and which agents they apply to. Shows current enabled/disabled status.
Inputs: no named parameters.
okx_place_orderA
Place a market order on OKX. SWAP: sets leverage + optional SL/TP. SPOT: simple buy/sell. Use confirm=true to preview before executing.
Inputs: side (required), size (required), instrument (required), confirm, +4 more.
okx_run_copilotA
Run full 4-agent AI analysis (macro + technical + risk + portfolio manager). Returns signal, conviction, summary, reasoning, and suggested action. Requires LLM API key (MINIMAX_API_KEY).
Inputs: instType, instrument, enabledSkills, disabledAgents.
okx_run_single_agentB
Run a single AI analysis agent (macro, technical, or risk). Faster than full co-pilot. Returns the agent's analysis report.
Inputs: agentId (required), instType, instrument, enabledSkills.
okx_set_llm_configA
Configure LLM settings (temperature, max tokens). v1 supports MiniMax only; architecture is ready for future providers.
Inputs: model, maxTokens, temperature.
okx_technical_analysisA
Run full technical analysis: RSI (14), MACD (12,26,9), Bollinger Bands (20,2), Moving Averages (20,50,200). Returns formatted report with bull/bear signal counts.
Inputs: bar, instType, instrument.
okx_update_promptA
Customize an agent's system prompt. The JSON output format suffix is automatically appended. Set prompt to empty string to reset to default.
Inputs: prompt (required), agentId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Each tool targets a distinct resource/action (market data, account, orders, AI agents, rules, skills, prompts). The only potential confusion is between get_ticker and get_market_data, but the latter is derivatives-specific and the former covers all instruments. Overall clear separation.
All tools share the okx_ prefix and use verb_noun (or verb_adj_noun) structure consistently, e.g., get_candles, place_order, list_rules, update_prompt. The single exception is technical_analysis which lacks a verb but is still readable. Pattern is predictable and easy to navigate.
19 tools is on the heavier side but justified by the breadth of the domain: market data, account management, trading execution, AI agents, rules, skills, and configuration. Each tool maps to a distinct feature, so the count is appropriate for a comprehensive trading copilot.
Core trading lifecycle is covered: market data, analysis, balance, positions, place/close orders. The rule-based risk system and AI agent customization add depth. Missing order history and cancel order, but these are secondary gaps that don't break the core workflow.
Maintenance
Related MCP Connectors
Crypto screener for AI agents: Binance, Bybit, OKX, Hyperliquid data, trends, charts and alerts.
AI agent access to Asian crypto markets. Korean exchange routing and x402 paid APIs.
Crypto market signals, technical indicators, and sentiment analysis for AI agents.
Trade 16 crypto exchanges + MetaTrader 5 from your AI assistant via one MCP connection.
Related MCP Servers
- AlicenseBqualityDmaintenanceTransforms AI assistants into autonomous crypto trading agents with real-time market analysis, portfolio management, and trade execution across 17+ blockchains.3279 npm58MIT
- FlicenseNot gradedqualityNot gradedmaintenanceAI trading assistant for Bybit cryptocurrency exchange that analyzes markets in real-time, identifies trading opportunities, and executes trades with user confirmation through Cursor IDE integration.1-
- AlicenseNot gradedqualityCmaintenanceConnects AI assistants to OKX cryptocurrency exchange for trading, market data, account management, and more via the Model Context Protocol.30MIT

okx-trade-mcpofficial
AlicenseNot gradedqualityBmaintenanceMCP server connecting AI assistants to OKX exchange, enabling trading, market data, account management, and more via 150+ tools across 11 modules.510MIT