Uniswap MCP Server Rust
Interacting with the Uniswap API in Rust
Ask AI about Uniswap MCP Server Rust
Powered by Claude Β· Grounded in docs
I know everything about Uniswap MCP Server Rust. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
π¦ Uniswap MCP Server Rust π¦

An MCP (Model Context Protocol) server in Rust that exposes Uniswap Trade API quotes as a tool for AI clients. Built with the official Rust SDK RMCP (rmcp on crates.io).
Prerequisites
- Rust toolchain (
cargo,rustc) - A Uniswap Trade API key as
UNISWAP_API_KEY(see Uniswap docs)
Configuration
Create a .env file next to Cargo.toml (or export the variable in your shell):
UNISWAP_API_KEY=your_key_here
The server loads .env at startup using the crate manifest directory, so it works when MCP hosts run the binary from another working directory.
Build
cargo build --release
How it works
- Transport: stdio (standard for local MCP: the host spawns this process and speaks JSON-RPC over stdin/stdout).
- SDK:
rmcpwithserver+transport-io. - Tool:
uniswap_swap_quoteβ callsPOST https://trade-api.gateway.uniswap.org/v1/quotewith your API key and returns the JSON quote (pretty-printed text). Usetoken_in_presetto pick the asset you sell on Ethereum mainnet without typing addresses:native_eth,usdc,usdt,wbtc,dai,weth. If you set a preset, it overridestoken_in; otherwise pass a fulltoken_inaddress.
Async runtime: Tokio (required by RMCP and reqwest).
Using with an MCP client
Point your MCP host at the compiled binary. Example for Cursor (.cursor/mcp.json or global MCP settings):
{
"mcpServers": {
"uniswap": {
"command": "/absolute/path/to/uniswap-api-rust/target/release/uniswap-mcp-server-rust",
"env": {
"UNISWAP_API_KEY": "your_key_here"
}
}
}
}
You can omit env if UNISWAP_API_KEY is already in the environment.
To debug with the official inspector (see RMCP examples):
npx @modelcontextprotocol/inspector /absolute/path/to/target/debug/uniswap-mcp-server-rust
Example to test
Run the commands from the previous section and open the MCP Inspector in your browser.
- Enter the following values as example
"tokenIn": "0x0000000000000000000000000000000000000000", // ETH
"tokenOut": "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT
"tokenInChainId": 1,
"tokenOutChainId": 1,
"type": "EXACT_INPUT",
"amount": "1000000000000000000", // 1 ETH in wei
"swapper": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", // User's wallet address (vitalik.eth)
- Click on the "Run Tool" button
Learning steps
- MCP server over stdio with RMCP
- Async quote tool via Uniswap Trade API
- Make it I can enter different commands while it is running
(
start,stop,unicorns) - Try to use functionalities from the allow web3 library for Rust.
- Extend with more tools (e.g. supported chains, token metadata)
License
See LICENSE in the repository.
