development
documentation
public
blockchain
trading
What is An MCP server for AI agents to automate token swaps on Uniswap DEX across multiple blockchains.?
Uniswap Trader MCP is an MCP server designed for AI agents to automate token swaps on the Uniswap decentralized exchange (DEX) across multiple blockchains. It features real-time price quotes, swap execution with configurable slippage tolerance, trading suggestions based on liquidity and fees, and supports various blockchains including Ethereum, Optimism, Polygon, Arbitrum, Celo, BNB Chain, Avalanche, and Base.
Documentation
Uniswap Trader MCP
An MCP server for AI agents to automate token swaps on Uniswap DEX across multiple blockchains.
Features
Price Quotes: Get real-time price quotes for token swaps with multi-hop route optimization.
Swap Execution: Execute swaps on Uniswap V3 with configurable slippage tolerance and deadlines.
Swap Suggestions: Generate trading suggestions based on liquidity, fees, and optimal paths.
Multi-Chain Support: Compatible with Ethereum, Optimism, Polygon, Arbitrum, Celo, BNB Chain, Avalanche, and Base.
Prerequisites
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 (e.g., Infura, Alchemy) 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
Clone the Repository:
git clone https://github.com/kukapay/uniswap-trader-mcp.git
cd uniswap-trader-mcp
Install Dependencies:
npm install
Configuration
{
"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"
}
}
}
}
```\n\n## Usage# Supported Chains
The following blockchains are supported. Ensure each chain is configured in `chainConfigs.js` with a valid RPC URL, WETH address, and SwapRouter address.
| 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 Prompts## 1. `getPrice`
Fetches a price quote for a Uniswap swap.
**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.