OKX MCP Server
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.
Click on "Deploy 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 Server show me my current portfolio balance and asset allocation"
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 (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.
Related MCP server: saxo-mcp
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.jsonfile 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_herewith your actual API Key from Step 1Replace
your_secret_key_herewith your actual Secret Key from Step 1Replace
your_passphrase_herewith 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_summaryDescription: Get aggregated portfolio metrics including total value and asset allocation
Parameters: None
2. Get Portfolio
Tool:
get_portfolioDescription: 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_positionsDescription: 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_ordersDescription: Get all currently open trading orders
Parameters: None
Returns: Order details including symbol, type, price, and status
5. Get Order History
Tool:
get_order_historyDescription: 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
# Clone the repository
git clone https://github.com/maxbarinov/okx-mcp.git
cd okx-mcp
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your OKX API credentials
# Run in development mode
npm run devBuilding
npm run buildProject Structure
src/
βββ services/
β βββ okxApiClient.ts # OKX API client wrapper
βββ tools/ # MCP tool implementations
βββ get_account_summary.ts
βββ get_portfolio.ts
βββ get_positions.ts
βββ get_open_orders.ts
βββ get_order_history.tsContributing
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
Available Tools
5 toolsget_account_summaryBRead-onlyIdempotent
Get aggregated portfolio metrics
Inputs: no named parameters.
get_open_ordersBRead-onlyIdempotent
Get all currently open orders
Inputs: no named parameters.
get_order_historyBRead-onlyIdempotent
Get a list of filled orders for a given date range and optional symbol filter
Inputs: instId (required), begin, end.
get_portfolioARead-onlyIdempotent
Get a list of all assets in the account
Inputs: no named parameters.
get_positionsBRead-onlyIdempotent
Get all derivative positions
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 5 tools
The tools are mostly distinct, with each targeting a specific aspect of account or trading data (summary, open orders, order history, portfolio, positions). However, 'get_account_summary' and 'get_portfolio' could potentially overlap in providing aggregated asset information, which might cause slight confusion for an agent trying to choose between them for portfolio metrics.
All tool names follow a consistent verb_noun pattern with 'get_' prefix and snake_case (e.g., get_account_summary, get_open_orders). This predictable naming makes it easy for an agent to understand and navigate the tool set without ambiguity in style.
With 5 tools, the count is reasonable for a crypto exchange server focused on account and order management. It's slightly on the lower side but covers core functionalities well, though it might benefit from a few more tools for actions like placing or canceling orders to be fully scoped.
The tool set covers read-only operations for account data, orders, and positions, which is a good start. However, there are notable gaps in write operations, such as creating or canceling orders, and no tools for market data like ticker prices or order books, making the surface incomplete for full trading workflows.
Maintenance
Related MCP Connectors
Read-only access to your MetaTrader 4 and 5 accounts for AI agents: balances, open positions, trade history with win rate, live quotes, symbol specs and candles. It cannot place, modify or close orders.
Connect brokerage accounts to AI assistants: holdings, orders, asset lookup, and approved trading.
Read-only access to your own crypto portfolio across 11+ exchanges and 20+ chains: holdings, full history, FIFO cost basis and P&L, fees and income. Ask Claude or ChatGPT about your portfolio; the connector can never trade, move funds or act as a login.
Read-only access to your own bank, card and brokerage accounts for Claude, ChatGPT and other AI agents: balances, transactions, spending, subscriptions, cashflow and investment holdings. It can never move money.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to Trading 212 accounts, enabling AI assistants to retrieve portfolio positions, account summaries, instrument data, and transaction history.29 npm5MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to access Saxo Bank portfolio data, account balances, positions, orders, transactions, and market data such as instruments, quotes, and charts. It is read-only by default, with trading tools available only when explicitly enabled.10MIT
- AlicenseBqualityCmaintenanceProvides read-only access to Robinhood portfolio data, enabling AI assistants to perform portfolio analysis, research, and comparison through natural language queries.16MIT
- AlicenseBqualityBmaintenanceEnables AI assistants to read an IBI NextGen brokerage portfolio, including positions, cash, profit/loss, and recent account activity, through a read-only connection that cannot place, change, or cancel orders.224 PyPIMIT