OKX MCP Server

OKX MCP Server

Provides real-time cryptocurrency price data from OKX exchange through a Model Context Protocol interface, allowing access to historical candlestick data and current market prices for any trading instrument.

esshka

Finance
Visit Server

Tools

get_price

Get latest price for an OKX instrument

get_candlesticks

Get candlestick data for an OKX instrument

README

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

Recommended Servers

Crypto Price & Market Analysis MCP Server

Crypto Price & Market Analysis MCP Server

A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.

Featured
TypeScript
chromia-mcp

chromia-mcp

Enables AI to interact with Chromia Wallet for sending $CHR transactions.

Official
Local
TypeScript
TripleWhale MCP Server

TripleWhale MCP Server

An implementation of Model Context Protocol (MCP) that allows users to interact with TripleWhale's e-commerce analytics platform using natural language queries through Claude Desktop.

Official
Local
TypeScript
Adamik MCP Server

Adamik MCP Server

Enables read and write interactions with 60+ blockchain networks through Claude Desktop, providing a standardized multi-chain API for transaction management, account insights, staking, and token interactions.

Official
Local
TypeScript
Open-Ledger-MCP-Server

Open-Ledger-MCP-Server

A Model Context Protocol (MCP) server implementation for the OpenLedger API. This server provides structured context to AI models according to the MCP specification.

Official
TypeScript
ntropy-mcp MCP Server

ntropy-mcp MCP Server

Enables enriching banking data with the Ntropy API, providing tools to create account holders and enrich transactions efficiently.

Official
Python
Iaptic MCP Server

Iaptic MCP Server

A server for interacting with the Iaptic API, allowing AI models like Claude to query customer, purchase, and transaction data, as well as retrieve statistical insights.

Official
TypeScript
Bitrefill Search and Shop

Bitrefill Search and Shop

This MCP wraps Bitrefill public API to allow agents to search for products and shop using cryptocurrencies like Bitcoin, Ethereum, Solana, and many more.

Official
TypeScript
MCP EVM Signer

MCP EVM Signer

A server that securely manages Ethereum private keys locally and enables Claude for Desktop to interact with EVM-compatible blockchains through Infura.

Local
TypeScript
Cryptocurrency Daemon MCP Server

Cryptocurrency Daemon MCP Server

Enables secure interactions with cryptocurrency daemon RPC interfaces through AI assistants, supporting transaction management, wallet operations, and daemon monitoring for Bitcoin-derived cryptocurrencies.

Local
TypeScript