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.
通过模型上下文协议接口提供来自 OKX 交易所的实时加密货币价格数据,允许访问任何交易工具的历史烛台数据和当前市场价格。
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 -2
- -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 -11MIT License