home / mcp / layer2 mcp server

Layer2 MCP Server

Provides tools to deploy ERC20 tokens, transfer ETH and tokens, and perform batch transfers on Layer 2 networks.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "anylots-layer2-mcp": {
      "command": "node",
      "args": [
        "/path-to-layer2-mcp/build/src/index.js"
      ],
      "env": {
        "ETH_L2_RPC": "https://your-layer2-rpc-url",
        "PRIVATE_KEY": "YOUR_ETH_WALLET_PRIVATE_KEY"
      }
    }
  }
}

You will run an MCP server that lets AI models interact with an Ethereum layer 2 network using a standard, extensible interface. This server enables token deployment, token transfers, ETH transfers, and batch operations, making it easier to integrate blockchain actions into AI workflows.

How to use

Set up the MCP server locally and connect your MCP client to start issuing token and transfer operations. The server is designed to be run as a local process and can be driven by common MCP clients or tooling that supports HTTP or stdio MCP endpoints. You will deploy tokens, transfer ETH, transfer ERC20 tokens, and perform batch transfers on demand, then observe the results through the client.

How to install

Prerequisites you need on your machine before you begin:

- Node.js and npm (for command line execution and building the project)

- Git (to clone the repository)

Follow these concrete steps to install and prepare the MCP server:

# Clone the repository
git clone https://github.com/anylots/layer2-mcp.git
cd layer2-mcp

# Install dependencies
npm install

# Build the project
npm run build

Additional content

Configuration and runtime notes are provided to help you run the server securely and effectively. You will set environment variables for your Ethereum private key and the Layer 2 RPC endpoint, and you will run the server in a local environment during development. You can test the available tools and verify transfers using the included MCP Inspector tooling.

Available tools

deployToken

Deploy a new ERC20 token contract and return its contract address and transaction hash.

transferETH

Transfer a specified amount of ETH to a target address and return the transaction hash.

transferToken

Transfer ERC20 tokens from the deployed contract to a target address and return the transaction hash.

batchTransfer

Execute multiple token transfers to random addresses over a defined duration to simulate activity and load.