home / mcp / defi trading agent mcp server

DeFi Trading Agent MCP Server

DeFi Trading Agent MCP Server - Transform your AI into an autonomous crypto trading agent

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "edkdev-defi-trading-mcp": {
      "command": "npx",
      "args": [
        "defi-trading-mcp"
      ],
      "env": {
        "USER_ADDRESS": "0xYourWalletAddress",
        "ALCHEMY_API_KEY": "your_alchemy_api_key",
        "USER_PRIVATE_KEY": "your_private_key_here",
        "COINGECKO_API_KEY": "CG-your_coingecko_api_key"
      }
    }
  }
}

You can transform your AI assistant into an autonomous DeFi trading agent that analyzes markets in real time, manages multi-chain portfolios, and executes trades with smart risk controls. This MCP server enables you to access advanced market intelligence, portfolio metrics, and gasless trade execution across 17+ blockchains from a single integration point.

How to use

You interact with the trading agent through your MCP client to perform tasks like scanning for new liquidity events, analyzing OHLCV data, and executing trades. Start by loading the MCP server in your client, then issue natural-language prompts or scripted commands to retrieve portfolio insights, run technical analyses, or place trades. The agent can continuously monitor portfolios, identify entry points, manage positions with stop-loss rules, and execute gasless swaps when you authorize.

How to install

Prerequisites: ensure you have Node.js and npm installed on your machine.

# Install the MCP package globally
npm install -g defi-trading-mcp
```

```bash
# Optional: Create a new wallet for secure trading
npx defi-trading-mcp --create-wallet

Configuration and usage details

The MCP server requires crypto and API credentials to operate. You provide these through environment variables in your MCP client configuration.

{
  "mcpServers": {
    "defi_trading": {
      "command": "npx",
      "args": ["defi-trading-mcp"],
      "env": {
        "USER_PRIVATE_KEY": "your_private_key_here",
        "USER_ADDRESS": "0xYourWalletAddress",
        "COINGECKO_API_KEY": "CG-your_coingecko_api_key",
        "ALCHEMY_API_KEY": "your_alchemy_api_key"
      }
    }
  }
}

Security and MEV protection

Private keys stay on your device and are used only to sign transactions locally. No sensitive data is transmitted to external servers. Ethereum transactions receive MEV protection, private mempool routing, and fair pricing without manipulation.

The system is designed to protect trades from front-running and sandwich attacks while maintaining automatic protection with default safeguards. No extra configuration is needed to enable MEV protection.

Trading agent capabilities

Autonomous Portfolio Management, Intelligent Market Analysis, Advanced Trade Execution, and Risk Management & Security are core capabilities. You can run multi-chain portfolio analysis, detect trending pools, pull OHLCV data for technical analysis, and execute optimized swaps across supported networks.

Trading tools and endpoints

The agent exposes a suite of tools to support multi-chain trading and analysis, including portfolio management, market intelligence, smart trading, gasless trading, and utility tools for unit conversions. You can query prices, get swap quotes, execute trades, and monitor gasless swap status.

Key tool areas include: portfolio management, market intelligence and analysis, smart trading, gasless trading, and utility tools for unit conversions.

Supported networks

Trade across 17+ blockchains, including Ethereum, Base, Polygon, Arbitrum, Optimism, BSC, Avalanche, Linea, Scroll, Mantle, and more. Use the agent to discover supported chains and execute cross-chain strategies.

Getting help and getting involved

Join the community for support, discussions, and updates. Open issues for bugs, start conversations for improvements, and review guides for API usage and loading data.

Available tools

get_portfolio_tokens

Multi-chain portfolio analysis with prices and metadata

get_portfolio_balances

Fast balance checking across all chains

get_portfolio_transactions

Complete transaction history analysis

get_trending_pools

Identify hot trading opportunities with volume metrics

get_new_pools

Discover newly launched tokens and liquidity pools

get_pool_ohlcv

Technical analysis with OHLCV candlestick data

get_pool_trades

Analyze recent trading activity and whale movements

get_token_price

Real-time pricing with 24h change indicators

get_token_data

Deep token research with metadata and social links

get_token_info

Comprehensive token analysis including descriptions

search_pools

Find specific pools by token symbol or contract address

get_swap_price

Get best prices across all DEXes

get_swap_quote

Get executable quotes with transaction data

execute_swap

Execute trades with optimal routing

get_supported_chains

List all 17+ supported blockchains

get_gasless_price

Get prices for gas-free trades

get_gasless_quote

Get gasless swap quotes

submit_gasless_swap

Execute trades without holding ETH

get_gasless_status

Monitor gasless transaction status

convert_wei_to_formatted

Convert blockchain units to human-readable form

convert_formatted_to_wei

Convert amounts to blockchain format