LND MCP Server
闪电网络 MCP 服务器
闪电网络 MCP 服务器允许大型语言模型 (LLM) 代理(例如在Goose中运行的代理)使用自然语言查询闪电节点数据。它实现了模型上下文协议 (MCP)规范版本2025-03-26 ,并与 MCP Inspector 1.7.0 完全兼容。
该服务器使用 gRPC 或 Lightning Node Connect (LNC) 连接到您的节点,并返回可读摘要和机器可读的 JSON 输出。它采用模块化、可测试和可扩展的设计,以支持 Core Lightning 和 Eclair 等其他节点类型。
有关架构的详细信息,请参阅ARCHITECTURE.md 。
它的作用
该系统能够解析自然语言提示、确定用户意图、评估域逻辑并查询您的闪电节点。响应以纯语言和结构化 JSON 格式返回。它目前支持基本的通道查询,并正在积极发展以涵盖更广泛的节点状态、发票和路由数据。
Related MCP server: MCP Snapshot Server
示例查询
用自然语言询问:
Show me my channels获得人类可读的响应:
Your node has 5 channels with a total capacity of 0.05000000 BTC (5,000,000 sats).
4 channels are active and 1 is inactive.
Your channels:
1. ACINQ: 0.02000000 BTC (2,000,000 sats) (active)
2. Bitrefill: 0.01000000 BTC (1,000,000 sats) (active)
3. LightningTipBot: 0.00800000 BTC (800,000 sats) (active)
4. Wallet of Satoshi: 0.00700000 BTC (700,000 sats) (active)
5. LN+: 0.00500000 BTC (500,000 sats) (inactive)以及用于应用程序的结构化 JSON 数据:
{
"channels": [
{
"remote_alias": "ACINQ",
"capacity": 2000000,
"local_balance": 800000,
"active": true
},
...
],
"summary": {
"total_capacity": 5000000,
"active_channels": 4,
"inactive_channels": 1,
"largest_channel_alias": "ACINQ",
"average_local_balance": 750000
}
}JSON 输出提供了相同数据的结构化版本,并针对 LLM 代理、UI 层或下游应用程序的使用进行了优化。
支持的功能
目前系统支持基本频道查询:
“显示我的频道”
以下领域正在开发更强大的查询:
频道
“我的渠道健康状况如何?”
“我有哪些不活跃的频道吗?”发票
“这周我收到了多少张发票?”
“我上次付款是多少?”节点
“我最常连接到哪个节点?”
“我上次将付款转发到了哪个节点?”路由
“过去 24 小时内我路由了多少?”
“哪些渠道承担着大部分的路由任务?”
快速入门
这提供了使用真实节点的零配置开发体验。
使用真实节点运行(通过 gRPC 或 LNC 的 LND)
cp .env.example .env
# Configure .env with your LND credentials
npm run mcp:prod通过 Tor 连接到 LND 节点
要连接到作为 Tor 隐藏服务运行的 LND 节点:
确保 Tor 已安装并正在您的系统上运行:
# macOS (using Homebrew) brew install tor brew services start tor # Ubuntu/Debian sudo apt install tor sudo systemctl start tor使用 Tor SOCKS 代理设置配置您的
.env文件:CONNECTION_TYPE=lnd-direct LND_HOST=your-node-address.onion LND_PORT=10009 LND_TLS_CERT_PATH=/path/to/tls.pem # Use PEM format for better compatibility LND_MACAROON_PATH=/path/to/admin.macaroon SOCKS_PROXY_HOST=localhost SOCKS_PROXY_PORT=9050确保您的 TLS 证书为 PEM 格式(以
-----BEGIN CERTIFICATE-----开头)。如果您拥有原始证书,可以使用 extract-credentials.js 脚本进行转换。
使用凭证提取工具
如果您有 lndconnect URL(常用于移动应用程序),则可以使用以下方法提取凭据:
# Extract credentials from an lndconnect URL
node scripts/extract-credentials.js "lndconnect://your-node.onion:10009?cert=BASE64CERT&macaroon=BASE64MACAROON"
# Or set LNDCONNECT_URL in your .env file and run
node scripts/extract-credentials.js该脚本将:
提取主机、端口、证书和 macaroon
将证书转换为 PEM 格式(正确连接所需)
将文件保存到 test/fixtures 目录
打印要添加到 .env 文件的配置
使用 MCP Inspector 进行测试
要使用官方 MCP 检查器测试服务器:
npm install -g @modelcontextprotocol/inspector
npm run build
LOG_LEVEL=warn npx @modelcontextprotocol/inspector node scripts/inspect.js兼容性
MCP 规范版本
2025-03-26MCP 检查器版本
1.7.0MCP 剂兼容性(例如 Goose)
gRPC 支持直接节点访问
LNC 支持安全远程访问
JSON 和自然语言输出格式
贡献
请参阅CONTRIBUTING.md了解设置、样式和测试指导。
执照
Apache 许可证 2.0。请参阅许可证。
Related MCP Connectors
Connect AI agents to Replynodes over the Model Context Protocol.
Pay-per-call LLM chat plus data tools: DNS, crypto, Base gas, Wikipedia. x402 USDC or Lightning.
Pay-per-action access to APIs and MCP tools over Lightning L402 and Base USDC x402.
17-model LLM gateway + 350+ data/KYB/sanctions tools. Pay-per-call USDC via x402, no API key.
Related MCP Servers
- AlicenseAqualityBmaintenanceThis server allows users to interact with their Zotero library through the Model Context Protocol, providing tools for searching items, retrieving metadata, and accessing full text using natural language queries.3954 PyPI161MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables interaction with Snapshot.org, providing tools to query Snapshot spaces, proposals, and users through natural language.511 npmMIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that connects to the Tesla Fleet API, allowing AI assistants like Claude to control Tesla vehicles and access vehicle information through natural language commands.19MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI agents to query Erick Wendel's talks, blog posts, and videos across different platforms using natural language.422 npm374MIT