# OKX MCP Server

> OKX MCP Server is an open-source MCP server for crypto and web3. MCP server giving AI clients access to OKX account data, market tickers and trading tools. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, self-hosted
- **Repository:** https://github.com/aahl/mcp-okx
- **MCP Registry name:** io.github.aahl/mcp-okx
- **Categories:** [crypto and web3](https://ai-powered.com/categories/crypto-and-web3)
- **Listing updated:** 2026-11-18

## About

The README describes this as a bridge between AI clients and an OKX exchange account. It exposes account queries such as configuration, balances, positions and position risk, along with order placement, cancellation, order lookup and history, and a tool to liquidate all open positions. A market tickers tool is also listed for retrieving cryptocurrency rankings.

Setup uses API credentials from an OKX account. A flag switches between production trading and demo trading, so users can test against demo mode before touching live funds. The server runs either over stdio via uvx or as a Docker container using Streamable HTTP with a bearer token for authentication.

It suits developers and traders who want an AI assistant to inspect their OKX account or place orders through MCP. Because it can trade with real credentials, the README's demo-mode setting is worth using first.

## Features

- **Account information queries:** Retrieves account configuration, balances, positions and position risk from OKX.
- **Order placement and management:** Places new orders, cancels incomplete ones and looks up open or past order details.
- **Position liquidation:** Provides a tool to close all open positions at once.
- **Demo and production modes:** A single setting switches between OKX demo trading and live trading.
- **Stdio and HTTP transports:** Runs locally via uvx or as a Docker container serving Streamable HTTP.
- **Market ticker rankings:** Includes a tool that returns cryptocurrency rankings from market data.

## Good for

- Checking OKX account balances and open positions from an AI assistant
- Placing or cancelling orders on OKX through natural-language requests
- Testing trading logic against OKX demo mode before going live
- Reviewing order history and position risk on an OKX account

## Install

### Claude Code (Terminal)

```sh
claude mcp add mcp-okx -- uvx mcp-okx
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mcp-okx": {
      "command": "uvx",
      "args": [
        "mcp-okx"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mcp-okx": {
      "command": "uvx",
      "args": [
        "mcp-okx"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "mcp-okx": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mcp-okx"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "mcp-okx": {
      "command": "uvx",
      "args": [
        "mcp-okx"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mcp-okx": {
      "command": "uvx",
      "args": [
        "mcp-okx"
      ]
    }
  }
}
```

## Tools

- `account_config`: Get account configuration
- `account_balance`: Get account balance
- `account_positions`: Get account positions
- `account_position_risk`: Get account position risk
- `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
- `market_tickers`: Get cryptocurrency rankings

## FAQ

### Does it support demo trading?

Yes. The OKX_TRADE_FLAG variable set to 1 uses demo trading, while 0 uses production trading.

### How is the server run?

The README gives two methods: launching it with uvx using the mcp-okx package, or running it in Docker and connecting over Streamable HTTP.

### What credentials are needed?

An OKX API key, API secret and passphrase are set as environment variables, following the README's API key instructions.

### Is OKX MCP Server free?

Yes. OKX MCP Server is open source, so you can use and self-host it for free.

### How do I add OKX MCP Server to Claude Code?

Run this command in your terminal: claude mcp add mcp-okx -- uvx mcp-okx

### What are the best alternatives to OKX MCP Server?

The closest alternatives to OKX MCP Server are Cryptokly and PolyTest.

## Where this comes from

- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [Cryptokly](https://ai-powered.com/mcp/cryptokly): Cryptokly is an MCP server for finance and payments.
- [PolyTest](https://ai-powered.com/mcp/polytest): PolyTest is a freemium MCP server for analytics and data.

---
Source: https://ai-powered.com/mcp/okx-mcp-server
