Linea MCP Server

Linea MCP Server

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

qvkare

Research & Data
Visit Server

README

Linea MCP Server

<div align="center"> <img src="assets/logo.png" alt="Linea MCP Logo"> </div>

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 and Cursor to perform blockchain operations through natural language requests.

Key Features

  • Wallet Management: Retrieve addresses and check balances
  • Token Operations: Transfer ERC20 tokens and check balances
  • Smart Contract Interactions: Deploy and interact with contracts
  • NFT Management: List and transfer NFTs
  • Bridge Operations: Bridge assets between Ethereum and Linea
  • DeFi Integrations: Interact with DeFi protocols on Linea
  • Proof of Humanity: Verify and manage PoH registrations
  • Linea ENS: Resolve and manage Linea ENS names

Real-World Use Cases

1. Decentralized Finance Management

Imagine you're a busy professional managing your DeFi investments:

Morning: "Check my liquidity pool earnings from overnight"
Lunch: "Swap half of my USDC earnings to ETH"
Evening: "Bridge my ETH earnings to Ethereum mainnet"

2. NFT Artist and Collector

As an NFT creator or collector managing your digital art:

- Mint new NFT collections
- Track royalty payments
- Transfer artworks to buyers
- Check collection statistics

3. Identity Verification (PoH)

Using Proof of Humanity for various applications:

- Verify identity for DeFi protocols
- Participate in Universal Basic Income
- Vouch for other community members
- Maintain verified status

See examples.md for more detailed use cases and examples.

Quick Examples

Here are some common usage examples. For more detailed examples, see examples.md.

Wallet Operations

User: "What's my wallet address?"
Result: 0x742d35Cc6634C0532925a3b844Bc454e4438f44e

User: "Show me my wallet balances"
Result:
- ETH: 1.5 ETH
- USDC: 100 USDC

Bridge Operations

User: "Bridge 1 ETH from Ethereum to Linea"
Steps:
1. Initiating bridge transaction
2. Confirming on Ethereum
3. Waiting for confirmation on Linea

Proof of Humanity

User: "Verify my PoH registration status"
Result: Verified since 2024-03-15

Linea ENS

User: "Resolve name.linea.eth"
Result: 0x742d35Cc6634C0532925a3b844Bc454e4438f44e

User: "Lookup ENS for 0x8dF3e4806A3320D2642b1F2835ADDA1A40719c4E"
Result: qvkare.linea.eth

User: "Check if randomname.linea is available"
Result: Available - This name can be registered

User: "Get email and twitter records for qvkare.linea.eth"
Result: 
- Email: Not set
- Twitter: Not set

For more examples and detailed usage instructions, please refer to our examples.md file.

For detailed ENS integration examples, see docs/ens-usage.md.

Current Status

The project is currently in development with the following components implemented:

  • ✅ Core MCP server infrastructure
  • ✅ Wallet management tools
  • ✅ Token operations
  • ✅ Contract interactions
  • ✅ NFT management
  • ✅ Bridge operations
  • ✅ DeFi integrations
  • ✅ PoH verification system
  • ✅ Linea ENS integration

All tools are successfully discovered by the MCP server, but there may be compatibility issues with some MCP clients.

Getting Started

Prerequisites

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

Installation

Option 1: Install as a global package (recommended for most users)

# Install globally
npm install -g linea-mcp

# Create a .env file in your current directory
cat > .env << EOL
# Network Configuration
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
WALLET_PRIVATE_KEY=your_private_key_here_or_mnemonic
PORT=3000
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
EOL

# Start the MCP server
linea-mcp

Option 2: Install from source (for development)

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

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env
# Edit .env with your configuration

# Build the project
npm run build

# Start the MCP server
npm start

Integration with MCP Clients

Cursor

