uniswap-trader-mcp

by kukapay
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Enables token swaps on Uniswap DEX on the BNB Chain (Binance Smart Chain), supporting BNB as the native token.

  • Enables token swaps on Uniswap DEX on the Ethereum mainnet, with price quotes, swap execution, and trading suggestions.

  • Supports token swaps on Uniswap DEX on the Optimism Layer 2 network, with real-time price quotes and optimized routing.

Uniswap 交易者 MCP

一个用于 AI 代理的 MCP 服务器,用于跨多个区块链自动执行 Uniswap DEX 上的代币交换。

特征

  • 价格报价:通过多跳路由优化获取代币交换的实时价格报价。
  • 掉期执行:在 Uniswap V3 上执行掉期,具有可配置的滑点容忍度和期限。
  • 掉期建议:根据流动性、费用和最佳路径生成交易建议。
  • 多链支持:兼容以太坊、Optimism、Polygon、Arbitrum、Celo、BNB Chain、Avalanche 和 Base。

先决条件

  • Node.js :版本 14.x 或更高版本。
  • npm :用于包管理。
  • 钱包:一个有资金的钱包,带有用于执行交换的私钥。
  • RPC 端点:访问受支持链的区块链 RPC URL(例如 Infura、Alchemy)。

安装

  1. 克隆存储库
    git clone https://github.com/kukapay/uniswap-trader-mcp.git cd uniswap-trader-mcp
  2. 安装依赖项
    npm install

配置

{ "mcpServers": { "Uniswap-Trader-MCP": { "command": "node", "args": ["path/to/uniswap-trader-mcp/server/index.js"], "env": { "INFURA_KEY": "your infura key", "WALLET_PRIVATE_KEY": "your private key" } } } }

用法

支持的链

支持以下区块链。请确保在chainConfigs.js中配置每个链的有效 RPC URL、WETH 地址和 SwapRouter 地址。

链ID姓名笔记
1以太坊主网,广泛用于 Uniswap 交易
10乐观第 2 层,需要 Optimism RPC
137多边形快速且低成本,使用 MATIC 作为原生
42161仲裁第 2 层,Arbitrum One 网络
42220塞洛移动优先区块链,使用 CELO
56BNB链币安智能链,使用BNB
43114雪崩高通量,使用 AVAX
8453根据Coinbase 的 Layer 2,基于 Optimism

工具和提示

1. getPrice

获取 Uniswap 交换的报价。

架构

  • chainId :数字(默认值:1)
  • tokenIn :字符串(例如"NATIVE"或代币地址)
  • tokenOut :字符串(例如"NATIVE"或代币地址)
  • amountIn :字符串(可选, "exactIn"必需)
  • amountOut :字符串(可选, "exactOut"必需)
  • tradeType"exactIn""exactOut" (默认值: "exactIn"

示例提示:

Get me a price quote for swapping 1 ETH to DAI on Ethereum.

输出:

{ "chainId": 1, "tradeType": "exactIn", "price": "3000.50", "inputAmount": "1.000000", "outputAmount": "3000.50", "minimumReceived": "2985.50", "maximumInput": "1.005000", "route": [ { "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "tokenOut": "0x6B175474E89094C44Da98b954EedeAC495271d0F", "fee": 3000 } ], "estimatedGas": "150000" }

2. executeSwap

在 Uniswap 上执行交换。

架构

  • chainId :数字(默认值:1)
  • tokenIn :字符串
  • tokenOut :字符串
  • amountIn :字符串(可选, "exactIn"必需)
  • amountOut :字符串(可选, "exactOut"必需)
  • tradeType"exactIn""exactOut" (默认值: "exactIn"
  • slippageTolerance :数字(默认值:0.5,百分比)
  • deadline :数字(默认值:20,以分钟为单位)

示例提示:

Swap 1 ETH for DAI on Ethereum with a 0.5% slippage tolerance and a 20-minute deadline.

输出:

{ "chainId": 1, "txHash": "0x1234...abcd", "tradeType": "exactIn", "amountIn": "1.000000", "outputAmount": "2990.75", "minimumReceived": "2985.50", "maximumInput": "1.005000", "fromToken": "NATIVE", "toToken": "0x6B175474E89094C44Da98b954EedeAC495271d0F", "route": [ { "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "tokenOut": "0x6B175474E89094C44Da98b954EedeAC495271d0F", "fee": 3000 } ], "gasUsed": "145000" }

执照

MIT 许可证。详情请参阅许可证

-
security - not tested
A
license - permissive license
-
quality - not tested

一个用于 AI 代理的 MCP 服务器,用于跨多个区块链自动执行 Uniswap DEX 上的代币交换。

  1. Features
    1. Prerequisites
      1. Installation
        1. Configuration
          1. Usage
            1. Supported Chains
            2. Tools and Prompts
          2. License
            ID: wjbh1v7a2r