Labsco
openocean-finance logo

OpenOcean Finance

โ˜… 1

from openocean-finance

An MCP server for executing token swaps across multiple decentralized exchanges using OpenOcean's aggregation API

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

OPENOCEAN-MCP Server

An MCP server for executing token swaps across multiple decentralized exchanges using OpenOcean's aggregation API.

Overview

This project implements a Model Context Protocol (MCP) server to interact with decentralized exchanges (DEXs). It allows MCP-compatible clients (like AI assistants, IDE extensions, or custom applications) to access functionalities such as getting quotes for swaps and executing swaps across multiple chains.

This server is built using TypeScript and fastmcp.

Features (MCP Tools)

The server exposes the following tools that MCP clients can utilize:

  • CHAIN_LIST: Fetch chain list.
    • Parameters:
  • GAS_PRICE: Fetch gas price.
    • Parameters: chain (string)
  • QUOTE: Fetch a quote for a swap.
    • Parameters: chain (string), inTokenAddress (string), outTokenAddress (string), amount (string), slippage (string)
  • SWAP: Building swap transaction.
    • Parameters: chain (string), inTokenAddress (string), outTokenAddress (string), amount (string), slippage (string), account (string)
  • GET_TRANSACTION: Fetch transaction info.
    • Parameters: chain (string), hash (string)
  • TOKEN_LIST: Fetch token list.
    • Parameters: chain (string)
  • DEX_LIST: Fetch dex list.
    • Parameters: chain (string)

Parameter breakdown

  • chain: The chain code of the DEX.
  • inTokenAddress: The token you want to sell.
  • outTokenAddress: The token you want to buy.
  • amount: Token amount with decimals. For example, if 1 USDT is input, use 1000000 (1 USDT * 10^6).
  • slippage: Define the acceptable slippage level by inputting a percentage value within the range of 0.05 to 50. 1% slippage set as 1.
  • account: user's wallet address.
  • hash: Hash from the OpenOcean contract on the blockchain.