To integrate with Cursor:

  1. Create or edit the Cursor MCP configuration file:

    • Windows: %APPDATA%\Cursor\mcp.json
    • macOS: ~/Library/Application Support/Cursor/mcp.json
    • Linux: ~/.config/Cursor/mcp.json
  2. Add the following configuration:

{
  "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",
        "WALLET_PRIVATE_KEY": "your_private_key_here_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"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Replace the API keys and encryption key with your own values.

Claude Desktop

Claude Desktop integration is similar to Cursor integration:

  1. Create or edit the Claude Desktop configuration file:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  2. Add a similar configuration as shown for Cursor.

Available Tools

The following tools are available:

Wallet Tools

  • wallet_getAddress: Retrieve a wallet address
  • wallet_listBalances: List balances for a wallet
  • wallet_transferFunds: Transfer funds to another address

Token Tools

  • tokens_erc20Balance: Check the balance of an ERC20 token
  • tokens_erc20Transfer: Transfer ERC20 tokens

Contract Tools

  • contracts_callContract: Call a contract function
  • contracts_deployContract: Deploy a smart contract

NFT Tools

  • nft_listNfts: List NFTs owned by an address
  • nft_transferNft: Transfer an NFT

Bridge Tools

  • bridge_bridgeAssets: Bridge assets between Ethereum and Linea
  • bridge_bridgeStatus: Check bridge transaction status

DeFi Tools

  • defi_liquidityPools: Get liquidity pool information
  • defi_swapTokens: Swap tokens on DEXes

PoH Tools

  • poh_verifyRegistration: Verify a PoH registration status
  • poh_checkVouching: Check vouching status and history
  • poh_listRegistrations: List all PoH registrations for an address
  • poh_getVouchingPeriod: Get current vouching period information

ENS Tools

  • ens_resolveName: Resolve an ENS name to an address
  • ens_lookupAddress: Lookup ENS name for an address
  • ens_checkNameAvailability: Check if an ENS name is available
  • ens_getRecords: Get ENS records (email, website, social media, etc.)

Troubleshooting

Common Issues

  1. "No tools available" in Cursor:

    • Ensure your MCP configuration file is correctly formatted
    • Check that Node.js is installed and accessible from the path
    • Verify the full path to your project is correct
    • Use the full path to Node.js executable in the configuration
  2. "Client closed" error:

    • Check the MCP server logs for errors
    • Ensure your environment variables are correctly set
    • Try restarting Cursor
    • Check if there are syntax errors in your configuration JSON
  3. Connection issues:

    • Verify RPC endpoints are accessible
    • Check firewall settings

Security Considerations

  • This project handles sensitive blockchain operations
  • Never share your private keys or seed phrases
  • Use environment variables for sensitive configuration
  • Always verify transactions before submitting
  • Test extensively with testnet before using on mainnet

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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

Recommended Servers

Crypto Price & Market Analysis MCP Server

Crypto Price & Market Analysis MCP Server

A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.

Featured
TypeScript
MCP PubMed Search

MCP PubMed Search

Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.

Featured
Python
dbt Semantic Layer MCP Server

dbt Semantic Layer MCP Server

A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.

Featured
TypeScript
mixpanel

mixpanel

Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.

Featured
TypeScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python
Nefino MCP Server

Nefino MCP Server

Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.

Official
Python
Vectorize

Vectorize

Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.

Official
JavaScript
Mathematica Documentation MCP server

Mathematica Documentation MCP server

A server that provides access to Mathematica documentation through FastMCP, enabling users to retrieve function documentation and list package symbols from Wolfram Mathematica.

Local
Python
kb-mcp-server

kb-mcp-server

An MCP server aimed to be portable, local, easy and convenient to support semantic/graph based retrieval of txtai "all in one" embeddings database. Any txtai embeddings db in tar.gz form can be loaded

Local
Python
Research MCP Server

Research MCP Server

The server functions as an MCP server to interact with Notion for retrieving and creating survey data, integrating with the Claude Desktop Client for conducting and reviewing surveys.

Local
Python