Skip to main content

LND Node Setup Guide

This guide covers connecting the Lightning Enable MCP server to your own LND (Lightning Network Daemon) node. LND always returns the preimage, making it the most reliable option for L402 authentication.

Why Use Your Own LND Node?​

BenefitDescription
Guaranteed L402LND always returns preimage - L402 never fails due to wallet limitations
You Hold the KeysYou run the node — you control your funds, not a third party
No API LimitsNo provider rate limits or account restrictions
No Third PartyNo provider account sits between you and your funds
Best For

LND is ideal for:

  • Power users who already run Lightning nodes
  • Businesses that need 100% L402 reliability
  • Users who want to run the node and hold the keys themselves
  • Developers testing L402 implementations

Prerequisites​

You Need​

  1. A running LND node with:

    • REST API enabled (default port 8080)
    • Funded channels with outbound liquidity
    • Admin macaroon access
  2. Network access from your MCP server to LND:

    • Same machine: localhost:8080
    • Local network: 192.168.x.x:8080
    • Remote: use a VPN

LND Installation Options​

If you don't have LND yet:

PlatformRecommended Approach
Start9Built-in LND package
UmbrelLightning app from store
RaspiBlitzIncluded by default
VoltageCloud-hosted LND
ManualLND Installation Guide

Step 1: Enable LND REST API​

LND's REST API is enabled by default on port 8080. Verify in your lnd.conf:

[Application Options]
# REST API (enabled by default)
restlisten=0.0.0.0:8080

# TLS settings
tlsextraip=0.0.0.0
tlsextradomain=your-domain.com

If you changed the port, note it for configuration.

Restart LND After Config Changes​

# Stop LND
lncli stop

# Start LND (method depends on your setup)
lnd
# or
systemctl restart lnd

Step 2: Get Your Admin Macaroon​

The macaroon is your authentication credential. You need the admin macaroon for payments.

Location by Platform​

PlatformDefault Path
Linux~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
macOS~/Library/Application Support/Lnd/data/chain/bitcoin/mainnet/admin.macaroon
Windows%LOCALAPPDATA%\Lnd\data\chain\bitcoin\mainnet\admin.macaroon
Start9SSH in, check /embassy-data/package-data/volumes/lnd/
Umbrel~/umbrel/app-data/lightning/data/lnd/data/chain/bitcoin/mainnet/admin.macaroon
DockerInside container at /root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon

Convert Macaroon to Hex​

The MCP server needs the macaroon in hex format (not base64).

Linux/macOS:

xxd -ps -c 1000 ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon

Windows PowerShell:

[System.BitConverter]::ToString([System.IO.File]::ReadAllBytes("$env:LOCALAPPDATA\Lnd\data\chain\bitcoin\mainnet\admin.macaroon")) -replace '-',''

Docker:

docker exec lnd xxd -ps -c 1000 /root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon

The output looks like:

0201036c6e6402f801030a10b3b1a4d3e5f6789012345678901234561201...

Save this string - you'll need it for configuration.


Step 3: Test LND Connection​

Before configuring the MCP server, verify LND is accessible:

# Test from the machine running MCP
curl --insecure \
-H "Grpc-Metadata-macaroon: YOUR_MACAROON_HEX" \
https://localhost:8080/v1/getinfo

You should see JSON output with your node info:

{
"identity_pubkey": "03abc...",
"alias": "MyNode",
"num_active_channels": 5,
...
}

Common Test Issues​

ErrorSolution
Connection refusedLND not running or REST not enabled
certificate unknownUse --insecure for this test; the MCP server needs LND_TLS_CERT_PATH (Step 4)
permission deniedWrong macaroon or insufficient permissions
timeoutFirewall blocking port 8080

Step 4: Configure MCP Server​

The "command": "lightning-enable-mcp" configurations on this page run the .NET global tool. Install it first with dotnet tool install -g LightningEnable.Mcp, which puts the lightning-enable-mcp command on your PATH.

LND serves REST over HTTPS with a self-signed certificate, so the MCP server must be told to trust it, even on localhost. Copy the node's tls.cert (for example ~/.lnd/tls.cert) to the machine running the MCP server and set LND_TLS_CERT_PATH to its path. LND_TLS_CERT_PATH is an environment variable only; there is no config-file key for it.

Option A: Environment Variables​

{
"mcpServers": {
"lightning-enable": {
"command": "lightning-enable-mcp",
"env": {
"LND_REST_HOST": "localhost:8080",
"LND_MACAROON_HEX": "0201036c6e6402f801030a10...",
"LND_TLS_CERT_PATH": "/home/you/.lnd/tls.cert"
}
}
}
}

Option B: Config File​

Add a wallets block to ~/.lightning-enable/config.json (the server creates the file on first run; keep its budget settings), and still set LND_TLS_CERT_PATH in the MCP client's env:

{
"wallets": {
"lndRestHost": "localhost:8080",
"lndMacaroonHex": "0201036c6e6402f801030a10b3b1a4d3e5f6789012345678901234561201...",
"priority": "lnd"
}
}

Environment variables override the config file.

Configuration Options​

