OKX MCP Server
This server provides access to real-time and historical cryptocurrency market data from the OKX exchange.
Retrieve candlestick data: Get historical OHLCV data for any instrument with customizable time intervals (
1m,5m,1H,1D) and limits (max 100).Fetch latest price: Get real-time price and 24-hour market data (lastPrice, bid, ask, high24h, low24h, volume24h) for any OKX instrument.
Comprehensive error handling: Includes network error handling, invalid instrument checks, API rate limiting, and error logging.
Provides real-time cryptocurrency price data from the OKX exchange, offering tools to retrieve latest prices and historical candlestick (OHLCV) data for any instrument traded on OKX.
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 get price for BTC-USDT"
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
A Model Context Protocol server that provides real-time cryptocurrency price data from OKX exchange.
Features
This MCP server connects to the OKX API to provide cryptocurrency price information through a simple tool interface. It includes comprehensive error handling, request logging, and rate limiting via OKX's API.
Tools
get_candlesticks
Retrieves historical candlestick (OHLCV) data for any instrument on OKX.
Input:
instrument: String (required) - Instrument ID (e.g. "BTC-USDT")bar: String (optional) - Time interval (e.g. "1m", "5m", "1H", "1D"), default "1m"limit: Number (optional) - Number of candlesticks to return (max 100), default 100
Output: Array of JSON objects, each containing:
timestamp: ISO timestamp of the candlestickopen: Opening pricehigh: Highest pricelow: Lowest priceclose: Closing pricevolume: Trading volumevolumeCurrency: Volume in currency terms
Example usage:
[
{
"timestamp": "2025-03-07T17:00:00.000Z",
"open": "87242.8",
"high": "87580.2",
"low": "86548.0",
"close": "87191.8",
"volume": "455.72150427",
"volumeCurrency": "39661166.242091111"
}
]get_price
Fetches the latest price and 24-hour market data for any instrument on OKX.
Input:
instrument: String (required) - Instrument ID (e.g. "BTC-USDT")
Output: JSON object containing:
instrument: The requested instrument IDlastPrice: Latest trade pricebid: Current best bid priceask: Current best ask pricehigh24h: 24-hour high pricelow24h: 24-hour low pricevolume24h: 24-hour trading volumetimestamp: ISO timestamp of the data
Example usage:
{
"instrument": "BTC-USDT",
"lastPrice": "65432.1",
"bid": "65432.0",
"ask": "65432.2",
"high24h": "66000.0",
"low24h": "64000.0",
"volume24h": "1234.56",
"timestamp": "2024-03-07T17:22:28.000Z"
}Related MCP server: OKX MCP Server
Development
Install dependencies:
npm installBuild the server:
npm run buildFor development with auto-rebuild:
npm run watchInstallation
To use with Claude Desktop or VSCode, add the server config to your MCP settings:
macOS (VSCode):
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonmacOS (Claude Desktop):
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows (VSCode):
%APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonWindows (Claude Desktop):
%APPDATA%/Claude/claude_desktop_config.jsonConfiguration:
{
"mcpServers": {
"okx": {
"command": "node",
"args": ["/path/to/okx-mcp-server/build/index.js"],
"disabled": false,
"autoApprove": []
}
}
}Error Handling
The server implements comprehensive error handling:
Network errors are captured and returned with context
Invalid instrument IDs return appropriate error messages
API rate limits are respected through axios timeout configuration
All errors are logged for debugging purposes
Available Tools
2 toolsget_candlesticksC
Get candlestick data for an OKX instrument
Inputs: instrument (required), bar, limit.
get_priceC
Get latest price for an OKX instrument
Inputs: instrument (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have distinct purposes: get_candlesticks retrieves historical price data in candlestick format, while get_price fetches the latest price. There is minimal overlap as they target different data types (historical vs. current), though both relate to instrument pricing which could cause slight confusion in some contexts.
Both tools follow a consistent verb_noun naming pattern (get_candlesticks, get_price) with clear, descriptive names. The snake_case style is uniform throughout, making the tools easy to identify and predict.
With only 2 tools, the server feels severely under-scoped for a financial trading platform like OKX. This minimal set lacks essential operations such as placing orders, managing accounts, or accessing market depth, which are core to trading workflows.
The tool surface is highly incomplete for an OKX server, covering only price data retrieval. There are significant gaps in trading functionality (e.g., no create_order, cancel_order), account management, or market data beyond basic prices, which will likely cause agent failures in typical trading scenarios.
Maintenance
Related MCP Connectors
Real-time crypto market data: candles, tickers, orderbooks across 13+ exchanges via MCP.
Crypto market data for AI agents: live prices, OHLCV, sentiment, indicators and exchanges.
Real-time crypto prices from Binance, Coinbase, Kraken, OKX, and Bybit
Aligned market data for AI agents: crypto, stocks, FX and macro on one clock. Local or hosted.
Related MCP Servers
- AlicenseBqualityFmaintenanceA Model Context Protocol server that provides read-only access to Bybit's cryptocurrency exchange API, allowing users to query real-time cryptocurrency data using natural language.1216MIT
- -licenseBqualityDmaintenanceProvides real-time cryptocurrency price data from OKX exchange through a Model Context Protocol interface.2-
- AlicenseBqualityDmaintenanceProvides real-time and historical cryptocurrency price data from the OKX exchange, including live WebSocket updates, candlestick charts, and visual price analysis for trading pairs.53ISC
- FlicenseBqualityDmaintenanceProvides access to Tastytrade historical price data via the Model Context Protocol. It enables users to retrieve historical candle data for specific financial symbols and time intervals.1-