OKX MCP Server
Provides tools for interacting with OKX cryptocurrency exchange, enabling account management (balance, positions, configuration), trading operations (placing and canceling orders, order history, position liquidation), and market data retrieval.
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., "@OKX MCP Server show me my current account balance"
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.
🆗 OKX MCP Server
📲 Install
Method 1: uvx
{
"mcpServers": {
"mcp-okx": {
"command": "uvx",
"args": ["mcp-okx"],
"env": {
"OKX_API_KEY": "your-okx-api-key",
"OKX_API_SECRET": "api-secret-key",
"OKX_PASSPHRASE": "api-passphrase",
"OKX_TRADE_FLAG": "1", # 0: Production trading, 1: Demo trading
"OKX_BASE_URL": "https://www.okx.com", # Optional
"MCP_AUTH_TOKEN": "your-custom-token" # Default same as OKX_API_KEY
}
}
}
}Method 2: Docker
mkdir /opt/mcp-okx
cd /opt/mcp-okx
wget https://raw.githubusercontent.com/aahl/mcp-okx/refs/heads/main/docker-compose.yml
docker-compose up -d{
"mcpServers": {
"mcp-okx": {
"url": "http://0.0.0.0:8811/mcp", # Streamable HTTP
"headers": {
"Authorization": "Bearer your-okx-api-key-or-custom-token"
}
}
}
}⚙️ Environment variables
OKX_API_KEY: API key of your OKX account. Please refer to my api page regarding API Key creation.OKX_API_SECRET: API secret key of your OKX account.OKX_PASSPHRASE: API passphrase of your OKX account.OKX_TRADE_FLAG: 0: Production trading, 1: Demo tradingOKX_BASE_URL: Base URL of OKX. Default:https://www.okx.comMCP_AUTH_TOKEN: Custom token for authentication. Default same asOKX_API_KEY
Related MCP server: okx-trade-mcp
🛠️ Available Tools
account_config- Get account configurationaccount_balance- Get account balanceaccount_positions- Get account positionsaccount_position_risk- Get account position risk
place_order- Place a new ordercancel_order- Cancel an incomplete orderget_trade_order- Get order detailsget_order_list- Get incomplete order listget_orders_history- Get Order Historyclose_positions- Liquidate all positions
market_tickers- Get cryptocurrency rankings
Available Tools
11 toolsaccount_balanceGet account balanceA
Retrieve a list of assets (with non-zero balance), remaining balance, and available amount in the OKX trading account
Inputs: ccy.
account_configGet account configurationA
Retrieve current OKX account configuration. It is recommended to use this tool to obtain account configuration information before using all other tools
Inputs: no named parameters.
account_position_riskGet account position riskC
Obtain the overall holding risk of the OKX account
Inputs: instType.
account_positionsGet account positionsA
Retrieve information on your OKX positions. When the account is in net mode, net positions will be displayed, and when the account is in long/short mode, long or short positions will be displayed. Return in reverse chronological order using ctime.
Inputs: instType, instId, posId.
cancel_orderCancel an incomplete orderC
Cancel an incomplete order on OKX
Inputs: instId (required), ordId, clOrdId.
close_positionsClose positionsA
Liquidate all positions in the designated trading product at market price on OKX
Inputs: instId (required), mgnMode (required), posSide, ccy, +3 more.
get_order_listGet incomplete order listC
Retrieve all incomplete orders under the current OKX account. For a detailed schema of the output object, please read the resource at: schema://trade/order
Inputs: instType, instFamily, instId, state, +1 more.
get_orders_historyGet Order HistoryB
Get completed orders on OKX which are placed in the last 7 days, including those placed 7 days ago but completed in the last 7 days.The incomplete orders that have been canceled are only reserved for 2 hours. For a detailed schema of the output object, please read the resource at: schema://trade/order
Inputs: instType (required), instFamily, instId, state, +3 more.
get_trade_orderGet order detailsC
Retrieve order details on OKX. For a detailed schema of the output object, please read the resource at: schema://trade/order
Inputs: instId (required), ordId, clOrdId.
market_tickersGet market tickersC
Retrieve the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours.Get the ranking of coins with the highest increase or the largest trading volume.
Inputs: instType, instFamily, sortBy, limit.
place_orderPlace a new orderC
Place a new order on OKX for trading
Inputs: instId (required), tdMode (required), side (required), ordType (required), +13 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Most tools have distinct purposes, such as account_balance for balances, place_order for trading, and market_tickers for market data. However, get_order_list, get_orders_history, and get_trade_order could cause confusion as they all retrieve order information with overlapping scopes, though descriptions clarify differences like incomplete vs. completed orders.
Tool names consistently follow a verb_noun or noun_verb pattern with snake_case throughout, such as account_balance, cancel_order, and market_tickers. This uniformity makes the set predictable and easy to navigate for an agent.
With 11 tools, the server is well-scoped for an OKX trading platform, covering account management, order handling, and market data. Each tool serves a clear purpose without being overly sparse or bloated, fitting typical expectations for such a domain.
The tool set provides comprehensive coverage for core trading operations, including account info, order placement, cancellation, and market data. A minor gap exists in lacking tools for modifying existing orders or positions beyond cancellation and liquidation, but agents can work around this with the available tools.
Maintenance
Related MCP Connectors
Place and inspect orders on your own exchange accounts from an MCP-connected agent.
Trend and order-flow signals for OKX USDT perpetual swaps, over MCP. Pay per call.
Trade 16 crypto exchanges + MetaTrader 5 from your AI assistant via one MCP connection.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceConnects AI assistants to OKX cryptocurrency exchange for trading, market data, account management, and more via the Model Context Protocol.30MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with OKX cryptocurrency exchange, providing tools for market data, trading, account management, and more through the Model Context Protocol.116MIT
- AlicenseDqualityCmaintenanceEnables AI agents to access the full OKX exchange API for trading, market data, account management, and more through 300+ MCP tools.10099 npm1MIT
- AlicenseNot gradedqualityFmaintenanceProvides Claude with access to blockchain data and market prices via the OKX API, enabling operations like retrieving asset prices, transaction history, and executing swaps.3MIT