1. Conduid
  2. Blockchain
  3. Ethereum Trading MCP Server
MCP server · Blockchain

Ethereum Trading MCP Server

Build a Model Context Protocol (MCP) server in Rust that enables AI agents to query balances and execute token swaps on Ethereum.

Unclaimed last commit 11 months ago blockchain
34Low

Scored 14 days ago · breakdown

About Ethereum Trading MCP Server

Ethereum Trading MCP Server is an MCP server published by a67793581 in the Blockchain category: build a Model Context Protocol (MCP) server in Rust that enables AI agents to query balances and execute token swaps on Ethereum.

The repository has 2 stars and 0 forks, with the last commit 11 months ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/a67793581/Ethereum-Trading-MCP-Server

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Ethereum Trading MCP Server

Powered by Claude · Grounded in docs

I know everything about Ethereum Trading MCP Server. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ✓README presentThe repository ships documentation.

5 checks have not been run yet.

README

Programming Assignment: Ethereum Trading MCP Server

Overview

This project is a Model Context Protocol (MCP) server built in Rust that enables AI agents to query balances and execute token swaps on Ethereum.

Features

  • get_balance: Query ETH and ERC20 token balances.
  • get_token_price: Get current token price in USD using Chainlink price feeds.
  • swap_tokens: Simulate a token swap on Uniswap V2.

Technical Stack

  • Rust with Tokio for async runtime.
  • ethers-rs for Ethereum RPC communication.
  • rmcp for the MCP server framework.
  • rust_decimal for financial precision.
  • dotenv for managing environment variables.

Setup

  1. Install Rust:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
  2. Clone the repository:

    git clone <repository-url>
    cd <repository-name>
    
  3. Set up environment variables: Create a .env file in the root of the project and add your Ethereum RPC endpoint and a private key for simulations. You can use a service like Infura or Alchemy.

    # .env
    INFURA_PROJECT_ID=your_infura_project_id
    PRIVATE_KEY=your_wallet_private_key
    
  4. Build the project:

    cargo build --release
    
  5. Run the server:

    cargo run --release
    

    The server will start on 127.0.0.1:8080.

Example MCP Tool Call

Here is an example of calling the get_balance tool using curl.

Request:

curl -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "method": "get_balance",
  "params": {
    "wallet_address": "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B"
  },
  "id": 1
}' http://127.0.0.1:8080

Response:

{
  "jsonrpc": "2.0",
  "result": {
    "balance": "..."
  },
  "id": 1
}

Design Decisions

  • ethers-rs vs. alloy: I chose ethers-rs as it is more mature and has extensive documentation, which is beneficial for a project with a tight deadline.
  • Uniswap V2 for Swaps: I implemented swaps using Uniswap V2 for simplicity. The V2 router provides straightforward functions like swapExactTokensForTokens, which is easier to integrate than V3's more complex architecture.
  • Environment Variables for Secrets: Sensitive information like the Infura project ID and private keys are managed through a .env file, which is a standard and secure practice.

Known Limitations

  • Limited Token Support: The get_token_price and swap_tokens tools currently support a hardcoded list of tokens (ETH, DAI, USDC). This could be extended by using a dynamic token list or a discovery mechanism.
  • Uniswap V2 Only: The swap functionality is limited to Uniswap V2. Adding V3 support would require a more complex implementation to handle concentrated liquidity and path finding.
  • Basic Error Handling: The error handling is basic. A production-ready server would need more robust error handling and reporting.

Tests

To run the tests, use the following command:

cargo test

The tests cover the core functionality of the MCP tools. Note that the tests require a valid INFURA_PROJECT_ID and PRIVATE_KEY in the .env file to run.

README copy captured when this server was indexed; it may lag the repository. The original is authoritative.

Questions

About Ethereum Trading MCP Server

How do I install Ethereum Trading MCP Server?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Ethereum Trading MCP Server safe to use with an AI agent?

Its trust score is 34 out of 100 (low). It passes 1 of the 1 static security checks run so far. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Ethereum Trading MCP Server still maintained?

The last commit was 11 months ago. That's long enough that you should check whether the maintainer is responding to issues before depending on it.