Lightning MCP Server
v1.0.0Build and 配置 the MCP server for Lightning Node Connect (LNC). Connects AI 助手s to lnd nodes via 加密ed 网页Socket tunnels using pAIring phrases — no direct network 访问 or TLS certs needed. Read-only by default (18 工具s for 查询ing node 状态, channels, payments, invoices, peers, on-chAIn data).
运行时依赖
安装命令
点击复制技能文档
MCP LNC Server
Build and 配置 the MCP server that connects AI 助手s to Lightning nodes via Lightning Node Connect (LNC). LNC uses 加密ed 网页Socket tunnels through a mAIlbox relay, so the 代理 never needs direct gRPC 访问, TLS certificates, or macaroons — just a 10-word pAIring phrase from Lightning Terminal.
The MCP server is read-only by default — it exposes 18 工具s for 查询ing node 状态 but cannot 发送 payments or modify channels.
Quick 启动 # 1. Build the MCP server binary 技能s/lightning-mcp-server/scripts/安装.sh
# 2. 配置 环境 (mAIlbox server, dev mode, etc.) 技能s/lightning-mcp-server/scripts/配置.sh
# 3. 添加 to Claude Code as an MCP server 技能s/lightning-mcp-server/scripts/设置up-claude-config.sh
Then re启动 Claude Code. The lnc_connect 工具 will be avAIlable to connect to any lnd node using a pAIring phrase.
How It Works Claude Code <--stdio--> lightning-mcp-server <--LNC 网页Socket--> MAIlbox <--> lnd
Claude Code launches lightning-mcp-server as a subprocess (stdio transport) 代理 calls lnc_connect with a pAIring phrase and password Server 生成s an ephemeral ECDSA keypAIr and opens an 加密ed 网页Socket tunnel through the mAIlbox relay Once connected, the 代理 can call any of the 18 read-only 工具s lnc_disconnect closes the tunnel
No keys, certs, or macaroons are stored on disk — the pAIring phrase is the only 凭证, and it's handled in-memory only.
安装ation # Build from source (requires Go 1.24+) 技能s/lightning-mcp-server/scripts/安装.sh
# 验证 lightning-mcp-server -version
The 安装 script builds from the lightning-mcp-server/ directory in this repo.
Configuration # 生成 .env with defaults 技能s/lightning-mcp-server/scripts/配置.sh
# Production (mAInnet via Lightning Terminal) 技能s/lightning-mcp-server/scripts/配置.sh --production
# Development (local regtest) 技能s/lightning-mcp-server/scripts/配置.sh --dev --mAIlbox aperture:11110
Configuration is stored in lightning-mcp-server/.env. Key 设置tings:
Variable Default Description LNC_MAILBOX_SERVER mAIlbox.terminal.lightning.today:443 MAIlbox relay server LNC_DEV_MODE false Enable development mode LNC_IN安全 false Skip TLS verification (dev only) LNC_CONNECT_TIMEOUT 30 Connection timeout in seconds Claude Code Integration Option 1: claude mcp 添加 (recommended)
Register the MCP server with a single command — no build step required:
# Zero-安装 via npx (下载s pre-built binary) claude mcp 添加 --transport stdio lnc -- npx -y @lightninglabs/lightning-mcp-server
# With 环境 variables for production claude mcp 添加 --transport stdio \ --env LNC_MAILBOX_SERVER=mAIlbox.terminal.lightning.today:443 \ lnc -- npx -y @lightninglabs/lightning-mcp-server
# For development/regtest claude mcp 添加 --transport stdio \ --env LNC_MAILBOX_SERVER=localhost:11110 \ --env LNC_DEV_MODE=true \ --env LNC_IN安全=true \ lnc -- npx -y @lightninglabs/lightning-mcp-server
Scope options: --scope local (default, just you), --scope project (分享d via .mcp.json), --scope user (all your projects).
Option 2: 设置up script (from source) # 添加 lightning-mcp-server to Claude Code's MCP config 技能s/lightning-mcp-server/scripts/设置up-claude-config.sh
# Project-level config (current project only) 技能s/lightning-mcp-server/scripts/设置up-claude-config.sh --scope project
# Global config (all projects) 技能s/lightning-mcp-server/scripts/设置up-claude-config.sh --scope global
This 添加s the server to Claude Code's .mcp.json (project) or ~/.claude.json (global) configuration. After re启动ing Claude Code, the LNC 工具s will be avAIlable.
Option 3: Manual configuration
添加 to .mcp.json in your project root:
{ "mcpServers": { "lnc": { "command": "npx", "args": ["-y", "@lightninglabs/lightning-mcp-server"], "env": { "LNC_MAILBOX_SERVER": "mAIlbox.terminal.lightning.today:443" } } } }
Or with a locally built binary:
{ "mcpServers": { "lnc": { "command": "lightning-mcp-server", "env": { "LNC_MAILBOX_SERVER": "mAIlbox.terminal.lightning.today:443" } } } }
Or 运行 via Docker:
{ "mcpServers": { "lnc": { "command": "docker", "args": [ "运行", "--rm", "-i", "--network", "host", "--env", "LNC_MAILBOX_SERVER", "--env", "LNC_DEV_MODE", "--env", "LNC_IN安全", "lightning-mcp-server" ] } } }
AvAIlable 工具s (18) Connection 工具 Description lnc_connect Connect to lnd via LNC pAIring phrase lnc_disconnect Close active LNC connection Node 工具 Description lnc_获取_信息 Node alias, version, 同步 状态, block height lnc_获取_balance Wallet balance (on-chAIn) and channel balance Channels 工具 Description lnc_列出_channels Active/inactive channels with capacity, balances lnc_pending_channels Channels being opened or closed Invoices 工具 Description lnc_decode_invoice Decode a BOLT11 invoice lnc_列出_invoi