MegaSwap MCP Server

April 16, 2026 ยท View on GitHub

AI-native DEX interface for MegaSwap on MegaETH. Enables AI agents to swap tokens, query prices, and manage liquidity via the Model Context Protocol (MCP).

Quick Start

npx megaswap-mcp

Tools

ToolDescriptionRequires Key?
megaswap_get_quoteGet swap price quoteNo
megaswap_swapExecute token swapYes
megaswap_get_pairGet pair reserves & priceNo
megaswap_list_pairsList all trading pairsNo
megaswap_get_balanceCheck token/ETH balanceNo
megaswap_add_liquidityAdd liquidity to poolYes
megaswap_remove_liquidityRemove liquidityYes
megaswap_list_tokensList known tokensNo
megaswap_get_token_infoGet token detailsNo

Configuration

Environment Variables

VariableRequiredDescription
MEGASWAP_PRIVATE_KEYFor swaps/liquidityWallet private key for signing transactions
MEGASWAP_RPC_URLNoCustom RPC endpoint (default: https://mainnet.megaeth.com/rpc)

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "megaswap": {
      "command": "npx",
      "args": ["-y", "megaswap-mcp"],
      "env": {
        "MEGASWAP_PRIVATE_KEY": "your-private-key-here"
      }
    }
  }
}

Cursor / Windsurf

Add to MCP settings:

{
  "megaswap": {
    "command": "npx",
    "args": ["-y", "megaswap-mcp"],
    "env": {
      "MEGASWAP_PRIVATE_KEY": "your-private-key-here"
    }
  }
}

Supported Tokens

Built-in symbols: ETH, WETH, MEGAS, USDM, USDT0

Any ERC-20 token on MegaETH can be used by passing its contract address.

Examples

Get a swap quote:

"How much MEGAS can I get for 1 ETH on MegaSwap?"

Execute a swap:

"Swap 0.5 ETH for MEGAS on MegaSwap with 2% slippage"

Check liquidity:

"Show me the ETH/MEGAS pair info on MegaSwap"

Add liquidity:

"Add 1 ETH and 1000 MEGAS as liquidity on MegaSwap"

Network

License

MIT