当前位置: 首页 > Skill >

Lightning MCP Server

Lightning MCP Server

Lightning MCP Server

构建并配置 Lightning Node Connect (LNC) 的 MCP 服务器;通过加密 WebSocket 隧道和配对短语将 AI 助手连接到 lnd 节点,无需直接网络访问或 TLS 证书。默认只读,提供 18 个工具用于查询节点状态、通道、支付、发票、对等节点和链上数据。

1.0.0 2026.11.27 977
获取Skill文件查看使用说明
作 者:江宁 许可证: 更新时间:2026.11.27
本文目录展开

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
  4. Once connected, the agent can call any of the 18 read-only tools
  5. 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:

Variable Default Description
LNC_MAILBOX_SERVER mailbox.terminal.lightning.today:443 Mailbox relay server
LNC_DEV_MODE false Enable development mode
LNC_INSECURE false Skip TLS verification (dev only)
LNC_CONNECT_TIMEOUT 30 Connection 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

Tool Description
lnc_connect Connect to lnd via LNC pairing phrase
lnc_disconnect Close active LNC connection

Node

Tool Description
lnc_get_info Node alias, version, sync status, block height
lnc_get_balance Wallet balance (on-chain) and channel balance

Channels

Tool Description
lnc_list_channels Active/inactive channels with capacity, balances
lnc_pending_channels Channels being opened or closed

Invoices

Tool Description
lnc_decode_invoice Decode a BOLT11 invoice
lnc_list_invoices List invoices with pagination
lnc_lookup_invoice Look up invoice by payment hash

Payments

Tool Description
lnc_list_payments Payment history with pagination
lnc_track_payment Track specific payment by hash

Peers & Network

Tool Description
lnc_list_peers Connected peers with stats
lnc_describe_graph Lightning Network topology sample
lnc_get_node_info Detailed info about a specific node

On-Chain

Tool Description
lnc_list_unspent UTXOs with confirmations
lnc_get_transactions On-chain transaction history
lnc_estimate_fee Fee 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 Server Direct lncli/gRPC
Credential Pairing phrase (in-memory) TLS cert + macaroon (on disk)
Network WebSocket via mailbox relay Direct TCP to gRPC port
Firewall No inbound ports needed Port 10009 must be reachable
Permissions Read-only (hardcoded) Depends on macaroon scope
Setup Pairing phrase from Lightning Terminal Export 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

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,018
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,013
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,013
Skill 文件
  • SKILL.md
    • MCP LNC Server
    • Quick Start
    • How It Works
    • Installation
    • Configuration
    • Claude Code Integration
      • Option 1: claude mcp add (recommended)
      • Option 2: Setup script (from source)
      • Option 3: Manual configuration
    • Available Tools (18)
      • Connection
      • Node
      • Channels
      • Invoices
      • Payments
      • Peers & Network
      • On-Chain
    • Security Model
      • Comparison with Direct gRPC Access
    • Prerequisites
    • Troubleshooting
      • "pairing phrase must be exactly 10 words"
      • "connection timeout"
      • "TLS handshake failure"
      • Tools not appearing in Claude Code
  • 项目或源文件

相关 Skill

更多
Node Connect Node Connect 诊断 Android、iOS 和 macOS 伴侣应用的 OpenClaw 节点连接与配对故障。适用于手动连接失败、本地Wi‑Fi 正常但 VPS/…的情况。
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手 高中数学作业批改助手 >图片识别 直接读取学生手写作答照片,识别公式、符号、步骤 🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设 📊 逐步给分 每个关键步骤独立评分,体现过程分 📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告 🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Vibration Analysis Vibration Analysis 分析来自CMS趋势、RMS/峰值、频谱及SCADA报警的风机传动链(主轴、齿轮箱、发电机)振动数据。
Traditional Bone Tool Making Basics Traditional Bone Tool Making Basics Use when you need custom, durable, repairable tools like awls, needles, scrapers, harpoons, or fishing hooks made from local animal bones or antlers and comm...