DeFi Trading Agent

DeFi Trading Agent

edkdev

Turns AI assistants into autonomous crypto trading agents that can execute DeFi trades across 17+ blockchains with real-time market analysis and portfolio management. Supports gasless trading and memecoin scanning.

Transforms conversational interfaces into autonomous DeFi trading agents with real-time market analysis, portfolio management, and seamless trade execution across 17+ blockchains including Ethereum, Base, and Arbitrum through 0x API swap aggregation and gasless trading support.

39634 views21Local (stdio)

What it does

  • Execute token swaps across 17+ blockchains
  • Scan for newly launched memecoins with liquidity filtering
  • Perform real-time portfolio monitoring and risk management
  • Get price quotes with slippage calculations
  • Analyze OHLCV data for technical trading signals
  • Place gasless trades with automated stop-losses

Best for

DeFi traders automating portfolio managementCrypto researchers scanning new token launchesRisk managers monitoring position changesDevelopers building trading bots
17+ blockchain supportGasless trading capabilityBuilt-in memecoin scanner

About DeFi Trading Agent

DeFi Trading Agent is a community-built MCP server published by edkdev that provides AI assistants with tools and capabilities via the Model Context Protocol. DeFi Trading Agent enables autonomous trading, real-time analysis, and seamless execution across 17+ blockchains with ga It is categorized under finance, developer tools.

How to install

You can install DeFi Trading Agent in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

License

DeFi Trading Agent is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

DeFi Trading Agent MCP Server

Transform your AI assistant into an autonomous crypto trading agent with real-time market analysis, portfolio management, and seamless trade execution across 17+ blockchains.

🎯 Starting Prompt Examples

Simple Quote

Get me a quote for 0.1 eth to usdc on Base chain.

Quote and Swap

Get me a quote for 0.1 eth on ethereum chain and execute the swap.

Memecoin Opportunity Scanner

"Scan for newly launched memecoins on Base with >$100K liquidity, pick one or two tokens and analyze the best entry opportunities"

Advanced Analysis Process:

  1. Discovery Phase: Uses get_new_pools to find tokens launched in last 24h
  2. Volume Filtering: Identifies pools with >$100K liquidity and high trading activity
  3. Technical Analysis: Pulls OHLCV data to analyze price patterns and momentum
  4. Risk Assessment: Evaluates liquidity depth, holder concentration, and volatility
  5. Entry Strategy: Determines optimal entry price, position size, and risk management
  6. Execution: Places gasless swap with calculated slippage and stop-loss levels

Example AI Analysis:

"Found 3 promising new tokens:
πŸš€ $ROCKET (0x123...): 2M volume, bullish OHLCV pattern, 85% liquidity locked
πŸ“ˆ Entry: $0.0001 (current support level)
πŸ’° Size: 2% portfolio allocation
πŸ›‘οΈ Stop: $0.000085 (-15%)
🎯 Target: $0.00015 (+50%)
Executing gasless swap now..."

Risk Management Agent

"Monitor my portfolio and alert me if any position drops more than 15%"

Agent Actions:

  1. Continuously monitors portfolio values
  2. Calculates position changes
  3. Provides alerts and recommendations
  4. Can execute protective trades

πŸš€ Quick Start

Installation

npm install -g defi-trading-mcp

Create a New Wallet (Recommended)

npx defi-trading-mcp --create-wallet

This generates a new wallet with private key and address for secure trading.

πŸ’° Need crypto? See our guide: How to Load Crypto into Your Wallet

βš™οΈ Configuration

Required Keys

  • USER_PRIVATE_KEY: Your private key (for signing transactions locally, stays local, never transmitted)
  • USER_ADDRESS: Your Ethereum wallet address
  • COINGECKO_API_KEY: CoinGecko API key for market data (How to get your CoinGecko API key)

Optional Configuration

  • ALCHEMY_API_KEY: Add an Alchemy API key to use your own RPCs, otherwise public rpcs will be used.

πŸ”§ Premium RPC Integration

Your ALCHEMY_API_KEY automatically enables premium RPCs for:

  • 15 Major Chains: Base, Polygon, Arbitrum, Optimism, BSC, Avalanche, Worldchain, Berachain, Blast, Linea, Scroll, Mantle, Ink, MonadTestnet
  • Enhanced Performance: Lower latency, better uptime
  • Automatic Fallback: Public RPCs for other chains

πŸ”’ Security

  • Private keys remain on your device
  • No sensitive data transmitted to external servers
  • Secure transaction signing locally

MEV Protection

  • Ethereum transactions are protected from MEV attacks, sandwich attacks, and front-running
  • Private mempool routing ensures your trades aren't visible to MEV bots
  • Fair pricing without manipulation from malicious actors
  • Automatic protection - no additional configuration required

πŸ”§ MCP Client Setup

Kiro IDE

Step 1: Install the MCP

npm install -g defi-trading-mcp

Add to ~/.kiro/settings/mcp.json:

{
  "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"
      }
    }
  }
}

Claude Code

Add the MCP to Claude Code using the command line:

Step 1: Install the MCP

npm install -g defi-trading-mcp

Step 2: Add to Claude Code - Replace the placeholders with your environment variables

For macOS/Linux/WSL:

claude mcp add defi-trading \
  -e USER_PRIVATE_KEY=your_private_key_here \
  -e USER_ADDRESS=0xYourWalletAddress \
  -e COINGECKO_API_KEY=CG-your_coingecko_api_key \
  -e ALCHEMY_API_KEY=your_alchemy_api_key \
  -- npx defi-trading-mcp

