Skip to main content
Glama
OKX-DEX-SDK MCP SSE Server

OKX-DEX-SDK MCP SSE Server

by 0xobedient

OKX-DEX-SDK MCP SSE SERVER EXAMPLE

This is an example implementation of an SSE (Server-Sent Events) MCP server that leverages @okx-dex/okx-dex-sdk to support DEX trading and cross-chain bridge operations.

πŸš€ Features

DEX API

Built for the Solana blockchain, the DEX API supports:

  • Executing swap trades

  • Generating swap instructions

  • Fetching price quotes

  • Retrieving supported tokens and liquidity pool (LP) data

Bridge API

Enables cross-chain functionality, including:

  • Fetching supported bridgeable tokens and chains

  • Performing cross-chain bridge transactions

  • Retrieving cross-chain price quotes

Related MCP server: Model Context Protocol Server for Solana Client

πŸ“¦ Installation

git clone https://github.com/0xobedient/okx-mcp
cd okx-mcp
pnpm install
pnpm run dev

πŸ“ Project Structure

.
β”œβ”€β”€ build/                         # Compiled output
β”œβ”€β”€ node_modules/                  # Node.js dependencies
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ bridge/
β”‚   β”‚   β”œβ”€β”€ hooks/                 # Bridge-specific hooks
β”‚   β”‚   β”œβ”€β”€ tools/                 # Utility functions for bridge
β”‚   β”‚   └── server.ts              # SSE server for bridge API
β”‚   β”œβ”€β”€ dex/
β”‚   β”‚   β”œβ”€β”€ hooks/                 # DEX-specific hooks
β”‚   β”‚   β”œβ”€β”€ tools/                 # Utility functions for DEX
β”‚   β”‚   └── server.ts              # SSE server for DEX API
β”‚   └── shared/
β”‚       β”œβ”€β”€ common/
β”‚       β”‚   β”œβ”€β”€ okxClient.ts       # OKX SDK client wrapper
β”‚       β”‚   └── wallet.ts          # Wallet handling logic
β”‚       β”œβ”€β”€ constants/
β”‚       β”‚   └── index.ts           # Constant values used across the app
β”‚       β”œβ”€β”€ env/
β”‚       β”‚   └── index.ts           # Environment variable loader
β”‚       β”œβ”€β”€ types/
β”‚       β”‚   β”œβ”€β”€ tool.d.ts          # Type definitions for tools
β”‚       β”‚   └── wallet.d.ts        # Type definitions for wallet
β”‚       └── main.ts                # Application entry point
β”œβ”€β”€ .env.example                   # Sample environment file
β”œβ”€β”€ .gitignore                     # Git ignore rules
β”œβ”€β”€ package.json                   # NPM package metadata
β”œβ”€β”€ pnpm-lock.yaml                 # Lockfile for pnpm
└── tsconfig.json                  # TypeScript configuration

πŸ” Environment Variables

Create a .env file at the root of the project using .env.example as a template:

OKX_API_KEY=              # Your OKX API key
OKX_API_SECRET=           # Your OKX API secret
OKX_PASSPHRASE=           # Your OKX API passphrase
OKX_PROJECT_ID=           # Your OKX project ID (if required)
RPC_ENDPOINT_URI=         # RPC endpoint URI for Solana or target blockchain
WALLET_PRIVATE_KEY=       # Private key for the wallet used in trades
PORT=3000                 # Port number for the SSE server

πŸ“¦ Dependency

This MCP server is entirely built upon the official OKX SDK:

@okx-dex/okx-dex-sdk – the core SDK providing access to OKX DEX trading and bridge functionalities.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Solana blockchain interaction server that allows AI tools to query blockchain data using natural language, access structured token information, and generate human-readable explanations of complex blockchain concepts.
      6
      MIT