Uniswap Trader MCP server

Enables AI-driven cryptocurrency trading on Uniswap across multiple blockchains, providing tools for price quotes, optimal routing, and transaction management for automated trading strategies.
Back to servers
Setup instructions
Provider
kukapay
Release date
Mar 21, 2025
Language
TypeScript
Stats
24 stars

The Uniswap Trader MCP server enables AI agents to automate token swaps on Uniswap DEX across multiple blockchains, providing features like real-time price quotes, swap execution, trading suggestions, and support for various networks including Ethereum, Optimism, Polygon, and others.

Prerequisites

Before installing the Uniswap Trader MCP server, ensure you have:

  • Node.js: Version 14.x or higher
  • npm: For package management
  • Wallet: A funded wallet with a private key for executing swaps
  • RPC Endpoints: Access to blockchain RPC URLs (Infura, Alchemy, etc.) for supported chains

Installation

Installing via Smithery

To install Uniswap Trader MCP for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @kukapay/uniswap-trader-mcp --client claude

Manual Installation

  1. Clone the Repository:

    git clone https://github.com/kukapay/uniswap-trader-mcp.git
    cd uniswap-trader-mcp
    
  2. Install Dependencies:

    npm install
    

Configuration

Create a configuration file with your environment variables:

{
  "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"
      }
    }
  }
}

Supported Blockchains

The following blockchains are supported:

Chain ID Name Notes
1 Ethereum Mainnet, widely used for Uniswap trades
10 Optimism Layer 2, requires Optimism RPC
137 Polygon Fast and low-cost, uses MATIC as native
42161 Arbitrum Layer 2, Arbitrum One network
42220 Celo Mobile-first blockchain, uses CELO
56 BNB Chain Binance Smart Chain, uses BNB
43114 Avalanche High-throughput, uses AVAX
8453 Base Coinbase's Layer 2, built on Optimism

Tools and Usage

Getting Price Quotes

Use the getPrice tool to fetch real-time price quotes for token swaps.

Schema:

  • chainId: Number (default: 1)
  • tokenIn: String (e.g., "NATIVE" or token address)
  • tokenOut: String (e.g., "NATIVE" or token address)
  • amountIn: String (optional, required for "exactIn")
  • amountOut: String (optional, required for "exactOut")
  • tradeType: "exactIn" or "exactOut" (default: "exactIn")

Example prompt:

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

Example output:

{
  "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"
}

Executing Swaps

Use the executeSwap tool to perform token swaps on Uniswap.

Schema:

  • chainId: Number (default: 1)
  • tokenIn: String
  • tokenOut: String
  • amountIn: String (optional, required for "exactIn")
  • amountOut: String (optional, required for "exactOut")
  • tradeType: "exactIn" or "exactOut" (default: "exactIn")
  • slippageTolerance: Number (default: 0.5, in percentage)
  • deadline: Number (default: 20, in minutes)

Example prompt:

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

Example output:

{
  "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"
}

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "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"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "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"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "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"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later