You signed in with another tab or window. Reload
to refresh your session. You signed out in another tab or window. Reload
to refresh your session. You switched accounts on another tab or window. Reload
to refresh your session. Dismiss alert
badger3000 / okx-mcp-server Public
1 star
0 forks
Branches
Tags
Activity
Notifications
You must be signed in to change notification settings
master
Go to file
Code
| Name | | Name | Last commit message | Last commit date |
| --- | --- | --- | --- |
| Latest commit
-------------
badger3000
added ignore file
Mar 15, 2025
7bc74ff
· Mar 15, 2025
History
-------
6 Commits
| | |
| build | | build | WebSocket Support for Real-time Updates | Mar 15, 2025 |
| src | | src | WebSocket Support for Real-time Updates | Mar 15, 2025 |
| .envExamples | | .envExamples | init | Mar 15, 2025 |
| .gitignore | | .gitignore | added ignore file | Mar 15, 2025 |
| README.md | | README.md | WebSocket Support for Real-time Updates | Mar 15, 2025 |
| package-lock.json | | package-lock.json | WebSocket Support for Real-time Updates | Mar 15, 2025 |
| package.json | | package.json | WebSocket Support for Real-time Updates | Mar 15, 2025 |
| tsconfig.json | | tsconfig.json | init | Mar 15, 2025 |
| View all files | | |
This project creates a Model Context Protocol (MCP) server that fetches real-time cryptocurrency data from the OKX exchange. It allows AI assistants like Claude to access up-to-date cryptocurrency price information and historical data through defined tools with enhanced visualization capabilities and WebSocket live updates.
get_price
: Fetches the latest price data for a cryptocurrency trading pair with visual formattingget_candlesticks
: Retrieves historical candlestick data with visualization options including ASCII chartssubscribe_ticker
: Subscribes to real-time WebSocket updates for a trading pairget_live_ticker
: Retrieves the latest live data from WebSocket connectionunsubscribe_ticker
: Stops receiving updates for a specific trading pairClone the repository
shell
git clone https://github.com/yourusername/okx-mcp-server.git
cd okx-mcp-server
Install dependencies
shell
npm install
Add the WebSocket dependency
shell
npm install ws
npm install --save-dev @types/ws
Build the project
shell
npm run build
Make the compiled script executable
shell
chmod +x build/index.js
You can run the server directly with:
npm start
Or:
node build/index.js
To test your MCP server before integration:
npx @modelcontextprotocol/inspector node build/index.js
In the inspector, you can test:
get_price
with input: { "instrument": "BTC-USDT", "format": "markdown" }
get_candlesticks
with input: { "instrument": "BTC-USDT", "bar": "1m", "limit": 10, "format": "markdown" }
subscribe_ticker
with input: { "instrument": "BTC-USDT" }
get_live_ticker
with input: { "instrument": "BTC-USDT", "format": "markdown" }
unsubscribe_ticker
with input: { "instrument": "BTC-USDT" }
Each tool supports different visualization formats:
format
: Choose between markdown
, json
, or table
(for candlesticks)Install the Claude extension for VSCode
Configure the MCP server in VSCode settings:
Create or edit the following file:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Add the following configuration:
json
{
"mcpServers": {
"okx": {
"command": "node",
"args": ["/absolute/path/to/okx-mcp-server/build/index.js"],
"disabled": false,
"autoApprove": []
}
}
}
Replace /absolute/path/to/okx-mcp-server/build/index.js
with your actual file path
If using Claude Desktop, check their documentation for the appropriate location to place MCP configuration settings.
Once integrated, you can ask Claude:
The enhanced MCP server provides rich data visualization:
markdown
(default) or json
formatsmarkdown
(default), table
, or json
formatsmarkdown
(default) or json
formatsThis server includes WebSocket support for receiving live data from OKX:
This basic implementation uses OKX's public API endpoints that don't require authentication. If you extend the server to use authenticated endpoints, you may want to add these environment variables:
OKX_API_KEY=your_api_key
OKX_API_SECRET=your_api_secret
OKX_API_PASSPHRASE=your_api_passphrase
You can extend this MCP server by:
MIT
No description, website, or topics provided.
No releases published
No packages published
You can’t perform that action at this time.