- Home
- MCP servers
- Uniswap Trader
Uniswap Trader
- javascript
34
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"kukapay-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"
}
}
}
}You can automate Uniswap trades across multiple blockchains using the Uniswap Trader MCP server. It exposes prompts to fetch real-time price quotes and to execute swaps on Uniswap V3, enabling multi-chain trading automation for your AI agents with configurable slippage, deadlines, and routing.
How to use
You interact with the Uniswap Trader MCP server through an MCP client to request price quotes and to execute swaps. You can request a price quote for a specific input token to a desired output token on a chosen chain, and you can place a swap with defined slippage tolerance and a deadline. The server returns route information, estimated gas, and risk bounds to help you decide when and how to trade.
Typical usage patterns include: - Requesting a price quote for a potential trade to compare routes and fees across supported chains. - Executing swaps with a chosen route, ensuring the slippage tolerance and deadline align with your trading strategy. - Using multi-hop route data to select the most efficient path based on liquidity and fees. If you plan to automate actions, feed the output from price quotes into your trading logic and trigger swaps when conditions are met.
Configuration example
The server is configured to run as a local stdio MCP server. The following configuration snippet shows how to start the server process and pass required 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"
}
}
}
}
Prerequisites and environment
Before you run the MCP server, ensure you have the following installed and prepared on your system: - Node.js version 14.x or higher. - npm for package management. - A funded wallet with a private key for executing swaps. - RPC endpoints for the supported chains (e.g., Infura/Alchemy URLs). The server relies on these to fetch quotes and to execute trades.
Supported chains and keys
The server supports multiple chains, and you must configure each chain with a valid RPC URL, WETH address, and SwapRouter address in your chain configuration. Commonly supported chains include Ethereum, Optimism, Polygon, Arbitrum, Celo, BNB Chain, Avalanche, and Base.
Tools and prompts
The MCP exposes prompts for price quotes and for executing swaps. These prompts enable you to query real-time pricing and to perform trades programmatically via your AI agent.
Tool descriptions shown here map to the functional prompts you can call: - getPrice: fetches a price quote for a Uniswap swap. - executeSwap: executes a swap on Uniswap with configurable slippage and deadline.
Security considerations
Protect your wallet private key and RPC endpoints. Use a secure environment for storing sensitive keys and consider employing key management or vault solutions for production deployments. Limit permissions on the wallet and avoid exposing keys in logs or error messages.
Troubleshooting
If you encounter connection or swap failures, verify that your RPC URLs are reachable, the wallet has sufficient funds and correct permissions, and that the chain configuration includes valid route endpoints for Uniswap V3 on each network. Check that environment variables INFURA_KEY and WALLET_PRIVATE_KEY are set correctly in your runtime environment.
Notes
This MCP server is designed to work with an MCP client that can send the defined prompts and interpret the responses. Ensure your client handles route data, gas estimates, and slippage calculations to avoid failed trades.
Available tools
getPrice
Fetches a real-time price quote for a Uniswap swap including route and gas estimates.
executeSwap
Executes a swap on Uniswap V3 with configurable slippage tolerance and deadline, returning the swap outcome and route details.