DEX交易与跨链桥接服务

基于OKX SDK的SSE服务器示例,支持Solana区块链上的DEX交易和跨链桥接操作。

  • by 0xobedient
  • TypeScript
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 0xobedient/okx-mcp

使用说明

OKX-DEX-SDK MCP-SSE服务器示例

这是一个SSE(服务器发送事件)MCP服务器的示例实现,该服务器利用 @okx dex/okx dex sdk 支持DEX交易和跨链桥接操作。

🚀 特性

API DEX公司

为Solana区块链构建的DEX API支持:

  • 执行掉期交易
  • 生成交换指令
  • 获取报价
  • 检索支持的代币和流动性池(LP)数据

桥梁API

启用跨链功能,包括:

  • 获取支持的可桥接令牌和链
  • 执行跨链桥接交易
  • 检索跨链报价

📦 安装

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

📁 项目结构

.
├── 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

🔐 环境变量

创建一个 .env 项目根目录下的文件使用 .env.example 作为模板:

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

📦 依赖

此MCP服务器完全基于官方OKX SDK构建:

@okx dex/okx dex sdk –提供OKX DEX交易和桥接功能的核心SDK。