This server provides real-time cryptocurrency price data from OKX exchange through the Model Context Protocol framework. It allows AI assistants to access current and historical price information for any cryptocurrency instrument available on OKX.
To install and configure the OKX MCP server, follow these steps:
Ensure you have Node.js installed on your system.
npm install
npm run build
Add the server to your MCP settings based on your operating system and application:
For VSCode
MacOS:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Windows:
%APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
For Claude Desktop
MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%/Claude/claude_desktop_config.json
Add the following configuration to your MCP settings file:
{
"mcpServers": {
"okx": {
"command": "node",
"args": ["/path/to/okx-mcp-server/build/index.js"],
"disabled": false,
"autoApprove": []
}
}
}
Make sure to replace /path/to/okx-mcp-server
with the actual path where you installed the server.
The OKX MCP server provides two main tools for accessing cryptocurrency data:
The get_price
tool provides the latest price and 24-hour market data for any cryptocurrency instrument on OKX.
Input parameters:
instrument
: String (required) - Instrument ID (e.g., "BTC-USDT")Example output:
{
"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"
}
The get_candlesticks
tool retrieves historical OHLCV (Open, High, Low, Close, Volume) data for any instrument on OKX.
Input parameters:
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 100Example output:
[
{
"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"
}
]
The server implements comprehensive error handling:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.