VariableConfig KeyDescriptionRequired
LND_REST_HOSTlndRestHostLND REST host and port (https:// is assumed)Yes
LND_MACAROON_HEXlndMacaroonHexMacaroon in hexYes
LND_TLS_CERT_PATH-Path to the node's tls.cert (PEM or DER)For a self-signed certificate
LND_SKIP_TLS_VERIFY-true turns off certificate checks (development only)No
LND_PAYMENT_TIMEOUT_SECONDS-How long a payment may stay in flight before it is reported as pending (default 25)No
LND_FEE_LIMIT_SATS-Fixed routing-fee ceiling per payment (default 5% of the invoice, minimum 2 sats)No
WALLET_PRIORITYprioritySet to lnd when several wallets are configuredOptional

Step 5: Verify Connection​

Restart your MCP client and check the MCP server's stderr output:

[LND] Initialized REST client for localhost:8080
Using LND wallet backend
LND always returns preimage - L402 fully supported

Test with a balance check:

User: Check my Lightning balance

Claude: [Uses get_balance]
Your LND balance: 500,000 sats

Remote LND Access​

Same Local Network​

{
"wallets": {
"lndRestHost": "192.168.1.100:8080"
}
}

Over VPN​

  1. Connect both machines to same VPN
  2. Use VPN IP address:
    {
    "wallets": {
    "lndRestHost": "10.8.0.1:8080"
    }
    }

TLS Certificate Handling​

For remote connections, you may need to handle TLS:

Option 1: Skip TLS verification (development only) Set environment variable:

LND_SKIP_TLS_VERIFY=true

Option 2: Pin the TLS cert (recommended) Copy ~/.lnd/tls.cert to the MCP machine and set:

LND_TLS_CERT_PATH=/path/to/tls.cert

If both are set, the pinned certificate wins.


Available Tools with LND​

ToolDescriptionWorks with LND
pay_invoicePay any Lightning invoice✅ Yes (with preimage)
get_balanceView channel balance (BTC only on LND)✅ Yes
create_invoiceCreate invoice to receive✅ Yes
check_invoice_statusCheck if invoice paid✅ Yes
wallet_ops (action="send_onchain")Send on-chain Bitcoin✅ Yes
access_l402_resourceL402 auto-pay✅ Yes
pay_l402_challengeManual L402 payment✅ Yes

Tools NOT Available with LND​

  • wallet_ops with action="price" - Use Strike for price data
  • wallet_ops with action="exchange" - LND is BTC-only

Troubleshooting​

"Failed to connect to LND"​

Check LND is running:

lncli getinfo

Check REST port is open:

netstat -tlnp | grep 8080

Check firewall:

# Linux
sudo ufw status
# or
sudo iptables -L

# Allow port 8080
sudo ufw allow 8080

"Permission denied" or "Macaroon invalid"​

Verify macaroon is correct:

# Re-export macaroon
xxd -ps -c 1000 ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon

Check macaroon permissions: the MCP server calls routerrpc.Router/SendPaymentV2 (pay), ChannelBalance (balance), AddInvoice and LookupInvoice (invoices), and SendCoins (on-chain sends). A custom macaroon must allow each one you use; see Limit Macaroon Scope.

"No route found" / "FAILURE_REASON_NO_ROUTE"​

Your node can't find a path to the destination:

  1. Check outbound liquidity:

    lncli listchannels | jq '.channels[] | {alias: .peer_alias, local: .local_balance, remote: .remote_balance}'
  2. Open new channels to well-connected nodes

  3. Wait for channel confirmation if recently opened

"Invoice expired"​

The L402 invoice expired before payment completed. This can happen with:

  • Slow network connections
  • Large payments requiring route finding

Try again - the API will issue a fresh invoice.

"TLS handshake failed"​

For self-signed certs (development):

{
"env": {
"LND_SKIP_TLS_VERIFY": "true"
}
}

For production: Copy your tls.cert to the MCP server machine and set LND_TLS_CERT_PATH to its path.


Security Best Practices​

1. Use a Dedicated Node or Small Channels​

The macaroon can spend whatever the node can route. Fund the node (or the channels the agent uses) with only what you are willing to let the agent spend.

2. Limit Macaroon Scope​

Instead of the admin macaroon, bake one that can only pay and read balances:

lncli bakemacaroon --save_to=./payment.macaroon \
uri:/routerrpc.Router/SendPaymentV2 \
uri:/lnrpc.Lightning/ChannelBalance

Add uri:/lnrpc.Lightning/AddInvoice uri:/lnrpc.Lightning/LookupInvoice if the agent should create and check invoices, and uri:/lnrpc.Lightning/SendCoins for on-chain sends. Convert it to hex the same way as the admin macaroon.

3. Use a VPN for Remote Access​

Never expose the LND REST API directly to the internet. Reach a remote node over a VPN.

4. Set Payment Limits in Config​

The MCP config file provides additional spending controls:

{
"limits": {
"maxPerPayment": 100.00,
"maxPerSession": 50.00
}
}

Performance Tips​

Channel Management​

For best L402 performance:

  • Maintain 5+ active channels
  • Keep channels balanced (50% local / 50% remote)
  • Open channels to well-connected LSPs (Lightning Service Providers)

Monitoring​

Use lncli to monitor your node:

# Check pending payments
lncli listpayments --max_payments 10

# Check channel health
lncli listchannels --active_only

# Check forwards (routing)
lncli fwdinghistory

Frequently Asked Questions​

Can I use LND on a Raspberry Pi?​

Yes, but ensure adequate resources:

  • 4GB+ RAM
  • SSD storage (not SD card)
  • Stable internet connection

Does this work with Core Lightning (CLN)?​

Not yet. LND is currently the only supported node implementation. CLN support may be added in the future.

Can I use a hosted LND (Voltage, etc.)?​

Yes! Voltage and similar services provide the REST API and macaroon. Configure as remote connection.

What if my node is offline?​

Payments will fail. Ensure your node has reliable uptime for production use.

Is my macaroon safe in the config file?​

The config file is stored locally on your machine. Keep it protected like any credential file:

  • Don't commit to git
  • Use file permissions (chmod 600)
  • Consider encrypted storage

Next Steps​