
Research
/Security News
Popular npm Packages in the keyv and Cacheable Namespaces Compromised in Active Supply Chain Attack
Popular npm packages keyv and cacheable compromised.
LightningEnable.Mcp
Advanced tools
Part of Lightning Enable — infrastructure for agent commerce over Lightning. MCP server enabling AI agents to make Lightning payments, discover APIs, access L402 resources, and participate in agent-to-agent commerce.
Agents pay your API per request over Lightning — flat subscription from $99/mo, and you keep 100% of every sat.
Or sign up without leaving your agent: call the create_lightning_enable_account tool.
A Model Context Protocol (MCP) server that enables AI agents to make Lightning Network payments. Wallet, invoice, L402, budget, and API-discovery tools work out of the box with just a wallet (free, no subscription). Producer tools (create_l402_challenge, verify_l402_payment) and Agent Service Agreement tools for agent-to-agent commerce over Nostr unlock with an Agentic Commerce subscription (from $99/mo) and LIGHTNING_ENABLE_API_KEY. One out-of-the-box tool, create_lightning_enable_account, self-provisions that API key — an agent with a wallet pays a ~100-sat activation fee and unlocks the subscription tools on the spot. See the MCP Complete Guide for the full tool list.
This MCP server provides tools for AI agents (like Claude) to:
dotnet tool install -g LightningEnable.Mcp
pip install lightning-enable-mcp
# Or use uvx for no-install execution:
uvx lightning-enable-mcp
docker pull refinedelement/lightning-enable-mcp:latest
git clone https://github.com/refined-element/lightning-enable-mcp
cd lightning-enable-mcp/dotnet
dotnet build src/LightningEnable.Mcp
| Variable | Required | Default | Description |
|---|---|---|---|
STRIKE_API_KEY | If using Strike | - | Strike API key |
OPENNODE_API_KEY | If using OpenNode | - | OpenNode API key |
OPENNODE_ENVIRONMENT | No | production | production or dev for testnet |
NWC_CONNECTION_STRING | If using NWC | - | Nostr Wallet Connect URI |
LND_REST_HOST | If using LND | - | LND REST API host |
LND_MACAROON_HEX | If using LND | - | LND admin macaroon in hex |
LIGHTNING_ENABLE_API_KEY | For producer tools | - | API key for create_l402_challenge and verify_l402_payment. Requires Agentic Commerce subscription. |
Configure one wallet provider. If multiple are set, priority order is: LND > NWC > Strike > OpenNode.
Best for users who want USD balance management, BTC price tracking, and easy on/off ramps. Supports L402 (returns preimage).
export STRIKE_API_KEY="your-api-key"
Run your own Lightning node for full control. LND always returns preimage — L402 is guaranteed to work.
export LND_REST_HOST="localhost:8080"
export LND_MACAROON_HEX="your-admin-macaroon-in-hex"
NWC connects to your Lightning wallet via the Nostr protocol. L402 compatibility depends on the wallet:
export NWC_CONNECTION_STRING="nostr+walletconnect://<pubkey>?relay=<relay-url>&secret=<secret>"
Use your OpenNode account to pay invoices. Does not return preimage — cannot be used for L402.
export OPENNODE_API_KEY="your-api-key"
export OPENNODE_ENVIRONMENT="dev" # Use testnet for testing
Add to your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json
Using Strike:
{
"mcpServers": {
"lightning-enable": {
"command": "dotnet",
"args": ["tool", "run", "lightning-enable-mcp"],
"env": {
"STRIKE_API_KEY": "your-strike-api-key"
}
}
}
}
Using NWC (CoinOS/CLINK):
{
"mcpServers": {
"lightning-enable": {
"command": "dotnet",
"args": ["tool", "run", "lightning-enable-mcp"],
"env": {
"NWC_CONNECTION_STRING": "nostr+walletconnect://your-pubkey?relay=wss://relay.getalby.com/v1&secret=your-secret"
}
}
}
}
Using LND:
{
"mcpServers": {
"lightning-enable": {
"command": "dotnet",
"args": ["tool", "run", "lightning-enable-mcp"],
"env": {
"LND_REST_HOST": "localhost:8080",
"LND_MACAROON_HEX": "your-admin-macaroon-in-hex"
}
}
}
}
The canonical inventory is the Tools table in the root README: 26 tools (17 free / 9 gated). The sections below document a selected subset.
Deprecated aliases (accepted but unadvertised, forward to the new tool, removed in v2.0.0): confirm_payment → verify_confirmation_code; check_wallet_balance and get_all_balances → get_balance.
Self-bootstrapping signup: activate a Lightning Enable account with a tiny Lightning payment (~100 sats) and get back a merchant API key. Requires NO Lightning Enable API key (it creates one) — only a connected wallet. On success the API key is merged into ~/.lightning-enable/config.json (existing keys preserved) so the producer/ASA tools unlock on the next restart. Above-threshold activation fees require a human-supplied confirmation code (same out-of-band flow as pay_l402_challenge).
Parameters:
email (required): Email address to register the account undermaxSats: Maximum sats to pay for activation (fee is ~100 sats). Default: 1000confirmationNonce: Human-relayed confirmation code (only for an above-threshold fee)Returns: { success, apiKey, merchantId, planTier, subscriptionStatus, trialEndsAt, dashboardUrl, activation, config }
Pay a Lightning invoice directly and get the preimage as proof of payment.
Parameters:
invoice (required): BOLT11 Lightning invoice string to paymaxSats: Maximum sats allowed to pay. Default: 1000Returns:
success: Boolean indicating payment successpreimage: Hex preimage proving payment (if successful)error: Error message (if failed)SECURITY WARNING: This tool spends real Bitcoin. Always:
Gets the connected wallet's balance. Supersedes check_wallet_balance and get_all_balances.
Parameters: None
Returns: A single superset shape — the scalar balance (wallet.balanceSats / wallet.balanceMsat), a balances[] array (all currencies for Strike; a single BTC entry otherwise), the session spending summary, and budget remaining.
Reads the durable, append-only payment receipt log at ~/.lightning-enable/receipts.jsonl. Every L402 payment appends one receipt (endpoint, amount, wallet, spend policy, session spend, and how to revoke the wallet). Unlike get_payment_history (in-memory, this session only), receipts persist across sessions — the audit + "pull the plug" record. Receipts never contain secrets (no preimage, macaroon, or connection string).
Parameters:
limit: Maximum number of recent receipts to return (1-200). Default: 20Returns: { success, count, totalSatsInView, logFile, receipts, note } — the recent receipts plus a spend total and the log-file path.
Lists recent payments made in the session.
Parameters:
limit: Maximum payments to return. Default: 10Returns: List of payments with URL, amount, timestamp, and status
View current budget configuration and session spending (read-only).
Parameters: None
Returns: Budget tiers, limits, and current session spending
Tightens the session spending limits. Tighten-only: an agent can only LOWER its
caps — it can never raise them above the operator's ~/.lightning-enable/config.json
limits (or an existing tighter runtime cap). To raise limits, the operator edits the
config file. This prevents a prompt-injected agent from loosening its own caps and
then draining the wallet.
Parameters:
perRequest: Max sats per single request. Default: 1000perSession: Max total sats for the session. Default: 10000Create a Lightning invoice to receive payments.
Parameters:
amountSats (required): Amount in satoshismemo: Description for the invoiceexpirySecs: Invoice expiry in seconds. Default: 3600Check if a previously created invoice has been paid.
Parameters:
invoiceId (required): Invoice ID from create_invoiceFetches a URL, automatically paying any L402 challenge. Requires a wallet that returns preimage (Strike, LND, CoinOS, CLINK, Alby Hub).
Parameters:
url (required): The URL to fetchmethod: HTTP method (GET, POST, PUT, DELETE). Default: GETheaders: Optional headers as JSON objectbody: Optional request bodymaxSats: Maximum sats to pay. Default: 1000Self-tests the wallet by paying the public 1-sat L402 test endpoint (/l402/test/ping) end to end. Proves the wallet is connected, returns a preimage, and can complete an L402 payment — the one-line answer to "is my wallet actually working?". Costs about 1 satoshi. Returns a plain verdict (passed / needs_confirmation / inconclusive / failed with a reason code). If your budget config requires confirmation for this amount, re-run with confirmationNonce set to the code the server prints to its console.
Parameters:
confirmationNonce: Confirmation code from the server console, if a prior call returned test="needs_confirmation". Omit on the first call.Manually pays an L402 invoice when you have the macaroon and invoice separately.
Parameters:
invoice (required): BOLT11 invoice stringmacaroon (required): Base64-encoded macaroonmaxSats: Maximum sats to pay. Default: 1000Returns: L402 token for use in Authorization header
Get the current Bitcoin price in USD.
Convert between USD and BTC within your Strike wallet.
Send an on-chain Bitcoin payment to a Bitcoin address.
Create an L402 payment challenge to charge another agent or user for accessing a resource. Returns a Lightning invoice and macaroon that the payer must pay before you grant access.
Requires: LIGHTNING_ENABLE_API_KEY with an Agentic Commerce subscription (from $99/mo).
Parameters:
resource (required): Resource identifier — URL, service name, or description of what you're charging forpriceSats (required): Price in satoshis to chargedescription: Description shown on the Lightning invoiceReturns:
challenge.invoice: BOLT11 Lightning invoice for the payerchallenge.macaroon: Base64-encoded macaroonchallenge.paymentHash: Payment hash for trackingchallenge.expiresAt: Invoice expiration timeinstructions: Instructions for the payer and verification stepsVerify an L402 token (macaroon + preimage) to confirm payment was made. Use this after receiving an L402 token from a payer to validate they paid before granting access.
Requires: LIGHTNING_ENABLE_API_KEY with an Agentic Commerce subscription (from $99/mo).
Parameters:
macaroon (required): Base64-encoded macaroon from the L402 tokenpreimage (required): Hex-encoded preimage (proof of payment)Returns:
valid: Boolean — whether the payment is verifiedresource: The resource identifier the payment was forSee AI Spending Security for full security guidance.
L402 requires the payment preimage to create credentials. Not all wallets return it:
| Wallet | Returns Preimage | L402 Works |
|---|---|---|
| LND | Always | Yes |
| Strike | Yes | Yes |
| CoinOS (NWC) | Yes | Yes |
| CLINK (NWC) | Yes | Yes |
| Alby (NWC) | Yes | Yes |
| OpenNode | No | No |
| Primal (NWC) | No | No |
The Lightning Enable Store is a live L402-powered web store where AI agents can purchase physical merchandise using Bitcoin Lightning payments.
Ask Claude: "Buy me a Lightning Enable t-shirt from store.lightningenable.com"
The store demonstrates the full L402 flow: browse catalog, checkout (get 402), pay invoice, claim with L402 credential.
You: Pay this Lightning invoice: lnbc100n1p3...
Claude: I'll pay that invoice for you.
[Calls pay_invoice with invoice="lnbc100n1p3..."]
Payment successful! Here's the preimage as proof of payment: abc123...
You: Use access_l402_resource to fetch data from https://api.paywall.example.com/data
Claude: I'll fetch that URL with L402 payment support.
[Calls access_l402_resource with url="https://api.paywall.example.com/data"]
The request required a payment of 50 sats which was automatically paid.
Here's the response: ...
With the producer tools, your agent can charge other agents for services — making it a full commerce participant that can both buy and sell.
Agent B: I need weather data for New York.
Agent A (seller): I'll create a payment challenge for that.
[Calls create_l402_challenge with resource="weather/new-york", priceSats=10, description="NYC weather data"]
Here's your invoice — pay 10 sats to get the data:
Invoice: lnbc100n1p3...
Macaroon: AgELbGl...
Agent B: [Pays the invoice using pay_invoice or pay_l402_challenge, gets preimage]
Here's my L402 token: AgELbGl...:abc123def...
Agent A: Let me verify that payment.
[Calls verify_l402_payment with macaroon="AgELbGl...", preimage="abc123def..."]
Payment verified! Here's your weather data: Temperature: 72°F, Humidity: 45%...
This enables agent-to-agent commerce: any agent with an Agentic Commerce subscription can create paywalls, and any agent with a Lightning wallet can pay them.
You: Configure the budget to allow max 500 sats per request and 5000 sats total
Claude: I'll configure those budget limits.
[Calls configure_budget with perRequest=500, perSession=5000]
Budget configured:
- Max per request: 500 sats
- Max per session: 5000 sats
- Currently spent: 0 sats
Set one of: STRIKE_API_KEY, LND_REST_HOST + LND_MACAROON_HEX, NWC_CONNECTION_STRING, or OPENNODE_API_KEY.
The requested payment exceeds your configured limits. Use configure_budget or get_budget_status to check.
Check:
Your wallet doesn't return preimage. Switch to LND, Strike, CoinOS, or CLINK.
cd lightning-enable-mcp/dotnet
dotnet build src/LightningEnable.Mcp
dotnet test tests/LightningEnable.Mcp.Tests
cd dotnet/src/LightningEnable.Mcp
# Clear any prior packed artifacts BEFORE packing, so the wildcard push
# below targets only this build's output. `dotnet pack -o` writes the new
# .nupkg in but does NOT clear pre-existing files — the rm step is what
# makes the push deterministic.
rm -f ./artifacts/*.nupkg
dotnet pack -c Release -o ./artifacts
dotnet nuget push ./artifacts/LightningEnable.Mcp.*.nupkg --source nuget.org
MIT License - see LICENSE for details.
FAQs
Part of Lightning Enable — infrastructure for agent commerce over Lightning. MCP server enabling AI agents to make Lightning payments, discover APIs, access L402 resources, and participate in agent-to-agent commerce.
We found that LightningEnable.Mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.

Security News
/Company News
Socket has joined the new Composer and Packagist sponsorship program as a launch sponsor, supporting the team that keeps PHP's package ecosystem secure.