0xAuto OKX MCP Server

by Buidl-Land

457 downloads Not rated yet

About

# 0xAuto OKX MCP Server This server is based on the Model Context Protocol (MCP), providing a tool interface layer for OKX V5 API and OKX DEX API, offering AI agents simplified access to OKX exchange (CEX) and decentralized exchange (DEX) functionalities. ## Features ### CEX (Centralized Exchange) Features - Hides…

Explore

- Hides complex OKX API authentication and signature logic
- Provides standard MCP tool interfaces
- Covers core functionalities:
- Account information (balances, positions, history)
- Market data (quotes, K-lines)
- Trading operations (place orders, cancel orders, order management)
- Funding operations (deposit addresses, withdrawals)

- Provides access to OKX DEX aggregator
- Supports multi-chain transactions and token exchanges
- Covers functionalities:
- Token quote retrieval
- Token price queries and K-line data
- On-chain balance queries
- Token authorization operations
- Intra-chain and cross-chain swaps

- Standardized JSON responses and error handling
- Support for MCP protocol session management and streaming

1. Install dependencies:

   pnpm install

2. Set up environment variables:
Create a .env file by copying the contents from .env.example:

   cp .env.example .env

Edit the .env file and fill in your OKX API credentials and other settings:

OKX_API_KEY=your_okx_api_key
OKX_SECRET_KEY=your_okx_secret_key
OKX_PASSPHRASE=your_okx_api_password
OKX_API_BASE_URL=https://www.okx.com
OKX_DEX_API_BASE=https://web3.okx.com/api/v5/dex

bash
pnpm start

okx_get_account_info

Get account information

okx_get_positions

Get position information

okx_get_balance

Get account balance

okx_place_order

Place trade order

okx_cancel_order

Cancel order

okx_get_orders

Get order information

okx_get_order_history

Get historical orders

okx_get_ticker

Get market quotes

okx_get_kline

Get K-line data

okx_get_instruments

Get product list

okx_get_deposit_address

Get deposit address

okx_get_deposit_history

Get deposit records

okx_withdraw

Withdraw funds

The server implements the following MCP tools:

- okx_get_account_info - Get account information
- okx_get_positions - Get position information
- okx_get_balance - Get account balance

- okx_place_order - Place trade order
- okx_cancel_order - Cancel order
- okx_get_orders - Get order information
- okx_get_order_history - Get historical orders

- okx_get_ticker - Get market quotes
- okx_get_kline - Get K-line data
- okx_get_instruments - Get product list

- okx_get_deposit_address - Get deposit address
- okx_get_deposit_history - Get deposit records
- okx_withdraw - Withdraw funds

This server is based on the Model Context Protocol (MCP), providing a tool interface layer for OKX V5 API and OKX DEX API,
offering AI agents simplified access to OKX exchange (CEX) and decentralized exchange (DEX) functionalities.

Features

CEX (Centralized Exchange) Features

- Hides complex OKX API authentication and signature logic - Provides standard MCP tool interfaces - Covers core functionalities: - Account information (balances, positions, history) - Market data (quotes, K-lines) - Trading operations (place orders, cancel orders, order management) - Funding operations (deposit addresses, withdrawals)

DEX (Decentralized Exchange) Features

- Provides access to OKX DEX aggregator - Supports multi-chain transactions and token exchanges - Covers functionalities: - Token quote retrieval - Token price queries and K-line data - On-chain balance queries - Token authorization operations - Intra-chain and cross-chain swaps

- Standardized JSON responses and error handling
- Support for MCP protocol session management and streaming

System Requirements

- Node.js (v16 or higher)
- pnpm

Installation Steps

1. Install dependencies:

   pnpm install

2. Set up environment variables:
Create a .env file by copying the contents from .env.example:

   cp .env.example .env

Edit the .env file and fill in your OKX API credentials and other settings:
   # OKX API Configuration
OKX_API_KEY=your_okx_api_key
OKX_SECRET_KEY=your_okx_secret_key
OKX_PASSPHRASE=your_okx_api_password
OKX_API_BASE_URL=https://www.okx.com
OKX_DEX_API_BASE=https://web3.okx.com/api/v5/dex

# Simulated trading: 0 for live trading, 1 for demo account
SIMULATED_TRADING=0

SERVER_PORT=3000
LOG_LEVEL=info

Important note: Ensure your OKX API Key has the necessary permissions (read, trade).

Running the Server

```bash
pnpm start

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.