OKX
- javascript
16
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"esshka-okx-mcp": {
"command": "node",
"args": [
"/path/to/okx-mcp-server/build/index.js"
]
}
}
}You can run the OKX MCP Server to fetch real-time and historical cryptocurrency price data from the OKX exchange. It exposes two simple tools for clients to query price information and candlestick data, enabling you to build responsive dashboards, alerts, or trading workflows without handling raw API calls yourself.
How to use
You connect to the OKX MCP Server using an MCP client and call the available tools to retrieve data. Use the candlestick tool to fetch historical OHLCV data for a given instrument and bar interval, or use the price tool to obtain the latest price along with 24-hour market data. Each tool returns structured data you can render in charts, monitors, or alerts.
How to install
Prerequisites: ensure Node.js and npm are installed on your system.
Install dependencies for the MCP server project.
Build the MCP server to produce the runnable artifacts.
Optionally, enable automatic rebuilding during development.
Run the server using the provided MCP configuration. The example shows how to run the server via a local node process.
Follow these exact commands in sequence.
npm install
npm run build
npm run watch
Additional sections
Configuration is provided in a JSON block that maps an MCP server name to its runner command and arguments. The example below shows how to start the OKX MCP Server locally using Node.
{
"mcpServers": {
"okx": {
"command": "node",
"args": ["/path/to/okx-mcp-server/build/index.js"],
"disabled": false,
"autoApprove": []
}
}
}
Notes on error handling and security
The server includes comprehensive error handling for network issues, invalid instrument IDs, and API rate limits. Errors are logged for debugging, and requests are guarded against common failure modes to provide stable operation in production environments.
Available tools
get_price
Fetches the latest price and 24-hour market data for a given instrument on OKX, returning instrument, lastPrice, bid, ask, high24h, low24h, volume24h, and timestamp.
get_candlesticks
Retrieves historical candlestick data for an instrument with a configurable bar interval and limit, returning an array of candlestick objects with timestamp, open, high, low, close, volume, and volumeCurrency.