okx-mcp
OKX MCP Server
Documentation
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 candlestick
- `open`: Opening price
- `high`: Highest price
- `low`: Lowest price
- `close`: Closing price
- `volume`: Trading volume
- `volumeCurrency`: 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 ID
- `lastPrice`: Latest trade price
- `bid`: Current best bid price
- `ask`: Current best ask price
- `high24h`: 24-hour high price
- `low24h`: 24-hour low price
- `volume24h`: 24-hour trading volume
- `timestamp`: 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"
}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
Frequently asked questions
What is okx-mcp?
okx-mcp is OKX MCP Server
How do I install okx-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is okx-mcp open source?
Yes — it is hosted on GitHub at https://github.com/esshka/okx-mcp and has 16 stars.
Related MCP tools
🔥 Official Firecrawl MCP Server - Adds powerful web scraping and search to Cursor, Claude and any other LLM clients.
Use any LLMs (Large Language Models) for Deep Research. Support SSE API and MCP server.
Enhanced MCP server for interactive user feedback and command execution in AI-assisted development, featuring dual interface support (Web UI and Desktop Application) with intelligent environment detection and cross-platform compatibility.
A powerful Zotero AI and MCP plugin with ChatGPT, Gemini 3.7, Claude Fable 5, Claude Opus 5, DeepSeek V4, Grok, OpenRouter, Kimi k3, GLM 5.3, SiliconFlow, GPT-oss, Gemma 4, Qwen 3.8
Connect your browser to AI models. Just use Dia on Chrome, Arc or Firefox.
文颜 MCP Server 可以让 AI 自动将 Markdown 文章排版后发布至微信公众号。
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP