TypeScriptADK-TS

MCP ODOS

Interact with decentralized exchanges through ODOS aggregation

  • Package: @iqai/mcp-odos
  • Purpose: Interact with decentralized exchanges through ODOS aggregation

Usage with ADK TypeScript

import {McpOdos} from "@iqai/adk";

const toolset = McpOdos({
  env: {
    WALLET_PRIVATE_KEY: process.env.WALLET_PRIVATE_KEY,
  },
})

const tools = await toolset.getTools()
import {McpToolset} from "@iqai/adk";

const toolset = new McpToolset({
  name: "ODOS MCP Client",
  description: "Client for ODOS DEX aggregation",
  transport: {
    mode: "stdio",
    command: "pnpm",
    args: ["dlx", "@iqai/mcp-odos"],
    env: {
      WALLET_PRIVATE_KEY: process.env.WALLET_PRIVATE_KEY,
      PATH: process.env.PATH || "",
    },
  },
})

const tools = await toolset.getTools()
{
  "mcpServers": {
    "odos-server": {
      "command": "pnpm",
      "args": ["dlx", "@iqai/mcp-odos"],
      "env": {
        "WALLET_PRIVATE_KEY": "your_wallet_private_key_here"
      }
    }
  }
}

Features

  • Interact with decentralized exchanges through ODOS aggregation
  • Fetch a quote for a swap
  • Execute a swap

Available Tools

ODOS_GET_QUOTE
chain:stringfromToken:stringtoToken:stringamount:stringprettyFormat:boolean

Description

Get a quote for a swap or exchange operation

ODOS_SWAP
chain:stringfromToken:stringtoToken:stringamount:stringprettyFormat:boolean

Description

Execute a swap transaction

ODOS_GET_CHAIN_ID
chain:string

Description

Get the chain ID for a given chain name

Environment Variables

Security

The private key is used for signing transactions. Handle with care.

  • WALLET_PRIVATE_KEY: Required for executing swaps
  • The private key of the wallet to be used for interacting with DEX platforms

Usage Examples

GET_SWAP_QUOTE

  • "Get me a quote for swapping 1 wfrxEth to FRAX on Fraxtal"
  • "What rate would I get for trading 0.5 ETH to USDC?"
  • "Check current exchange rate between DAI and FXS"

EXECUTE_TOKEN_SWAP

  • "Swap 100 DAI to FXS"
  • "Exchange 0.1 ETH for USDT"
  • "Trade my wfrxEth for FRAX"

Response Examples

💱 Quote Details
{
  "inTokens": ["0x..."],
  "outTokens": ["0x..."],
  "inAmounts": ["1000000000000000000"],
  "outAmounts": ["990000000000000000"],
  "pathId": "0x...",
  "gasEstimate": 200000,
  "gasEstimateValue": 0.1,
  "netOutValue": 100,
  "priceImpact": 0.01
}

Error Handling

The server provides detailed error messages to help diagnose issues. Errors typically include a detail message, a traceId for debugging, and an errorCode.

Example Error Response:

{
  "detail": "Failed to fetch quote: invalid fromToken address",
  "traceId": "...",
  "errorCode": "INVALID_ADDRESS"
}