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 "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 Servershow 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: rgo-trading-api
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
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the agent knows this is a safe, repeatable read operation. The description adds the concept of 'aggregated' metrics, which provides some behavioral context beyond annotations, but it doesn't detail what aggregation entails or other traits like rate limits or auth needs.
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 with no wasted words. It's front-loaded with the core purpose and appropriately sized for a tool with no parameters, making it highly concise and well-structured.
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 tool's complexity (simple read with no parameters), annotations cover safety and idempotency, but there's no output schema to explain return values. The description mentions 'aggregated portfolio metrics' but doesn't specify what metrics are included or the format, leaving gaps in completeness for agent usage.
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 0 parameters with 100% description coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here, earning a baseline score of 4 for not introducing unnecessary information.
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 states the tool 'Get aggregated portfolio metrics' which specifies the action (get) and resource (portfolio metrics), but it's vague about what 'aggregated' means and doesn't distinguish it from sibling tools like get_portfolio or get_positions. It provides a basic purpose but lacks specificity and 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?
No guidance is provided on when to use this tool versus alternatives such as get_portfolio or get_positions. The description implies usage for aggregated metrics but doesn't specify contexts, exclusions, or comparisons with siblings, leaving the agent without clear usage direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_open_ordersBRead-onlyIdempotent
Get all currently open orders
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare this as read-only, idempotent, and non-destructive, so the description adds minimal behavioral context beyond stating it retrieves data. It doesn't disclose additional traits like response format, pagination, rate limits, or authentication needs. With annotations covering safety, a baseline 3 is appropriate as the description adds little value.
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 with no wasted words. It's front-loaded with the core action and resource, making it easy to parse. Every word earns its place by specifying 'all currently open orders' to clarify scope.
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 zero parameters, rich annotations (readOnlyHint, idempotentHint, destructiveHint), and no output schema, the description is adequate but minimal. It states what the tool does but doesn't explain return values or usage context. For a simple retrieval tool with good annotations, this is the minimum viable description.
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 tool has zero parameters, and schema description coverage is 100% (though empty). The description doesn't need to explain parameters, so it meets expectations. A score of 4 reflects that the description appropriately focuses on purpose rather than parameter details for a parameterless tool.
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 ('open orders'), making the purpose immediately understandable. It distinguishes from siblings like 'get_order_history' by specifying 'currently open' rather than historical data. However, it doesn't explicitly contrast with other siblings like 'get_positions' or 'get_account_summary', preventing a perfect score.
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. It doesn't mention prerequisites, timing considerations, or compare it to sibling tools like 'get_positions' or 'get_order_history'. The agent must infer usage context solely from the tool name and description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_order_historyBRead-onlyIdempotent
Get a list of filled orders for a given date range and optional symbol filter
| Name | Required | Description | Default |
|---|---|---|---|
| begin | No | the beginning of the time range in timestamp format | |
| end | No | the end of the time range in timestamp format | |
| instId | Yes | Instrument ID (symbol), e.g. BTC-USDT |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the agent knows this is a safe, repeatable read operation. The description adds minimal behavioral context beyond thisβit specifies that it retrieves 'filled orders' (implying historical data) and mentions filtering, but doesn't cover aspects like pagination, rate limits, or authentication needs. With annotations covering core safety, a baseline 3 is appropriate as the description adds some value but not rich behavioral details.
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 directly states the tool's function and key parameters. It's front-loaded with the core purpose ('Get a list of filled orders') and includes essential filtering details without unnecessary elaboration. Every word earns its place, making it highly concise and well-structured.
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 tool's moderate complexity (3 parameters, no output schema), the description is adequate but has gaps. It covers the basic purpose and filtering, but lacks details on output format, error handling, or integration with sibling tools. Annotations provide safety context, but without an output schema, the description could better prepare the agent for what to expect from the response. It's minimally viable but not fully comprehensive.
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%, with clear documentation for each parameter (begin, end, instId). The description adds marginal semantic value by framing 'instId' as an 'optional symbol filter' (though the schema marks it as required) and specifying 'date range', but doesn't provide additional syntax, format details, or constraints beyond what the schema already states. Baseline 3 is correct 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 tool's purpose: 'Get a list of filled orders' with filtering by 'date range and optional symbol filter'. It specifies the verb ('Get') and resource ('filled orders'), making the intent unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_open_orders' (which likely shows unfilled orders), leaving some room for improvement.
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. It mentions filtering capabilities but doesn't clarify scenarios where it's preferred over other tools like 'get_open_orders' or 'get_account_summary'. There's no mention of prerequisites, exclusions, or comparative use cases, leaving the agent to infer usage context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_portfolioARead-onlyIdempotent
Get a list of all assets in the account
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, covering safety and idempotency. The description adds value by specifying the scope ('all assets') and that it returns a list, which isn't covered by annotations. No contradictions exist, and the description provides useful behavioral context beyond annotations.
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 front-loads the core purpose with zero wasted words. It directly communicates the tool's function without unnecessary elaboration, making it easy to parse and understand immediately.
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 tool's simplicity (0 parameters, no output schema) and rich annotations, the description is adequate but has gaps. It doesn't explain the return format (e.g., structure of the asset list) or potential limitations (e.g., pagination, real-time data), which could be important for an agent despite the annotations covering safety aspects.
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?
With 0 parameters and 100% schema description coverage, the schema fully documents the lack of inputs. The description adds semantic meaning by clarifying what is retrieved ('all assets in the account'), which compensates for the absence of parameters. This goes beyond the schema's structural information.
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 ('list of all assets in the account'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like get_positions, but the scope ('all assets') provides some implicit distinction. This is clear but lacks explicit 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 like get_positions or get_account_summary. It doesn't mention prerequisites, context, or exclusions. The agent must infer usage from the tool name and description alone, which is insufficient for optimal tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_positionsBRead-onlyIdempotent
Get all derivative positions
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate read-only, idempotent, and non-destructive behavior, so the description doesn't need to repeat this. It adds no additional behavioral context (e.g., rate limits, auth needs, or return format), but doesn't contradict annotations, resulting in a baseline score for minimal added value.
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 directly states the tool's function without any wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.
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 tool's simplicity (0 parameters, no output schema) and rich annotations, the description is adequate but minimal. It covers the basic purpose but lacks details on output format or when to use it, leaving some contextual gaps for the agent.
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?
With 0 parameters and 100% schema description coverage, the schema fully documents the lack of inputs. The description implies no filtering or arguments are needed ('all derivative positions'), which aligns with the schema, earning a high baseline score for consistency.
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 ('all derivative positions'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_portfolio' or 'get_account_summary', which might also retrieve position-related data, so it doesn't fully distinguish its specific scope.
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. It doesn't mention context, prerequisites, or comparisons to sibling tools like 'get_portfolio', leaving the agent without usage direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
5 tool updates
v1.0.0- First observed
get_account_summary - First observed
get_open_orders - First observed
get_order_history - First observed
get_portfolio - First observed
get_positions
TDQS
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
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
Read-only bank access for your AI agent. Connects Claude, ChatGPT, Cursor, Gemini, Codex.
Read-only access to your bank, investment, and crypto accounts: balances, transactions, holdings.
Connect your Necton account to AI via Brazil's Open Finance: balances, statements, cards, investment
Read-only China A-share data for AI agents: market, limit-up, capital flow and disclosures.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with OKX cryptocurrency exchange, providing tools for market data, trading, account management, and more through the Model Context Protocol.98MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to read positions, deals, and orders from the RGO trading platform via natural language, with optional trading capabilities when explicitly enabled.MIT
- AlicenseBqualityDmaintenanceGives AI assistants real-time access to Interactive Brokers accounts via the Client Portal Web API, with 26 read-only tools for portfolio, market data, options, and scanner.32192MIT
- AlicenseNot gradedqualityFmaintenanceProvides read-only access to Trading 212 accounts, enabling AI assistants to retrieve portfolio positions, account summaries, instrument data, and transaction history.275MIT
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/mbarinov/okx-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server