MCP Ledger Server

MCP Ledger Server

A comprehensive MCP server for secure Ledger hardware wallet integration with Ethereum blockchain operations, enabling AI agents to safely manage crypto assets, sign transactions, and interact with multiple networks.

Category
Visit Server

README

MCP Ledger Server

A comprehensive Model Context Protocol (MCP) server for secure Ledger hardware wallet integration with Ethereum blockchain operations. Build AI agents that can safely interact with your crypto assets using hardware-level security.

πŸš€ Features

πŸ”’ Hardware Wallet Security

  • βœ… Ledger hardware wallet integration with latest @ledgerhq libraries
  • βœ… Private keys never leave your device - all signing happens on hardware
  • βœ… Transaction confirmation required on device screen
  • βœ… Multi-account support with BIP32 derivation paths

⛓️ Multi-Network Support

  • βœ… 6 Networks: Ethereum, Polygon, Arbitrum, Optimism, Base, Sepolia
  • βœ… Enhanced RPC with Alchemy API integration
  • βœ… Automatic fallback to public endpoints
  • βœ… EIP-1559 transaction support with dynamic gas pricing

πŸͺ™ Complete Asset Management

  • βœ… Real-time ETH balances across all networks
  • βœ… ERC20 token discovery and balances via Dune Sim API
  • βœ… ERC721/ERC1155 NFT tracking and transfers
  • βœ… Token approval management (approve/revoke/modify)
  • βœ… USD pricing and portfolio valuation

πŸ€– AI Agent Ready

  • βœ… 14 MCP tools for complete blockchain operations
  • βœ… One-command convenience functions (send ETH, transfer tokens, etc.)
  • βœ… Transaction crafting with automatic gas estimation
  • βœ… Message signing for Sign-In with Ethereum (SIWE)
  • βœ… Real-time gas analysis and optimization

πŸ“‹ Available Tools

πŸ” Wallet & Balance Tools

Tool Description Example Use
get_ledger_address Get Ethereum address from Ledger Get your wallet address
get_balance Get ETH balance for any address Check account balance
get_token_balances Get ERC20 token balances View your token portfolio
get_nft_balances Get NFT collection balances See your NFT holdings

⚑ Transaction Tools

Tool Description Example Use
craft_transaction Create unsigned transactions Prepare complex contract calls
sign_transaction Sign with Ledger device Sign prepared transactions
sign_message Sign messages (SIWE) Authenticate with dApps
broadcast_transaction Send signed tx to network Submit transactions

🎯 Convenience Tools (One-Click Actions)

Tool Description Example Use
send_eth Send ETH (craft→sign→broadcast) Send ETH to friend
send_erc20_token Send tokens (craft→sign→broadcast) Send USDC payment
send_erc721_token Send NFTs (craft→sign→broadcast) Transfer NFT
manage_token_approval Manage approvals (craft→sign→broadcast) Approve DEX spending

πŸ› οΈ Developer Tools

Tool Description Example Use
get_contract_abi Get verified contract ABIs Interact with contracts
analyze_gas Gas price analysis & optimization Optimize transaction costs

πŸš€ Quick Start

1. Install Dependencies

# Clone and install
git clone <repository-url>
cd mcp-ledger
npm install
npm run build

2. Get API Keys

πŸ”‘ Required: Dune Sim API

# Get your free API key at: https://sim.dune.com
# Required for token/NFT discovery across 60+ chains
DUNE_SIM_API_KEY=your_dune_sim_api_key_here

πŸ“Š Optional: Performance APIs

# Alchemy (recommended) - Enhanced RPC performance
# Get key at: https://alchemy.com (2M+ requests/month free)
ALCHEMY_API_KEY=your_alchemy_api_key_here

# Etherscan (optional) - Contract verification  
# Get key at: https://etherscan.io/apis (100k requests/day free)
ETHERSCAN_API_KEY=your_etherscan_api_key_here

3. Configure Environment

# Copy template and add your keys
cp .env.example .env
# Edit .env with your API keys

