Skip to main content

MCP Wallet Setup

This guide covers all wallet options for the Lightning Enable MCP server. The critical factor for L402 is whether the wallet returns preimage - without it, L402 authentication fails.

L402 Compatibility Matrix​

WalletReturns PreimageL402 WorksCustodyBest For
LND (Your Node)✅ Always✅ YesYou controlPower users, guaranteed L402
NWC (CoinOS)✅ Yes✅ YesCustodialFree, easy, L402 works
NWC (CLINK)✅ Yes✅ YesCustodialNostr users, L402 works
Alby✅ Yes✅ YesYou hold the keysNWC compatible
Strike✅ Yes✅ YesCustodialUSD users, easy setup, L402 works
Primal❌ No❌ NoCustodialDirect payments only
OpenNode❌ No❌ NoCustodialDirect payments only
Why preimage matters

L402 builds its credential from the preimage (proof of payment). With a wallet that doesn't return it, the payment succeeds but API access fails.

The "command": "lightning-enable-mcp" configurations on this page run the .NET global tool. Install it first with dotnet tool install -g LightningEnable.Mcp. For the Python package, use "command": "uvx", "args": ["lightning-enable-mcp"] instead.

Let the agent connect an NWC wallet

With the server already running, ask the agent to call setup_wallet. With no arguments it reports the current wallet and the setup steps; with an NWC connection string it checks the wallet is reachable and saves it to ~/.lightning-enable/config.json.

Option 1: LND (Best for Guaranteed L402)​

Why LND?

  • You run your own Lightning node
  • LND always returns preimage - L402 is guaranteed to work
  • No third-party dependency
  • You run the node — you hold the keys

Requirements:

  • Running LND node (local or remote)
  • REST API enabled
  • Admin macaroon

Configuration:

{
"mcpServers": {
"lightning-enable": {
"command": "lightning-enable-mcp",
"env": {
"LND_REST_HOST": "localhost:8080",
"LND_MACAROON_HEX": "your-admin-macaroon-in-hex"
}
}
}
}

Getting Your Macaroon in Hex:

# Linux/Mac:
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 '-',''

Or use config file (~/.lightning-enable/config.json):

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

LND uses a self-signed TLS certificate, so also set LND_TLS_CERT_PATH to the node's tls.cert. See LND Node Setup for TLS, remote access, and macaroon scope.

Option 2: NWC with CoinOS (Free, Easy)​

Why CoinOS?

  • Completely free
  • Browser-based, no install
  • Returns preimage - L402 works
  • Easy to set up
Python install for NWC

The base pip install lightning-enable-mcp supports NWC on every platform. The old [nwc] extra still installs but adds nothing.

Setup:

  1. Sign up at https://coinos.io
  2. Go to Settings → NWC
  3. Create a new NWC connection
  4. Enable auto-pay for the connection (important for L402!)
  5. Copy the connection string
{
"mcpServers": {
"lightning-enable": {
"command": "lightning-enable-mcp",
"env": {
"NWC_CONNECTION_STRING": "nostr+walletconnect://..."
}
}
}
}
Windows Users

If the connection string contains special characters that don't work in environment variables, use the config file instead:

{
"wallets": {
"nwcConnectionString": "nostr+walletconnect://...",
"priority": "nwc"
}
}

Option 3: NWC with Alby Hub (You Hold the Keys)​

Why Alby Hub?

  • You hold the keys — you control the funds
  • Returns preimage - L402 works
  • Connect to your own node

Setup:

  1. Deploy Alby Hub: https://albyhub.com?ref=magma
  2. Connect to your Lightning node
  3. Create NWC connection
  4. Use same configuration as CoinOS above

Option 4: Strike (Easy Setup, L402 Works)​

Why Strike?

  • Easy API key setup
  • USD and BTC balance management
  • Returns preimage via lightning.preImage - L402 works
  • Built-in currency exchange

