Basic MCP Server built in Rust to allow AI Agent to interact with Uniswap API
I started this hackathon project to learn how to code in Rust. I wanted to learn this programming language by building something practical. I thought of a simple MCP Server that interacts with the Uniswap Trade API, fetching swap quotes. It sends authenticated HTTP requests to the official quote endpoint, builds a JSON body for a sample trade (for example, ETH-to-USDT on Ethereum mainnet), and prints the API response. The goal is to explore how programmatic access to Uniswap pricing and routing works, and to lay the groundwork for exposing that behaviour through an MCP-style server so assistants and other tools can query DeFi quotes in a structured way. Configuration uses an API key from the environment so secrets stay out of source control
Built in Rust, it uses the reqwest crate to interact with the Uniswap API and perform HTTP calls. The script loads the Uniswap API key safely from a .env file. Interaction with HTTP is handled with reqwest’s async client, which sends a POST request to "https://gateway.uniswap.org/v1/quote".
#[tokio::main] is used so network I/O is async and does not block the runtime—important if this grows into an MCP server handling many concurrent clients.

