Get the FREE Ultimate OpenClaw Setup Guide →

okx

This repository provides an example implementation of an SSE (Server-Sent Events)-based MCP server built entirely on top of the @okx-dex/okx-dex-sdk library. It enables seamless DEX trading on Solana and cross-chain bridge operations.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio 0xobedient-okx-mcp node src/main.ts \
  --env PORT="3000" \
  --env OKX_API_KEY="Your OKX API key" \
  --env OKX_API_SECRET="Your OKX API secret" \
  --env OKX_PASSPHRASE="Your OKX API passphrase" \
  --env OKX_PROJECT_ID="Your OKX project ID (if required)" \
  --env RPC_ENDPOINT_URI="RPC endpoint URI for Solana or target blockchain" \
  --env WALLET_PRIVATE_KEY="Private key for the wallet used in trades"

How to use

This MCP server is an SSE (Server-Sent Events) implementation that exposes the OKX DEX and cross-chain bridge capabilities via a single server. Built on the @okx-dex/okx-dex-sdk, it enables clients to subscribe to real-time market data, execute swap trades, generate swap instructions, fetch price quotes, and access bridge-related endpoints for cross-chain transfers. The DEX API focuses on Solana-based trading workflows, including fetching token lists and liquidity pool data, while the Bridge API exposes supported bridgeable tokens, supported chains, and price quotes, along with the ability to initiate cross-chain transfers. To use, start the server and connect clients to the SSE endpoints to receive live updates and to submit trading or bridging requests through the provided REST-like routes exposed by the server.

How to install

Prerequisites:

  • Node.js (12.x or newer) installed on your system
  • pnpm installed globally (npm i -g pnpm) or use an equivalent package manager

Installation steps:

  1. Clone the repository git clone https://github.com/0xobedient/okx-mcp cd okx-mcp

  2. Install dependencies pnpm install

  3. Configure environment Copy .env.example to .env and fill in the required values: OKX_API_KEY, OKX_API_SECRET, OKX_PASSPHRASE, OKX_PROJECT_ID (optional), RPC_ENDPOINT_URI, WALLET_PRIVATE_KEY, PORT

  4. Run the MCP server pnpm run dev

  5. Verify the server is running Access the configured port (default 3000) and test SSE endpoints or REST-like API routes exposed by the server.

Additional notes

Notes and tips:

  • Ensure your RPC_ENDPOINT_URI points to a valid Solana (or target blockchain) RPC endpoint for accurate DEX operations.
  • The environment variables OKX_API_KEY/SECRET/PASSPHRASE must be kept secure and not committed to version control.
  • The server is designed as an SSE provider; clients should establish EventSource connections to the appropriate endpoints to receive live updates.
  • If you modify the code, run a fresh build or restart the server to pick up changes.
  • The OKX SDK is the core dependency; verify compatibility with your Node.js version and keep the sdk up to date to access new DEX/Bridge features.

Related MCP Servers

Sponsor this space

Reach thousands of developers