Skip to main content
Glama
OKX MCP Server

OKX MCP Server

by aahl
README.md
# 🆗 OKX MCP Server

<!-- mcp-name: io.github.aahl/mcp-okx -->


## 📲 Install

### Method 1: uvx
```yaml
{
  "mcpServers": {
    "mcp-okx": {
      "command": "uvx",
      "args": ["mcp-okx"],
      "env": {
        "OKX_API_KEY": "your-okx-api-key",
        "OKX_API_SECRET": "api-secret-key",
        "OKX_PASSPHRASE": "api-passphrase",
        "OKX_TRADE_FLAG": "1", # 0: Production trading, 1: Demo trading
        "OKX_BASE_URL": "https://www.okx.com", # Optional
        "MCP_AUTH_TOKEN": "your-custom-token"  # Default same as OKX_API_KEY
      }
    }
  }
}
```

### Method 2: Docker
```bash
mkdir /opt/mcp-okx
cd /opt/mcp-okx
wget https://raw.githubusercontent.com/aahl/mcp-okx/refs/heads/main/docker-compose.yml
docker-compose up -d
```
```yaml
{
  "mcpServers": {
    "mcp-okx": {
      "url": "http://0.0.0.0:8811/mcp", # Streamable HTTP
      "headers": {
        "Authorization": "Bearer your-okx-api-key-or-custom-token"
      }
    }
  }
}
```


### ⚙️ Environment variables

- `OKX_API_KEY`: API key of your OKX account. Please refer to [my api page](https://www.okx.com/account/my-api) regarding API Key creation.
- `OKX_API_SECRET`: API secret key of your OKX account.
- `OKX_PASSPHRASE`: API passphrase of your OKX account.
- `OKX_TRADE_FLAG`: 0: Production trading, 1: Demo trading
- `OKX_BASE_URL`: Base URL of OKX. Default: `https://www.okx.com`
- `MCP_AUTH_TOKEN`: Custom token for authentication. Default same as `OKX_API_KEY`


## 🛠️ Available Tools

<details>
<summary><strong>Account Tools</strong></summary>

- `account_config` - Get account configuration
- `account_balance` - Get account balance
- `account_positions` - Get account positions
- `account_position_risk` - Get account position risk

</details>

<details>
<summary><strong>Trading Tools</strong></summary>

- `place_order` - Place a new order
- `cancel_order` - Cancel an incomplete order
- `get_trade_order` - Get order details
- `get_order_list` - Get incomplete order list
- `get_orders_history` - Get Order History
- `close_positions` - Liquidate all positions

</details>

<details>
<summary><strong>Market Data</strong></summary>

- `market_tickers` - Get cryptocurrency rankings

</details>

TDQS

B3.2/5.0

Scored across 11 tools

Disambiguation4/5

Most tools have distinct purposes, such as account_balance for balances, place_order for trading, and market_tickers for market data. However, get_order_list, get_orders_history, and get_trade_order could cause confusion as they all retrieve order information with overlapping scopes, though descriptions clarify differences like incomplete vs. completed orders.

Naming Consistency5/5

Tool names consistently follow a verb_noun or noun_verb pattern with snake_case throughout, such as account_balance, cancel_order, and market_tickers. This uniformity makes the set predictable and easy to navigate for an agent.

Tool Count5/5

With 11 tools, the server is well-scoped for an OKX trading platform, covering account management, order handling, and market data. Each tool serves a clear purpose without being overly sparse or bloated, fitting typical expectations for such a domain.

Completeness4/5

The tool set provides comprehensive coverage for core trading operations, including account info, order placement, cancellation, and market data. A minor gap exists in lacking tools for modifying existing orders or positions beyond cancellation and liquidation, but agents can work around this with the available tools.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues