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.
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:
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:
Development
Install dependencies:
Build the server:
For development with auto-rebuild:
Installation
To use with Claude Desktop or VSCode, add the server config to your MCP settings:
macOS (VSCode):
macOS (Claude Desktop):
Windows (VSCode):
Windows (Claude Desktop):
Configuration:
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
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
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.
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityProvides real-time and historical cryptocurrency market data through integration with major exchanges. This server enables LLMs like Claude to fetch current prices, analyze market trends, and access detailed trading information.Last updated -754MIT License
- -securityFlicense-qualityA cryptocurrency price query service based on Model Context Protocol that provides tools for retrieving virtual currency prices, market trends, detailed information, and K-line data.Last updated -3
- -securityAlicense-qualityProvides Claude AI with real-time access to Bitcoin price data, including current price in USD, 24-hour change percentage, and market cap information.Last updated -2MIT License
- -securityAlicense-qualityA server that provides real-time cryptocurrency data through the Model Context Protocol, allowing access to detailed exchange information and current cryptocurrency rates from the CoinCap API.Last updated -01MIT License