Skip to main content
Glama
OKX MCP Server

OKX MCP Server

by esshka

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"
}

Related MCP server: OKX MCP Server

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

Installation

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.json

macOS (Claude Desktop):

~/Library/Application Support/Claude/claude_desktop_config.json

Windows (VSCode):

%APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Windows (Claude Desktop):

%APPDATA%/Claude/claude_desktop_config.json

Configuration:

{
  "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 tools
get_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

    B3.1/5.0

    Scored across 2 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count2/5

    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.

    Completeness2/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      F
      maintenance
      A 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.
      12
      16
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Provides real-time and historical cryptocurrency price data from the OKX exchange, including live WebSocket updates, candlestick charts, and visual price analysis for trading pairs.
      5
      3
      ISC
    • F
      license
      B
      quality
      D
      maintenance
      Provides 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
      -