$npx -y skills add lightninglabs/lightning-agent-tools --skill lightning-mcp-serverBuild 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, payment
| 1 | # MCP LNC Server |
| 2 | |
| 3 | Build and configure the MCP server that connects AI assistants to Lightning |
| 4 | nodes via **Lightning Node Connect (LNC)**. LNC uses encrypted WebSocket tunnels |
| 5 | through a mailbox relay, so the agent never needs direct gRPC access, TLS |
| 6 | certificates, or macaroons — just a 10-word pairing phrase from Lightning |
| 7 | Terminal. |
| 8 | |
| 9 | The MCP server is **read-only by default** — it exposes 18 tools for querying |
| 10 | node state but cannot send payments or modify channels. |
| 11 | |
| 12 | ## Quick Start |
| 13 | |
| 14 | ```bash |
| 15 | # 1. Build the MCP server binary |
| 16 | skills/lightning-mcp-server/scripts/install.sh |
| 17 | |
| 18 | # 2. Configure environment (mailbox server, dev mode, etc.) |
| 19 | skills/lightning-mcp-server/scripts/configure.sh |
| 20 | |
| 21 | # 3. Add to Claude Code as an MCP server |
| 22 | skills/lightning-mcp-server/scripts/setup-claude-config.sh |
| 23 | ``` |
| 24 | |
| 25 | Then restart Claude Code. The `lnc_connect` tool will be available to connect |
| 26 | to any lnd node using a pairing phrase. |
| 27 | |
| 28 | ## How It Works |
| 29 | |
| 30 | ``` |
| 31 | Claude Code <--stdio--> lightning-mcp-server <--LNC WebSocket--> Mailbox <--> lnd |
| 32 | ``` |
| 33 | |
| 34 | 1. Claude Code launches `lightning-mcp-server` as a subprocess (stdio transport) |
| 35 | 2. Agent calls `lnc_connect` with a pairing phrase and password |
| 36 | 3. Server generates an ephemeral ECDSA keypair and opens an encrypted WebSocket |
| 37 | tunnel through the mailbox relay |
| 38 | 4. Once connected, the agent can call any of the 18 read-only tools |
| 39 | 5. `lnc_disconnect` closes the tunnel |
| 40 | |
| 41 | No keys, certs, or macaroons are stored on disk — the pairing phrase is the |
| 42 | only credential, and it's handled in-memory only. |
| 43 | |
| 44 | ## Installation |
| 45 | |
| 46 | ```bash |
| 47 | # Build from source (requires Go 1.24+) |
| 48 | skills/lightning-mcp-server/scripts/install.sh |
| 49 | |
| 50 | # Verify |
| 51 | lightning-mcp-server -version |
| 52 | ``` |
| 53 | |
| 54 | The install script builds from the `lightning-mcp-server/` directory in this repo. |
| 55 | |
| 56 | ## Configuration |
| 57 | |
| 58 | ```bash |
| 59 | # Generate .env with defaults |
| 60 | skills/lightning-mcp-server/scripts/configure.sh |
| 61 | |
| 62 | # Production (mainnet via Lightning Terminal) |
| 63 | skills/lightning-mcp-server/scripts/configure.sh --production |
| 64 | |
| 65 | # Development (local regtest) |
| 66 | skills/lightning-mcp-server/scripts/configure.sh --dev --mailbox aperture:11110 |
| 67 | ``` |
| 68 | |
| 69 | Configuration is stored in `lightning-mcp-server/.env`. Key settings: |
| 70 | |
| 71 | | Variable | Default | Description | |
| 72 | |----------|---------|-------------| |
| 73 | | `LNC_MAILBOX_SERVER` | `mailbox.terminal.lightning.today:443` | Mailbox relay server | |
| 74 | | `LNC_DEV_MODE` | `false` | Enable development mode | |
| 75 | | `LNC_INSECURE` | `false` | Skip TLS verification (dev only) | |
| 76 | | `LNC_CONNECT_TIMEOUT` | `30` | Connection timeout in seconds | |
| 77 | |
| 78 | ## Claude Code Integration |
| 79 | |
| 80 | ### Option 1: `claude mcp add` (recommended) |
| 81 | |
| 82 | Register the MCP server with a single command — no build step required: |
| 83 | |
| 84 | ```bash |
| 85 | # Zero-install via npx (downloads pre-built binary) |
| 86 | claude mcp add --transport stdio lnc -- npx -y @lightninglabs/lightning-mcp-server |
| 87 | |
| 88 | # With environment variables for production |
| 89 | claude mcp add --transport stdio \ |
| 90 | --env LNC_MAILBOX_SERVER=mailbox.terminal.lightning.today:443 \ |
| 91 | lnc -- npx -y @lightninglabs/lightning-mcp-server |
| 92 | |
| 93 | # For development/regtest |
| 94 | claude mcp add --transport stdio \ |
| 95 | --env LNC_MAILBOX_SERVER=localhost:11110 \ |
| 96 | --env LNC_DEV_MODE=true \ |
| 97 | --env LNC_INSECURE=true \ |
| 98 | lnc -- npx -y @lightninglabs/lightning-mcp-server |
| 99 | ``` |
| 100 | |
| 101 | Scope options: `--scope local` (default, just you), `--scope project` (shared |
| 102 | via `.mcp.json`), `--scope user` (all your projects). |
| 103 | |
| 104 | ### Option 2: Setup script (from source) |
| 105 | |
| 106 | ```bash |
| 107 | # Add lightning-mcp-server to Claude Code's MCP config |
| 108 | skills/lightning-mcp-server/scripts/setup-claude-config.sh |
| 109 | |
| 110 | # Project-level config (current project only) |
| 111 | skills/lightning-mcp-server/scripts/setup-claude-config.sh --scope project |
| 112 | |
| 113 | # Global config (all projects) |
| 114 | skills/lightning-mcp-server/scripts/setup-claude-config.sh --scope global |
| 115 | ``` |
| 116 | |
| 117 | This adds the server to Claude Code's `.mcp.json` (project) or |
| 118 | `~/.claude.json` (global) configuration. After restarting Claude Code, the |
| 119 | LNC tools will be available. |
| 120 | |
| 121 | ### Option 3: Manual configuration |
| 122 | |
| 123 | Add to `.mcp.json` in your project root: |
| 124 | |
| 125 | ```json |
| 126 | { |
| 127 | "mcpServers": { |
| 128 | "lnc": { |
| 129 | "command": "npx", |
| 130 | "args": ["-y", "@lightninglabs/lightning-mcp-server"], |
| 131 | "env": { |
| 132 | "LNC_MAILBOX_SERVER": "mailbox.terminal.lightning.today:443" |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | ``` |
| 138 | |
| 139 | Or with a locally built binary: |
| 140 | |
| 141 | ```json |
| 142 | { |
| 143 | "mcpServers": { |
| 144 | "lnc": { |
| 145 | "command": "lightning-mcp-server", |
| 146 | "env": { |
| 147 | "LNC_MAILBOX_SERVER": "mailbox.terminal.lightning.today:443" |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | ``` |
| 153 | |
| 154 | Or run via Docker: |
| 155 | |
| 156 | ```json |
| 157 | { |
| 158 | "mcpServers": { |
| 159 | "lnc": { |
| 160 | "command": "docker", |
| 161 | "args": [ |
| 162 | "run", "--rm", "-i", "--network", "host", |
| 163 | "--env", "LNC_MAILBOX_S |