A Model Context Protocol (MCP) server that provides on-chain tools for AI applications to interact with the Linea blockchain.
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.
- 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
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"
As an NFT creator or collector managing your digital art:
- Mint new NFT collections
- Track royalty payments
- Transfer artworks to buyers
- Check collection statistics
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.
Here are some common usage examples. For more detailed examples, see examples.md.
User: "What's my wallet address?"
Result: 0x742d35Cc6634C0532925a3b844Bc454e4438f44e
User: "Show me my wallet balances"
Result:
- ETH: 1.5 ETH
- USDC: 100 USDC
User: "Bridge 1 ETH from Ethereum to Linea"
Steps:
1. Initiating bridge transaction
2. Confirming on Ethereum
3. Waiting for confirmation on Linea
User: "Verify my PoH registration status"
Result: Verified since 2024-03-15
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.
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.
- Node.js (v16+)
- npm or yarn
- Access to Linea RPC endpoints
# 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
# 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
To integrate with Cursor:
-
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
- Windows:
-
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 integration is similar to Cursor integration:
-
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
- Windows:
-
Add a similar configuration as shown for Cursor.
The following tools are available:
wallet_getAddress
: Retrieve a wallet addresswallet_listBalances
: List balances for a walletwallet_transferFunds
: Transfer funds to another address
tokens_erc20Balance
: Check the balance of an ERC20 tokentokens_erc20Transfer
: Transfer ERC20 tokens
contracts_callContract
: Call a contract functioncontracts_deployContract
: Deploy a smart contract
nft_listNfts
: List NFTs owned by an addressnft_transferNft
: Transfer an NFT
bridge_bridgeAssets
: Bridge assets between Ethereum and Lineabridge_bridgeStatus
: Check bridge transaction status
defi_liquidityPools
: Get liquidity pool informationdefi_swapTokens
: Swap tokens on DEXes
poh_verifyRegistration
: Verify a PoH registration statuspoh_checkVouching
: Check vouching status and historypoh_listRegistrations
: List all PoH registrations for an addresspoh_getVouchingPeriod
: Get current vouching period information
ens_resolveName
: Resolve an ENS name to an addressens_lookupAddress
: Lookup ENS name for an addressens_checkNameAvailability
: Check if an ENS name is availableens_getRecords
: Get ENS records (email, website, social media, etc.)
-
"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
-
"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
-
Connection issues:
- Verify RPC endpoints are accessible
- Check firewall settings
- 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
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.