Sponsored by Deepsite.site

Linea MCP Server

Created By
qvkare10 months ago
A Model Context Protocol (MCP) server that provides on-chain tools for AI applications to interact with the Linea blockchain.
Content

Linea MCP Server

Linea MCP Logo

A Model Context Protocol (MCP) server that provides on-chain tools for AI applications to interact with the Linea blockchain.

npm version License: MIT

Overview

Linea-MCP extends any MCP client's capabilities by providing tools to interact with the Linea blockchain, an Ethereum Layer 2 scaling solution using zero-knowledge proof technology. This server enables AI assistants like Claude, Cursor, and other MCP-compatible clients to perform blockchain operations through natural language requests.

Key Features

  • Wallet Management: Retrieve addresses and check balances
  • Token Operations: Transfer ERC20 tokens, check balances, list tokens
  • Smart Contract Interactions: Deploy and call contracts
  • NFT Management: List and transfer NFTs
  • Bridge Operations: Bridge assets between Ethereum and Linea
  • DeFi Integrations: Interact with DeFi protocols
  • Verax Integration: Verify identity with Linea Verax attestations
  • Linea ENS: Resolve and manage Linea ENS names

See examples.md for detailed usage examples.

Quick Start

Prerequisites

  • Node.js (v16+)
  • npm or yarn
  • Access to Linea RPC endpoints

Installation Options

Option 1: Quick Install (Global Package)

# Install globally
npm install -g linea-mcp

# Create a basic .env file
echo "LINEA_MAINNET_RPC_URL=https://rpc.linea.build
LINEA_TESTNET_RPC_URL=https://rpc.sepolia.linea.build
WALLET_PRIVATE_KEY=your_wallet_private_key_here
INFURA_API_KEY=your_infura_key_here" > .env

# Start the server
linea-mcp

Option 2: Development Install (From Source)

# Clone the repository
git clone https://github.com/qvkare/linea-mcp.git
cd linea-mcp

# Install dependencies
npm install

# Configure environment
cp .env.example .env
# Edit .env with your configuration

# Build and start
npm run build
node dist/index.js  # Using Node directly is more reliable than npm start

Integration with MCP Clients

This MCP server can be integrated with any MCP-compatible client including Cursor, Claude Desktop, Windsurf, Cline, and other AI assistants.

General Configuration Steps

  1. Find your client's MCP configuration file location
  2. Add a Linea MCP server configuration section
  3. Configure the server using one of the following approaches:

Option 1: Using Global Installation (Simple)

{
  "mcpServers": {
    "linea": {
      "command": "npx",
      "args": ["linea-mcp@latest"],
      "env": {
        "PORT": "3000",
        "LINEA_MAINNET_RPC_URL": "https://rpc.linea.build",
        "LINEA_TESTNET_RPC_URL": "https://rpc.sepolia.linea.build",
        "INFURA_API_KEY": "your_infura_key",
        "ALCHEMY_API_KEY": "your_alchemy_key",
        "PRIVATE_KEY_ENCRYPTION_KEY": "your_encryption_key_please_change",
        "WALLET_PRIVATE_KEY": "your_wallet_private_key_or_mnemonic",
        "NODE_ENV": "development",
        "ETHEREUM_RPC_URL": "https://mainnet.infura.io/v3/your_infura_key",
        "ETHEREUM_TESTNET_RPC_URL": "https://sepolia.infura.io/v3/your_infura_key"
      }
    }
  }
}
{
  "mcpServers": {
    "linea": {
      "command": "node",
      "args": ["/absolute/path/to/linea-mcp/dist/index.js"],
      "cwd": "/absolute/path/to/linea-mcp",
      "env": {
        // Same environment variables as Option 1
        "PORT": "3000",
        "LINEA_MAINNET_RPC_URL": "https://rpc.linea.build",
        // ... other variables from Option 1
      }
    }
  }
}

Important Note: When using a local installation, directly running the JavaScript file with Node.js provides more reliable communication than using npm scripts.

Client-Specific Locations

  • Cursor:

    • Windows: %APPDATA%\Cursor\mcp.json
    • macOS: ~/Library/Application Support/Cursor/mcp.json
    • Linux: ~/.config/Cursor/mcp.json
  • Claude Desktop:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  • Other Clients: Refer to your client's documentation for MCP configuration location

Troubleshooting

Common Issues

  1. "No tools available" or "Client closed" errors:

    • Use direct Node.js execution ("command": "node", "args": ["/path/to/dist/index.js"]) instead of npm scripts
    • Ensure environment variables are configured correctly
    • Restart your client after configuration changes
  2. JSON parsing errors in logs:

    • These indicate communication protocol issues
    • Using direct Node.js execution usually resolves these problems
    • Make sure the cwd property is set correctly
  3. Complete troubleshooting guide:

Available Tools

The server provides tools across multiple categories:

  • Wallet: Address management, balance checking, fund transfers
  • Tokens: ERC20 transfers, balance checking, token information
  • Contracts: Deployment and interaction
  • NFTs: Listing and transfers
  • Bridge: Asset bridging between Ethereum and Linea
  • DeFi: Liquidity pools, token swaps, yield farming
  • ENS: Name resolution and record management
  • Verax: Identity verification

For a complete list of tools and their usage, see docs/tools.md.

Security Considerations

  • Never share your private keys or seed phrases
  • Use environment variables for sensitive configuration
  • Test extensively with testnet before using on mainnet

License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
CursorThe AI Code Editor
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
DeepChatYour AI Partner on Desktop
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
WindsurfThe new purpose-built IDE to harness magic
Tavily Mcp
Playwright McpPlaywright MCP server
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Serper MCP ServerA Serper MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Amap Maps高德地图官方 MCP Server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
ChatWiseThe second fastest AI chatbot™
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.