← 返回
开发者工具 中文

Lightning MCP Server

Build and configure the MCP server for Lightning Node Connect (LNC). Connects AI assistants to lnd nodes via encrypted WebSocket tunnels using pairing phrases — no direct network access or TLS certs needed. Read-only by default (18 tools for querying node state, channels, payments, invoices, peers, on-chain data).
构建并配置 Lightning Node Connect (LNC) 的 MCP 服务器;通过加密 WebSocket 隧道和配对短语将 AI 助手连接到 lnd 节点,无需直接网络访问或 TLS 证书。默认只读,提供 18 个工具用于查询节点状态、通道、支付、发票、对等节点和链上数据。
roasbeef
开发者工具 clawhub v1.0.0 1 版本 99798.9 Key: 无需
★ 0
Stars
📥 1,489
下载
💾 12
安装
1
版本
#latest

概述

MCP LNC Server

Build and configure the MCP server that connects AI assistants to Lightning

nodes via Lightning Node Connect (LNC). LNC uses encrypted WebSocket tunnels

through a mailbox relay, so the agent never needs direct gRPC access, TLS

certificates, or macaroons — just a 10-word pairing phrase from Lightning

Terminal.

The MCP server is read-only by default — it exposes 18 tools for querying

node state but cannot send payments or modify channels.

Quick Start

# 1. Build the MCP server binary
skills/lightning-mcp-server/scripts/install.sh

# 2. Configure environment (mailbox server, dev mode, etc.)
skills/lightning-mcp-server/scripts/configure.sh

# 3. Add to Claude Code as an MCP server
skills/lightning-mcp-server/scripts/setup-claude-config.sh

Then restart Claude Code. The lnc_connect tool will be available to connect

to any lnd node using a pairing phrase.

How It Works

Claude Code  <--stdio-->  lightning-mcp-server  <--LNC WebSocket-->  Mailbox  <-->  lnd
  1. Claude Code launches lightning-mcp-server as a subprocess (stdio transport)
  2. Agent calls lnc_connect with a pairing phrase and password
  3. Server generates an ephemeral ECDSA keypair and opens an encrypted WebSocket

tunnel through the mailbox relay

  1. Once connected, the agent can call any of the 18 read-only tools
  2. lnc_disconnect closes the tunnel

No keys, certs, or macaroons are stored on disk — the pairing phrase is the

only credential, and it's handled in-memory only.

Installation

# Build from source (requires Go 1.24+)
skills/lightning-mcp-server/scripts/install.sh

# Verify
lightning-mcp-server -version

The install script builds from the lightning-mcp-server/ directory in this repo.

Configuration

# Generate .env with defaults
skills/lightning-mcp-server/scripts/configure.sh

# Production (mainnet via Lightning Terminal)
skills/lightning-mcp-server/scripts/configure.sh --production

# Development (local regtest)
skills/lightning-mcp-server/scripts/configure.sh --dev --mailbox aperture:11110

Configuration is stored in lightning-mcp-server/.env. Key settings:

VariableDefaultDescription
--------------------------------
LNC_MAILBOX_SERVERmailbox.terminal.lightning.today:443Mailbox relay server
LNC_DEV_MODEfalseEnable development mode
LNC_INSECUREfalseSkip TLS verification (dev only)
LNC_CONNECT_TIMEOUT30Connection timeout in seconds

Claude Code Integration

Option 1: claude mcp add (recommended)

Register the MCP server with a single command — no build step required:

# Zero-install via npx (downloads pre-built binary)
claude mcp add --transport stdio lnc -- npx -y @lightninglabs/lightning-mcp-server

# With environment variables for production
claude mcp add --transport stdio \
  --env LNC_MAILBOX_SERVER=mailbox.terminal.lightning.today:443 \
  lnc -- npx -y @lightninglabs/lightning-mcp-server

# For development/regtest
claude mcp add --transport stdio \
  --env LNC_MAILBOX_SERVER=localhost:11110 \
  --env LNC_DEV_MODE=true \
  --env LNC_INSECURE=true \
  lnc -- npx -y @lightninglabs/lightning-mcp-server

Scope options: --scope local (default, just you), --scope project (shared

via .mcp.json), --scope user (all your projects).

