# 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](https://www.npmjs.com/package/@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**
## π¦ Installation
```bash
git clone https://github.com/0xobedient/okx-mcp
cd okx-mcp
pnpm install
pnpm run dev
```
## π Project Structure
```plaintext
.
βββ 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:
```env
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](https://www.npmjs.com/package/@okx-dex/okx-dex-sdk)** β the core SDK providing access to OKX DEX trading and bridge functionalities.