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
| Wallet | Returns Preimage | L402 Works | Custody | Best For |
|---|---|---|---|---|
| LND (Your Node) | ✅ Always | ✅ Yes | You control | Power users, guaranteed L402 |
| NWC (CoinOS) | ✅ Yes | ✅ Yes | Custodial | Free, easy, L402 works |
| NWC (CLINK) | ✅ Yes | ✅ Yes | Custodial | Nostr users, L402 works |
| Alby | ✅ Yes | ✅ Yes | You hold the keys | NWC compatible |
| Strike | ✅ Yes | ✅ Yes | Custodial | USD users, easy setup, L402 works |
| Primal | ❌ No | ❌ No | Custodial | Direct payments only |
| OpenNode | ❌ No | ❌ No | Custodial | Direct payments only |
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.
Recommended Setup for L402
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.
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
The base pip install lightning-enable-mcp supports NWC on every platform. The old [nwc] extra still installs but adds nothing.
Setup:
- Sign up at https://coinos.io
- Go to Settings → NWC
- Create a new NWC connection
- Enable auto-pay for the connection (important for L402!)
- Copy the connection string
{
"mcpServers": {
"lightning-enable": {
"command": "lightning-enable-mcp",
"env": {
"NWC_CONNECTION_STRING": "nostr+walletconnect://..."
}
}
}
}
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:
- Deploy Alby Hub: https://albyhub.com?ref=magma
- Connect to your Lightning node
- Create NWC connection
- 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:
- Create an account at https://strike.me
- Get your API key from https://dashboard.strike.me
- Fund your Strike account with BTC
{
"mcpServers": {
"lightning-enable": {
"command": "lightning-enable-mcp",
"env": {
"STRIKE_API_KEY": "your-strike-api-key"
}
}
}
}
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):
- LND (if
LND_REST_HOST+LND_MACAROON_HEXare set) - NWC (if
NWC_CONNECTION_STRINGis set) - Strike (if
STRIKE_API_KEYis set) - OpenNode (if
OPENNODE_API_KEYis 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:
- Best: Switch to LND (run your own node)
- Easy: Switch to NWC with CoinOS or Alby
- Also works: Strike (returns preimage)
- 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_HEXNWC_CONNECTION_STRINGSTRIKE_API_KEYOPENNODE_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_walletwrites 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
- MCP Complete Guide - Full MCP tool reference
- AI Spending Security - Budget configuration
- How It Works - L402 protocol details