For Windows (native, not WSL):

claude mcp add defi-trading \
  -e USER_PRIVATE_KEY=your_private_key_here \
  -e USER_ADDRESS=0xYourWalletAddress \
  -e COINGECKO_API_KEY=CG-your_coingecko_api_key \
  -e ALCHEMY_API_KEY=your_alchemy_api_key \
  -- cmd /c npx defi-trading-mcp

Windows Note: The cmd /c wrapper is required on native Windows to prevent "Connection closed" errors when using npx.

Step 3: Verify the MCP is added

claude mcp list

Step 4: Update wallet details (if needed) If you need to update your private key or wallet address after initial setup:

# Remove existing configuration
claude mcp remove defi-trading

# Add back with updated wallet details
claude mcp add defi-trading \
  -e USER_PRIVATE_KEY=your_new_private_key \
  -e USER_ADDRESS=0xYourNewWalletAddress \
  -e COINGECKO_API_KEY=CG-your_coingecko_api_key \
  -e ALCHEMY_API_KEY=your_alchemy_api_key \
  -- npx defi-trading-mcp

Step 5: Start using the trading agent Open Claude Code and start trading. Example Prompt:

"Check my portfolio across all chains and find trending memecoins on Base"

Claude Desktop

Step 1: Install the MCP

npm install -g defi-trading-mcp

Open Claude Desktop. Click the top left menu with the three dashes. Click Developer. Then click Open App Config File. Your config file will open. Then add the following.

{
  "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"
      }
    }
  }
}

Cursor

Quick Setup (2 Steps)

Step 1: Install the package

npm install -g defi-trading-mcp

Step 2: Add to Cursor (One-Click)

Click the button below to automatically configure the MCP in Cursor:

Add DeFi Trading MCP to Cursor

Important: The deeplink only configures Cursor - you must install the npm package first!

Manual Setup

Step 1: Install the MCP

npm install -g defi-trading-mcp

Step 2: Add to Cursor Configuration

  1. Open Cursor
  2. Go to Settings β†’ Extensions β†’ MCP Servers
  3. Add a new server with the following configuration:
{
  "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"
    }
  }
}

Step 3: Configure Environment Variables

Replace the placeholder values with your actual credentials:

  • USER_PRIVATE_KEY: Your wallet's private key
  • USER_ADDRESS: Your wallet address
  • COINGECKO_API_KEY: Your CoinGecko API key (Get one here)
  • ALCHEMY_API_KEY: Your Alchemy API key (optional)

Step 4: Start Trading

Open Cursor and start using the DeFi Trading Agent:

"Get me a quote for 0.1 ETH to USDC on Base chain"

Other MCP Clients

For other MCP clients like Github Copilot(mcp.json), Gemini Cli (settings.json), find equivalent file and use the same pattern with environment variables:

{
  "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"
      }
    }
  }
}

πŸ€– Trading Agent Capabilities

Autonomous Portfolio Management

Intelligent Market Analysis

Advanced Trade Execution

Risk Management & Security

πŸ› οΈ Trading Agent Tools

Portfolio Management

  • 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

Market Intelligence & 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

Smart Trading

  • 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

Gasless Trading

  • get_gasless_price - Get prices for gas-free trades
  • `get_gasless_quot

README truncated. View full README on GitHub.

Alternatives

Related Skills

Browse all skills
ai-sdk

Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText, streamText, ToolLoopAgent, embed, or tools, (2) Want to build AI agents, chatbots, RAG systems, or text generation features, (3) Have questions about AI providers (OpenAI, Anthropic, Google, etc.), streaming, tool calling, structured output, or embeddings, (4) Use React hooks like useChat or useCompletion. Triggers on: "AI SDK", "Vercel AI SDK", "generateText", "streamText", "add AI to my app", "build an agent", "tool calling", "structured output", "useChat".

6
ydc-ai-sdk-integration

Integrate Vercel AI SDK applications with You.com tools (web search, AI agent, content extraction). Use when developer mentions AI SDK, Vercel AI SDK, generateText, streamText, or You.com integration with AI SDK.

2
crewai-developer

Comprehensive CrewAI framework guide for building collaborative AI agent teams and structured workflows. Use when developing multi-agent systems with CrewAI, creating autonomous AI crews, orchestrating flows, implementing agents with roles and tools, or building production-ready AI automation. Essential for developers building intelligent agent systems, task automation, and complex AI workflows.

2
ccxt-typescript

CCXT cryptocurrency exchange library for TypeScript and JavaScript developers (Node.js and browser). Covers both REST API (standard) and WebSocket API (real-time). Helps install CCXT, connect to exchanges, fetch market data, place orders, stream live tickers/orderbooks, handle authentication, and manage errors. Use when working with crypto exchanges in TypeScript/JavaScript projects, trading bots, arbitrage systems, or portfolio management tools. Includes both REST and WebSocket examples.

1
ydc-claude-agent-sdk-integration

Integrate Claude Agent SDK with You.com HTTP MCP server for Python and TypeScript. Use when developer mentions Claude Agent SDK, Anthropic Agent SDK, or integrating Claude with MCP tools.

0
moon-dev-trading-agents

Master Moon Dev's Ai Agents Github with 48+ specialized agents, multi-exchange support, LLM abstraction, and autonomous trading capabilities across crypto markets

114