OKX MCP Server for Blockchain and Market Data
Enable Claude to access blockchain and market data via an OKX MCP server for asset prices, transactions, account history and trade instructions.
npx -y @memetus/okx-mcp-playgroundOverview
This MCP (Model Context Protocol) server connects Claude (or any MCP-enabled model) to OKX blockchain and market data APIs. It exposes wallet balances, transaction history, market/index prices, simulated and broadcast transaction endpoints, and DEX swap utilities so a language model can fetch live on-chain state, prepare trade instructions, and help with transaction workflows.
For developers building agent integrations, the OKX MCP server simplifies access to multi-chain blockchain data and OKX market services through a standardized MCP toolset. It is useful for prototyping trading assistants, portfolio analyzers, transaction simulators, or any flow that requires secure, programmatic access to on-chain and market information.
Features
- Multi-chain balance queries and aggregated total value computations
- Transaction history and per-tx detail retrieval across supported chains
- Broadcast and simulate on-chain transactions (including gas estimates)
- Index and market price endpoints: latest price, batch prices, candlesticks, and historical index prices
- DEX trade primitives: quotes, liquidity sources, approve/execute swap generation, and Solana swap instructions
- Developer-friendly MCP interface for Claude Desktop and other MCP clients
Prerequisites
- Node.js v16 or higher
- An OKX Web3 API key set (API key, secret, passphrase, and project ID)
- Optional: Claude Desktop for local MCP testing
Repository: https://github.com/memetus/okx-mcp-playground
Installation / Configuration
Clone, install dependencies, build and run:
# optional: npm run build:smithery
Environment variables (example .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"
Run locally:
Configure Claude Desktop to load the MCP server (edit claude_desktop_config.json):
Keep the paths absolute in the configuration and ensure environment variables are only accessible to trusted processes.
Available Tools
The server exposes grouped MCP tools. Below is a compact reference.
| Group | Example Methods | Purpose |
|---|---|---|
| Balance Operations | get_supported_chain, get_specific_token_balance, get_total_value | Query token balances, DeFi holdings, and aggregate account value |
| Gateway Operations | broadcast_transactions, simulate_transactions, get_gas_price, get_transaction_orders | Pre-execute/simulate txs, broadcast signed txs, get gas estimates |
| Index Price | get_token_index_price, get_historical_index_price | Index-derived price and historical index data |
| Market Price | get_price, get_batch_token_price, get_candlesticks_history, get_trades | Spot prices, batch pricing, candlestick history, trade feed |
| Trade Operation | get_quotes, approve_transactions, execute_swap, get_swap_instructions (Solana) | Quote aggregation, approval data, swap call data, Solana instruction assembly |
| Transaction History | get_history_by_address, get_specific_transaction | Fetch tx history and per-tx details |
Each tool returns JSON payloads designed for direct consumption by an LLM agent or calling application.
Use Cases
- Retrieve portfolio value across Ethereum, Solana and supported chains:
- Call get_specific_token_balance for an address, then get_total_value to compute USD value.
- Simulate and broadcast a swap:
- Use get_quotes to pick the best route, call approve_transactions if ERC-20 approval is required, simulate_transactions to check effects, then broadcast_transactions to submit.
- Build a price-aware trading assistant:
- Poll get_token_index_price or get_batch_token_price to feed a model live prices and candlestick history for strategy signals.
- Investigate a suspicious transaction:
- Use get_specific_transaction to fetch on-chain details and get_history_by_address to trace related activity.
- Generate Solana transaction instructions:
- Use get_swap_instructions to obtain serialized instruction payloads for on-chain assembly or offline signing.
Security and Operational Notes
- Protect your OKX API credentials; do not commit them to source control.
- Run the MCP server behind appropriate process supervision in production; safeguard the machine where keys are stored.
- Simulation endpoints are useful for examining reverts and expected costs before broadcasting live transactions.
- Supported chains and token lists vary by OKX APIs — always call get_supported_chain / get_tokens to confirm availability.
License
MIT — see the repository for full license text and contributor information.
Common Issues & Solutions
The project memetus/okx-mcp-playground is listed on Spark, but the maintainer hasn't claimed the listing yet.
I ran into this too! Claiming your listing on Spark is a straightforward process that allows you to manage your project's presence effectively. By verifying your status as a maintainer, you can edit details and add valuable badges that enhance your project's credibility. This not only helps in showcasing your project but also allows you to access analytics that can inform future improvements. To get started, simply follow the claim link provided in the issue. Here's the install command to get you set up: @ChromeDevTools/chrome-devtools-mcp
npm install @ChromeDevTools/chrome-devtools-mcp