MCP server#
MCP (Model Context Protocol) connects AI tools with developer resources. After adding the OKX DEX MCP Server, the Agent can get quotes, check DEX liquidity, construct Approve transactions, execute swaps, and signed transactions — all through standardized, directly callable tool interfaces, within a single conversation or editor session, without any additional integration code.
What the MCP Server exposes#
- Chain & Liquidity Tools:
dex-okx-dex-aggregator-supported-chainslists all chains that support swaps;dex-okx-dex-liquiditylists active DEX liquidity sources on a specified chain. - Approve Tool:
dex-okx-dex-approve-transactiongenerates the ERC-20 Approve calldata required for a first-time token swap. - Quote Tool:
dex-okx-dex-quoteretrieves the best aggregated quote across all liquidity sources, including expected output amount, price impact, and route details. - Swap Tool:
dex-okx-dex-swapconstructs a complete swap transaction (calldata + value + gas estimation), ready for signing. - Solana Tool:
dex-okx-dex-solana-swap-instructiongenerates a Solana versioned transaction instruction set for swapping SPL tokens, ready to be signed by a wallet.
Quickstart#
# for cursor
{
"mcpServers": {
"okx/onchainos-mcp": {
"url": "https://web3.okx.com/api/v1/onchainos-mcp",
"headers": {
"OK-ACCESS-KEY": "your apiKey applyed on https://web3.okx.com/zh-hans/onchain-os/dev-portal/project"
}
}
}
}
# for Claude code
{
"mcpServers": {
"okx/onchainos-mcp": {
"url": "https://web3.okx.com/api/v1/onchainos-mcp",
"headers": {
"OK-ACCESS-KEY": "your apiKey applyed on https://web3.okx.com/zh-hans/onchain-os/dev-portal/project"
}
"type": "http"
}
}
}
Example interactions#
Once the MCP Server is active, an Agent can respond to natural-language instructions like:
What chains support DEX swaps?
# Call dex-aggregator-supported-chains
Which DEXs are available on X-layer?
# Call dex-liquidity
How much USDC will I get for 1 ETH on X-layer?
# Call dex-quote
I need to approve USDT for swap
# Call dex-approve-transaction
Swap 100 USDT to OKB
# Call dex-swap
Swap 2 SOL for USDC on Solana...
# Call dex-solana-swap-instruction
Innehållsförteckning