Setup:

  1. Create an account at https://strike.me
  2. Get your API key from https://dashboard.strike.me
  3. Fund your Strike account with BTC
{
"mcpServers": {
"lightning-enable": {
"command": "lightning-enable-mcp",
"env": {
"STRIKE_API_KEY": "your-strike-api-key"
}
}
}
}
Strike BTC Balance

Strike payments use your BTC balance by default. Make sure you have BTC funded (not just USD) for Lightning payments.

Strike is the only wallet that supports every wallet_ops action (price, exchange, send_onchain) and multi-currency balances in get_balance.


Wallets That Do NOT Support L402​

OpenNode​

OpenNode is a payment software provider but does not return preimage.

Use for: Direct payments, creating invoices Cannot use for: L402 auto-pay

{
"env": {
"OPENNODE_API_KEY": "your-opennode-api-key",
"OPENNODE_ENVIRONMENT": "production"
}
}

Wallet Priority​

If multiple wallets are configured, they're used in this order (optimized for L402):

  1. LND (if LND_REST_HOST + LND_MACAROON_HEX are set)
  2. NWC (if NWC_CONNECTION_STRING is set)
  3. Strike (if STRIKE_API_KEY is set)
  4. OpenNode (if OPENNODE_API_KEY is set)

Override with WALLET_PRIORITY environment variable or config file:

{
"wallets": {
"priority": "nwc"
}
}

Using Config File for Credentials​

Environment variables can be tricky (especially on Windows with special characters). The config file at ~/.lightning-enable/config.json is often easier:

{
"currency": "USD",
"tiers": {
"autoApprove": 0.10,
"logAndApprove": 1.00,
"formConfirm": 10.00,
"urlConfirm": 100.00
},
"limits": {
"maxPerPayment": 500.00,
"maxPerSession": 100.00
},
"session": {
"requireApprovalForFirstPayment": true,
"cooldownSeconds": 2
},
"wallets": {
"lndRestHost": "localhost:8080",
"lndMacaroonHex": "0201036c6e64...",
"nwcConnectionString": "nostr+walletconnect://...",
"strikeApiKey": "your-strike-key",
"openNodeApiKey": "your-opennode-key",
"priority": "lnd"
}
}

Tool Availability​

Paying, invoicing, L402, budget, and API-discovery tools need only a wallet. Selling access with l402_producer, and the agent_services actions request, publish, unpublish, and attest, also need LIGHTNING_ENABLE_API_KEY. The MCP Complete Guide lists which tools each wallet supports.


Troubleshooting​

"L402 payment succeeded but access failed"​

Your wallet doesn't return preimage. Solutions:

  1. Best: Switch to LND (run your own node)
  2. Easy: Switch to NWC with CoinOS or Alby
  3. Also works: Strike (returns preimage)
  4. OpenNode will NOT work for L402

"temporary_channel_failure" or routing errors​

Lightning network routing issue. Try:

  • Wait a few minutes and retry
  • Ensure your wallet has sufficient balance
  • Check if the destination node is online

"Wallet not configured"​

No wallet credentials found. Set one of:

  • LND_REST_HOST + LND_MACAROON_HEX
  • NWC_CONNECTION_STRING
  • STRIKE_API_KEY
  • OPENNODE_API_KEY

Or use the config file at ~/.lightning-enable/config.json

NWC "Payment cancelled by user"​

Enable auto-pay in your NWC wallet:

  • CoinOS: Settings → NWC → Edit connection → Enable auto-pay
  • Alby: Check connection permissions

Also set in config:

{
"session": {
"requireApprovalForFirstPayment": false
}
}

Security Notes​

  • No MCP tool can raise your spending limits. setup_wallet writes only the wallet entry of the config file. An agent with shell or filesystem access to the host is outside this guarantee; see AI Spending Security.
  • Treat every credential like a password: API keys, NWC connection strings, and macaroons can all spend.

Next Steps​