0xAuto-okx
MCP server from Buidl-Land/0xAuto-okx-mcp-server
claude mcp add --transport stdio buidl-land-0xauto-okx-mcp-server node server.js \ --env LOG_LEVEL="info" \ --env OKX_API_KEY="your_okx_api_key" \ --env SERVER_PORT="3000" \ --env OKX_PASSPHRASE="your_okx_api_password" \ --env OKX_SECRET_KEY="your_okx_secret_key" \ --env OKX_API_BASE_URL="https://www.okx.com" \ --env OKX_DEX_API_BASE="https://web3.okx.com/api/v5/dex" \ --env SIMULATED_TRADING="0"
How to use
This MCP server exposes a unified interface for both OKX's centralized exchange (CEX) and OKX DEX via the Model Context Protocol (MCP). It provides standardized MCP tools for account management, trading, market data, funding, as well as DEX quotes, prices, swaps, and cross-chain operations. Clients can connect to the MCP endpoint to request actions such as retrieving balances, placing orders, getting market quotes, querying DEX token data, and performing on-chain or cross-chain swaps. The server handles authentication, signature generation, error handling, and streaming sessions, simplifying integration for automation, bots, and analytics workflows. Tools are grouped under CEX and DEX categories and expose a consistent tool naming convention (e.g., okx_get_balance, okx_place_order, okx_get_quote, okx_swap, okx_cross_chain_swap). To start, ensure your environment is configured with your OKX credentials and run the server. Clients should connect to the MCP endpoint at /mcp and can leverage the SSE (/sse) or messages (/messages) endpoints for session management and streaming updates. The toolset enables a complete workflow from obtaining account information to executing trades and retrieving market data across both CEX and DEX surfaces.
How to install
Prerequisites:
- Node.js v16 or higher
- pnpm package manager
- Git (optional, for cloning the repository)
Installation steps:
-
Clone the repository (or download the code): git clone https://github.com/your-org/0xAuto-okx-mcp-server.git cd 0xAuto-okx-mcp-server
-
Install dependencies with pnpm: pnpm install
-
Configure environment variables:
- Copy example env and edit with your credentials: cp .env.example .env
- Edit .env and set your OKX API credentials and other settings, for example: 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 SERVER_PORT=3000 LOG_LEVEL=info
-
Start the server: pnpm start
or for development mode
pnpm dev
The server will start and listen on the port defined by SERVER_PORT (default 3000). You can adjust other environment variables as needed for your OKX configuration.
Additional notes
Notes and tips:
- Ensure your OKX API key has at least read permissions for balance and market data, and trade permissions if you plan to place orders.
- SIMULATED_TRADING can be set to 1 to run in a simulated/demo mode if supported by the server.
- The MCP endpoints are designed to return standardized JSON responses with consistent error handling. If you encounter MCP session issues, use the /sse or /messages endpoints for session management and reconnect.
- If you run behind a proxy or firewall, ensure that SERVER_PORT is accessible and that OKX API bases are reachable from your deployment environment.
- Environment variables can be extended in the future to support more OKX features; refer to the server’s config and services for additional options.
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.