OKX MCP Server
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.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OKX MCP Serverget price for BTC-USDT"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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:
[
{
"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 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:
{
"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 installBuild the server:
npm run buildFor development with auto-rebuild:
npm run watchInstallation
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.jsonmacOS (Claude Desktop):
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows (VSCode):
%APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.jsonWindows (Claude Desktop):
%APPDATA%/Claude/claude_desktop_config.jsonConfiguration:
{
"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 toolsget_candlesticksC
Get candlestick data for an OKX instrument
| Name | Required | Description | Default |
|---|---|---|---|
| instrument | Yes | Instrument ID (e.g. BTC-USDT) | |
| bar | No | Time interval (e.g. 1m, 5m, 1H, 1D) | 1m |
| limit | No | Number of candlesticks (max 100) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't describe important behavioral aspects: whether this is a read-only operation, rate limits, authentication requirements, error conditions, or what format the candlestick data returns. For a financial data tool with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that states the core purpose without any wasted words. It's appropriately sized for a straightforward data retrieval tool and gets directly to the point. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of financial data retrieval (with no output schema), the description is incomplete. It doesn't explain what candlestick data includes (open, high, low, close, volume), the return format, pagination behavior, or error handling. With no annotations and no output schema, the agent lacks crucial context about what to expect from this tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all three parameters thoroughly with descriptions, defaults, and constraints. The description adds no additional parameter semantics beyond what's in the schema. This meets the baseline expectation when the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Get') and resource ('candlestick data for an OKX instrument'), making the purpose immediately understandable. It doesn't explicitly differentiate from the sibling tool 'get_price', but the resource specificity (candlestick data vs. price) provides implicit distinction. The description is not vague or tautological.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus the sibling 'get_price' or any alternatives. There's no mention of use cases, prerequisites, or exclusions. The agent must infer usage from the tool name and description alone without explicit direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_priceB
Get latest price for an OKX instrument
| Name | Required | Description | Default |
|---|---|---|---|
| instrument | Yes | Instrument ID (e.g. BTC-USDT) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. While 'Get latest price' implies a read operation, it doesn't specify whether this requires authentication, has rate limits, returns cached or real-time data, or what happens with invalid instrument IDs. The description provides minimal behavioral context beyond the basic operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that communicates the core purpose without any wasted words. It's appropriately sized for a simple tool with one parameter and gets straight to the point.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple price lookup tool with good schema coverage but no annotations or output schema, the description is minimally adequate. It states what the tool does but lacks important context about authentication requirements, error conditions, rate limits, and what format the price is returned in (which is especially important without an output schema).
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the single parameter 'instrument' already documented as 'Instrument ID (e.g. BTC-USDT)'. The description doesn't add any additional parameter semantics beyond what the schema provides, so it meets the baseline score when schema coverage is high.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Get latest price') and resource ('for an OKX instrument'), making the purpose immediately understandable. It doesn't specifically differentiate from its sibling 'get_candlesticks' (which presumably provides historical price data rather than latest price), so it doesn't reach the highest score for sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. There's no mention of the sibling tool 'get_candlesticks' or any other potential alternatives, nor does it specify any prerequisites or contextual constraints for usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
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.
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.
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.
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
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Real-time crypto market data: candles, tickers, orderbooks across 13+ exchanges via MCP.
Real-time crypto prices from Binance, Coinbase, Kraken, OKX, and Bybit
Provide real-time cryptocurrency price data and market analysis.
Verified market data for AI trading agents: quality-flagged candles, funding, OI, order flow. x402.
Related MCP Servers
- AlicenseBqualityFmaintenanceA 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.122216MIT
- -licenseBqualityDmaintenanceProvides real-time cryptocurrency price data from OKX exchange through a Model Context Protocol interface.2
- AlicenseBqualityDmaintenanceProvides real-time and historical cryptocurrency price data from the OKX exchange, including live WebSocket updates, candlestick charts, and visual price analysis for trading pairs.5153MIT
- FlicenseBqualityDmaintenanceProvides 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
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/esshka/okx-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server