4. Connect Your Ledger

  1. πŸ”Œ Connect Ledger device via USB
  2. πŸ”“ Unlock device with PIN
  3. πŸ“± Open Ethereum app
  4. βš™οΈ Enable "Blind signing" in Ethereum app settings

5. Test Connection

# Test basic connection
node test-ledger-connection.js

# Test MCP server
npm start
# In another terminal:
node test-server.cjs

πŸ–₯️ Integration with AI Tools

πŸš€ Claude Code (Recommended)

The easiest way to use MCP Ledger with Claude Code:

# Add MCP Ledger server to your current project
claude mcp add ledger --env DUNE_SIM_API_KEY=your_key_here -- node /absolute/path/to/mcp-ledger/dist/index.js

# Or add with all environment variables
claude mcp add ledger \
  --env DUNE_SIM_API_KEY=your_dune_key \
  --env ALCHEMY_API_KEY=your_alchemy_key \
  --env ETHERSCAN_API_KEY=your_etherscan_key \
  -- node /absolute/path/to/mcp-ledger/dist/index.js

# Check server status
claude mcp list
/mcp

# Remove server if needed
claude mcp remove ledger

Configuration Scopes:

  • --scope local - Private to current project (default)
  • --scope project - Shared via .mcp.json (team access)
  • --scope user - Available across all your projects

πŸ–₯️ Claude Desktop (macOS/Windows)

  1. Open Claude Desktop settings
  2. Add to claude_desktop_config.json:
{
  "mcpServers": {
    "mcp-ledger": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-ledger/dist/index.js"],
      "env": {
        "DUNE_SIM_API_KEY": "your_dune_key_here",
        "ALCHEMY_API_KEY": "your_alchemy_key_here",
        "ETHERSCAN_API_KEY": "your_etherscan_key_here"
      }
    }
  }
}

βœ… Verify Integration

After setup, verify the server is working:

# In Claude Code
/mcp

# Should show:
βœ… ledger: Connected (22 tools available)
  - 14 Ethereum tools + 8 Solana tools
  - Networks: mainnet, polygon, arbitrum, optimism, base, sepolia, solana-mainnet, solana-devnet, solana-testnet

Available Tools:

  • get_ledger_address, get_balance, get_token_balances, get_nft_balances, craft_transaction, get_contract_abi, sign_transaction, sign_message, broadcast_transaction, send_eth, send_erc20_token, send_erc721_token, manage_token_approval, analyze_gas

Cursor IDE

  1. Open Cursor Settings β†’ Extensions β†’ MCP
  2. Add server configuration:
{
  "name": "mcp-ledger", 
  "command": "node",
  "args": ["/path/to/mcp-ledger/dist/index.js"],
  "env": {
    "DUNE_SIM_API_KEY": "your_key_here"
  }
}

VS Code with MCP Extension

  1. Install MCP extension
  2. Add to MCP settings:
{
  "mcp.servers": {
    "ledger": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-ledger/dist/index.js"],
      "env": {
        "DUNE_SIM_API_KEY": "your_key_here"
      }
    }
  }
}

Other MCP-Compatible Tools

Use this general configuration pattern:

  • Command: node
  • Args: ["/path/to/mcp-ledger/dist/index.js"]
  • Transport: stdio
  • Environment: Add your API keys

πŸ’‘ Usage Examples

Check Your Portfolio

Show me my ETH balance and top 5 token holdings on mainnet

Send Payments

Send 0.1 ETH to 0x742d35Cc6631C0532925a3b8D0c7e89e5a3A5d34 on mainnet

Transfer Tokens

Send 100 USDC to my friend at 0x... on polygon network

Manage Approvals (Ethereum)

Revoke all token approvals for Uniswap router on mainnet

Gas Optimization

Analyze current gas prices on mainnet and recommend optimal settings for an ERC20 transfer

NFT Operations (Ethereum)

Transfer my CryptoPunk #1234 to 0x... and show me the transaction details

πŸ”§ Advanced Configuration

Custom Networks

Add custom RPC endpoints in .env:

# Custom RPC URLs (optional)
MAINNET_RPC_URL=https://your-custom-rpc.com
POLYGON_RPC_URL=https://polygon-custom.com

Development Mode

# Run in development with hot reload
npm run dev

# Run comprehensive tests
npm run test:all

# Test with real hardware (Ledger required)
npm run test:hardware

Performance Tuning

# Adjust cache and timeout settings
REQUEST_TIMEOUT=60000  # 60 second timeout
CACHE_TTL=600         # 10 minute cache

🚫 Without Required APIs

⚠️ Important: Without DUNE_SIM_API_KEY:

  • ❌ Token discovery won't work
  • ❌ NFT discovery won't work
  • βœ… Only basic ETH operations available
  • βœ… Ledger signing still works
  • βœ… Custom transaction crafting works

πŸ”§ Troubleshooting

Common Issues

MCP Server Not Connecting:

# Check if server is properly built
npm run build

# Test server directly
node dist/index.js

# Verify in Claude Code
/mcp
claude mcp list

Ledger Device Issues:

  1. πŸ”Œ Ensure device is connected via USB
  2. πŸ”“ Device is unlocked with PIN
  3. πŸ“± Correct app is open (Ethereum or Solana)
  4. βš™οΈ "Blind signing" enabled in Ethereum app
  5. πŸ“‘ No other applications using the device

Environment Variables:

# Check your environment file
cat .env

# Verify paths are absolute
which node  # Use this path in configurations
pwd         # Current directory for absolute paths

Network Issues:

  • Use Alchemy API key for better reliability
  • Consider QuickNode for production
  • Check firewall settings for outbound connections

πŸ—οΈ Architecture

Core Technologies

  • TypeScript - Full type safety with strict configuration
  • Viem - Modern Ethereum library for blockchain interactions
  • Ledger SDK - Official hardware wallet integration
  • MCP SDK - Model Context Protocol compliance
  • Zod - Runtime schema validation

Service Architecture

  • πŸ”„ ServiceOrchestrator - Coordinates all multi-chain operations
  • πŸ” LedgerService - Hardware wallet communication (Ethereum + Solana)
  • ⛓️ BlockchainService - Ethereum multi-network RPC management
  • 🌟 SolanaBlockchainService - Solana multi-network RPC management
  • πŸ—οΈ TransactionCrafter - Smart Ethereum transaction building
  • 🌟 SolanaTransactionCrafter - Smart Solana transaction building
  • πŸ” BlockscoutClient - Contract verification and ABIs (Ethereum)

Security Model

πŸ”’ Hardware Security:

  • βœ… Private keys never leave Ledger device
  • βœ… All transactions require physical confirmation on device screen
  • βœ… BIP32 hierarchical deterministic key derivation
  • βœ… Comprehensive input validation and sanitization

πŸ›‘οΈ Software Security:

  • βœ… Zod schema validation for all inputs
  • βœ… Multi-layer error handling
  • βœ… Process isolation via stdio transport
  • βœ… No authentication required for local use

πŸ“Š Network Status Verification

When you start the server, you'll see configuration status:

βœ… Optimal Setup:

βœ… Dune Sim API configured for reliable token discovery
βœ… Enhanced RPC provider configured (Alchemy) 
βœ… Contract verification API configured (Etherscan)
βœ… Ledger device connected successfully

⚠️ Limited Setup:

❌ DUNE_SIM_API_KEY is required for token discovery functionality
⚠️  No enhanced RPC provider configured. Using public endpoints.
⚠️  Ledger device not connected (can be connected later)

🀝 Contributing

Built with modern TypeScript practices:

  • πŸ§ͺ Comprehensive test suite (unit, integration, e2e, hardware)
  • πŸ“ ESLint + TypeScript strict mode
  • πŸ”„ Automated CI/CD pipeline
  • πŸ“– Full API documentation

πŸ“„ License

MIT License - see LICENSE file for details.


πŸ”’ Keep Your Crypto Safe: This tool enhances security by keeping your private keys on hardware while enabling powerful AI interactions with your crypto assets.

Built with ❀️ by Dennison Bertram

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured