Provides read-only access to OKX trading accounts, enabling retrieval of portfolio information, trading positions, order history, account balances, and asset allocation data for analysis and reporting.
OKX MCP Server
A Model Context Protocol (MCP) server that provides access to OKX trading and portfolio management functionality. This package allows AI assistants to interact with your OKX account to retrieve portfolio information, trading positions, order history, and more.
This MCP server is designed with security as a top priority. Here's what makes it safe to use:
🔒 Built-in Security Features
Read-Only Access: The server only requires read permissions - it cannot place trades or withdraw funds
Local Processing: All data is processed locally on your machine and never stored or transmitted to third parties
No Data Persistence: Your trading data is never saved to disk or cached permanently
Direct API Communication: Connects directly to OKX APIs without intermediary servers
What You Can Do
📱 See It In Action
Example: Ask Claude "give me account summary" and instantly get your portfolio breakdown, asset allocation, and trading insights—all from your OKX account data.
Transform your trading experience with AI-powered portfolio insights. Once configured, you can ask Claude natural language questions about your OKX account:
💰 Portfolio Management
"What's my current portfolio balance?"
"Show me my asset allocation"
"Which coins do I own and how much are they worth?"
"What's my biggest position by value?"
📊 Trading Analysis
"Show me my open positions with P&L"
"What orders do I have pending?"
"Analyze my BTC trading history from last month"
"How did my ETH trades perform this week?"
🎯 Smart Insights
"What's my total unrealized profit/loss?"
"Which assets have gained the most value?"
"Give me a summary of my trading activity"
"How is my portfolio performing today?"
🔍 Detailed Reporting
"Create a detailed report of my portfolio"
"Show me all my completed trades for BTC-USDT"
"What's my trading volume for this month?"
"Break down my portfolio by percentage"
The AI can provide instant analysis, generate insights, and help you make informed trading decisions—all through simple conversation.
Quick Start
Step 1: Create OKX API Credentials
Access Your OKX Account:
Open API Management:
Navigate directly to: https://www.okx.com/account/my-api
Create Your API Key:
Click "Create API Key"
Enter a descriptive name (e.g., "MCP Server")
Create and save a secure passphrase (you'll need this later)
Set Read-Only Permissions:
Read: ✅ Enable (required for portfolio access)
Trade: ❌ Disable (not needed for this MCP server)
Withdraw: ❌ Disable (not needed for this MCP server)
Generate and Copy Credentials:
Click "Submit All" to create the API key
Click "Show info" to reveal your credentials
Click "Copy API key info" to copy all details
Your credentials will look like this:
apikey = "12345678-abcd-1234-efgh-123456789abc" secretkey = "ABCD1234EFGH5678IJKL9012MNOP3456" IP = "" API key name = "MCP Server" Permissions = "Read"Secure Your Credentials:
Save the API Key, Secret Key, and Passphrase in a secure location
⚠️ Critical: The Secret Key is only shown once - save it immediately!
These credentials will be used to configure Claude Desktop in the next step
Step 2: Install Prerequisites
Before configuring Claude Desktop, you need to install Node.js.
Install Node.js
Option 1: Download from Official Website
Visit https://nodejs.org
Download the LTS (Long Term Support) version for your operating system
Run the installer and follow the setup wizard
Step 3: Configure Claude Desktop
Open Claude Desktop Settings:
Launch Claude Desktop application
Click on Settings (gear icon in the bottom-left corner)
Access Developer Section:
Scroll down to the bottom of the settings panel
Click on "Developer" section
Edit Configuration:
Click on "Edit Config" button
This will open the
claude_desktop_config.json
file in your default text editor
Add OKX MCP Server Configuration:
Replace the entire file content with this configuration:
{ "mcpServers": { "okx-mcp": { "command": "okx-mcp", "env": { "OKX_API_KEY": "your_api_key_here", "OKX_API_SECRET": "your_secret_key_here", "OKX_API_PASSPHRASE": "your_passphrase_here" } } } }Update Your Credentials:
Replace
your_api_key_here
with your actual API Key from Step 1Replace
your_secret_key_here
with your actual Secret Key from Step 1Replace
your_passphrase_here
with your actual Passphrase from Step 1Save the file and close the text editor
Restart Claude Desktop:
Close Claude Desktop completely
Reopen the application to load the new configuration
Test the Connection:
Start a new conversation in Claude Desktop
Try asking: "Show my portfolio" or "Get my account summary"
If successful, Claude will retrieve and display your OKX account data
Available Tools
This MCP server provides the following tools for AI assistants:
1. Get Account Summary
Tool:
get_account_summary
Description: Get aggregated portfolio metrics including total value and asset allocation
Parameters: None
2. Get Portfolio
Tool:
get_portfolio
Description: Get detailed information about all assets in your account
Parameters: None
Returns: List of currencies with balances, available amounts, and USDT values
3. Get Positions
Tool:
get_positions
Description: Get all open derivative trading positions
Parameters: None
Returns: Position details including size, entry price, and unrealized P&L
4. Get Open Orders
Tool:
get_open_orders
Description: Get all currently open trading orders
Parameters: None
Returns: Order details including symbol, type, price, and status
5. Get Order History
Tool:
get_order_history
Description: Get historical filled orders for analysis
Parameters:
instId
(required): Instrument ID (e.g., "BTC-USDT")begin
(optional): Start timestampend
(optional): End timestamp
Returns: Historical order data with execution details
Development
Local Development
Building
Project Structure
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
License
MIT
Support
If you encounter any issues or have questions:
Check the GitHub Issues
Create a new issue with detailed information about your problem
Include your environment details and error messages (without sensitive data)
Related Projects
local-only server
The server can only run on the client's local machine because it depends on local resources.
Enables AI assistants to interact with OKX trading accounts through read-only access to retrieve portfolio information, trading positions, order history, and account analytics. Provides secure, local processing of trading data without storing sensitive information or enabling trade execution.
Related MCP Servers
- AsecurityFlicenseAqualityTransforms AI assistants into autonomous crypto trading agents with real-time market analysis, portfolio management, and trade execution across 17+ blockchains.Last updated -32617
- AsecurityFlicenseAqualityEnables AI assistants to interact with IG Trading API for forex, indices, and commodities trading. Provides 21 tools for account management, position trading, order placement, market data analysis, and watchlist management.Last updated -211041
- -securityAlicense-qualityEnables AI assistants to interact with the QuantConnect cloud platform for algorithmic trading. Supports creating and managing trading strategies, running backtests, deploying live algorithms, and performing comprehensive trading operations through the QuantConnect API.Last updated -Apache 2.0
- AsecurityAlicenseAqualityEnables AI assistants to interact with Interactive Brokers trading accounts to retrieve market data, check positions, and place trades. Includes pre-configured IB Gateway and handles OAuth authentication automatically.Last updated -61046MIT License