Option 2: Setup script (from source)

# Add lightning-mcp-server to Claude Code's MCP config
skills/lightning-mcp-server/scripts/setup-claude-config.sh

# Project-level config (current project only)
skills/lightning-mcp-server/scripts/setup-claude-config.sh --scope project

# Global config (all projects)
skills/lightning-mcp-server/scripts/setup-claude-config.sh --scope global

This adds the server to Claude Code's .mcp.json (project) or

~/.claude.json (global) configuration. After restarting Claude Code, the

LNC tools will be available.

Option 3: Manual configuration

Add 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 run via Docker:

{
  "mcpServers": {
    "lnc": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i", "--network", "host",
        "--env", "LNC_MAILBOX_SERVER",
        "--env", "LNC_DEV_MODE",
        "--env", "LNC_INSECURE",
        "lightning-mcp-server"
      ]
    }
  }
}

Available Tools (18)

Connection

ToolDescription
-------------------
lnc_connectConnect to lnd via LNC pairing phrase
lnc_disconnectClose active LNC connection

Node

ToolDescription
-------------------
lnc_get_infoNode alias, version, sync status, block height
lnc_get_balanceWallet balance (on-chain) and channel balance

Channels

ToolDescription
-------------------
lnc_list_channelsActive/inactive channels with capacity, balances
lnc_pending_channelsChannels being opened or closed

Invoices

ToolDescription
-------------------
lnc_decode_invoiceDecode a BOLT11 invoice
lnc_list_invoicesList invoices with pagination
lnc_lookup_invoiceLook up invoice by payment hash

Payments

ToolDescription
-------------------
lnc_list_paymentsPayment history with pagination
lnc_track_paymentTrack specific payment by hash

Peers & Network

ToolDescription
-------------------
lnc_list_peersConnected peers with stats
lnc_describe_graphLightning Network topology sample
lnc_get_node_infoDetailed info about a specific node

On-Chain

ToolDescription
-------------------
lnc_list_unspentUTXOs with confirmations
lnc_get_transactionsOn-chain transaction history
lnc_estimate_feeFee estimates for confirmation targets

Security Model

  • No stored credentials: Pairing phrase is handled in-memory only. Ephemeral

ECDSA keypairs are generated per session.

  • Read-only: No payment, channel, or state-changing operations are exposed.

The agent can observe but not modify.

  • Encrypted tunnels: All traffic is encrypted end-to-end through the mailbox

relay. The mailbox cannot read the traffic.

  • No direct access: The agent machine never connects directly to the lnd

node's gRPC port — all traffic goes through the mailbox.

Comparison with Direct gRPC Access

MCP LNC ServerDirect lncli/gRPC
---------
CredentialPairing phrase (in-memory)TLS cert + macaroon (on disk)
NetworkWebSocket via mailbox relayDirect TCP to gRPC port
FirewallNo inbound ports neededPort 10009 must be reachable
PermissionsRead-only (hardcoded)Depends on macaroon scope
SetupPairing phrase from Lightning TerminalExport cert + macaroon files

Prerequisites

  • Go 1.24+ for building from source
  • Lightning Terminal (litd) on the target node for generating pairing phrases
  • Claude Code for MCP integration

Troubleshooting

"pairing phrase must be exactly 10 words"

The pairing phrase is generated by Lightning Terminal. It must be exactly 10

space-separated words.

"connection timeout"

Check that the mailbox server is reachable. For production, ensure

mailbox.terminal.lightning.today:443 is not blocked by a firewall.

"TLS handshake failure"

If using a local regtest setup, enable dev mode and insecure mode:

skills/lightning-mcp-server/scripts/configure.sh --dev --insecure

Tools not appearing in Claude Code

Restart Claude Code after running setup-claude-config.sh. Check that

lightning-mcp-server is on your $PATH:

which lightning-mcp-server

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-28 23:56 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,188
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 324,172
data-analysis

Lnd

roasbeef
安装并运行 Lightning Terminal (litd),该终端将 lnd、loop、pool、tapd 和 faraday 集成在单个 Docker 容器中。默认使用 neutrino 后端,在测试网上采用 SQLite 存储。支持
★ 0 📥 1,631