access_l402_resource
Fetch a URL with automatic L402 payment handling. If the server returns a 402 Payment Required response, the invoice will be automatically paid and the request retried.
Give an agent a Lightning wallet so it can clear L402 paywalls and pay BOLT11 invoices itself, under per-request and per-session limits you set first.
LABSCO SUMMARY
access_l402_resource turns a paywalled endpoint into an ordinary fetch, and the controls around it are the substance: configure_budget only tightens, spends above the configured threshold stop for a confirmation code a human relays from the server console, and get_receipts keeps a durable record after the session ends. Part of the surface is conditional — the price, exchange and on-chain tools are Strike-only, and four of the agent-coordination tools are in preview and return an error against the hosted API today.
A Lightning wallet and L402 client for agents, covering both sides of the exchange: paying for access, and charging for it. It holds no funds — the wallet you connect does — and runs locally next to your client.
One L402-capable wallet, and it has to return the payment preimage: Strike (STRIKE_API_KEY), an NWC connection string (NWC_CONNECTION_STRING) from CoinOS, CLINK or Alby Hub, or your own LND node (LND_REST_HOST plus LND_MACAROON_HEX). OpenNode invoices and pays but never returns a preimage, so it cannot clear L402 challenges. If several are set the order is LND, then NWC, then Strike, then OpenNode. Install it as a .NET tool (dotnet tool install -g LightningEnable.Mcp), from PyPI (pip install lightning-enable-mcp or uvx lightning-enable-mcp), or from the Docker image; all three run over stdio. Nine tools additionally need LIGHTNING_ENABLE_API_KEY, which create_lightning_enable_account can mint with a payment of about 100 sats.
One command plus a key — pip install lightning-enable-mcp, then supply credentials
USE CASES
The paywalled fetch is settled and retried in one call, under a ceiling agreed beforehand rather than argued about after.
A wallet that looks connected and a wallet that can complete a payment are different states. One satoshi tells them apart.
Session memory disappears with the session; the receipt log does not, and it records the spend policy alongside the payments.
Search the registry by keyword or category and see how many calls the remaining budget covers.
Issue the challenge, then check the token that comes back before granting access.
Find a published capability on Nostr, check its attestations, then settle over L402 when the work is done.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
access_l402_resourceFetch a URL with automatic L402 payment handling. If the server returns a 402 Payment Required response, the invoice will be automatically paid and the request retried.
check_invoice_statusCheck if a Lightning invoice has been paid. Use the invoice ID from create_invoice.
configure_budgetSet spending limits for the session.
create_invoiceCreate a Lightning invoice to receive a payment. Returns a BOLT11 invoice string to share with the payer.
create_l402_challengeCreate an L402 payment challenge to charge another agent or user for accessing a resource. Returns a Lightning invoice and macaroon. The payer must pay the invoice and present the L402 token (macaroon:preimage) back to you for verification. Requires LIGHTNING_ENABLE_API_KEY with an Agentic Commerce subscription.
create_lightning_enable_accountSelf-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 saved to ~/.lightning-enable/config.json so the producer/ASA tools unlock. Above-threshold fees require an out-of-band confirmation code (as with pay_l402_challenge).
discover_agent_servicesDiscover agent services on the Nostr network. Search by category, hashtag, or keyword. Returns capabilities published as kind 38400 events. Use this to find agents that offer services you can pay for via L402.
discover_apiDiscover L402-enabled APIs. Use 'query' to search the registry for available APIs by keyword, or use 'url' to fetch a specific API's manifest with full endpoint details and pricing. Use 'category' to browse by category. With budget_aware=true, shows how many calls you can afford.
exchange_currencyExchange currency within your wallet (USD to BTC or BTC to USD). Currently only available with Strike wallet.
get_agent_reputationGet an agent's reputation score and reviews. Queries kind 38403 attestation events for the given pubkey off the relay. Returns the average rating and individual reviews. Ratings are un-weighted on-relay attestations — apply your own proof/Web-of-Trust weighting before trusting them.
get_balanceGet the connected wallet's balance. Returns the sats balance plus, where available, all currency balances (USD, BTC, ... — most useful with Strike) and wallet info. Supersedes check_wallet_balance and get_all_balances.
get_btc_priceGet the current Bitcoin price in USD. Only available with Strike wallet.
get_budget_statusView current budget status and spending limits (read-only). Edit ~/.lightning-enable/config.json to change limits.
get_payment_historyList recent L402 payments made during this session.
get_receiptsRead the durable, append-only payment receipt log (~/.lightning-enable/receipts.jsonl). Unlike get_payment_history (in-memory, this session only), receipts persist across sessions and include the spend policy and how to revoke the wallet. Use to review what an agent has spent and how to pull the plug.
pay_invoicePay a Lightning invoice directly and get the preimage as proof of payment. Use this to pay any BOLT11 Lightning invoice without L402 protocol overhead.
pay_l402_challengeManually pay an L402 or MPP invoice and receive the authorization token. Use this if you need to handle the L402/MPP flow yourself. Omit macaroon for MPP (Machine Payments Protocol) mode.
publish_agent_attestationPublish an attestation (review) for an agent after a completed agreement. Creates a kind 38403 event that builds the agent's on-protocol reputation. Requires LIGHTNING_ENABLE_API_KEY. NOTE: writing attestations is not yet available on the hosted API and returns an error. The platform holds a single signing key, so a platform-signed review would share one pubkey across all reviewers — worthless for reputation — so this is intentionally disabled until per-agent (client-side) signing exists. Reading reputation (get_agent_reputation) works today.
publish_agent_capabilityPublish an agent capability advertisement to the Nostr network. Makes your agent discoverable by other agents as a kind 38400 listing, published via Lightning Enable's L402 proxy pipeline. Provide target_url — an L402 proxy is created to back the listing and handle payment. The event is signed by the Lightning Enable platform key. Requires LIGHTNING_ENABLE_API_KEY.
request_agent_serviceSends a service request (kind 38401 event) referencing the provider's capability. The provider responds with agreement/settlement terms; settle via settle_agent_service. If the provider has an L402 endpoint, you can skip this step and use settle_agent_service directly. Requires LIGHTNING_ENABLE_API_KEY.
send_onchainSend an on-chain Bitcoin payment to a Bitcoin address. Currently only available with Strike wallet.
settle_agent_serviceSettle an agent service agreement via L402 payment (CONSUMER/REQUESTER side). Pays the L402 endpoint specified in the agreement, completing the service transaction. Uses the same L402 auto-pay flow as access_l402_resource. The L402 endpoint URL comes from discover_agent_services or request_agent_service results. NOTE: If you are the PROVIDER (selling a service), use create_l402_challenge to generate a Lightning invoice at the agreed price, then verify_l402_payment to confirm payment before delivering the service.
test_l402_paymentSelf-test the Lightning wallet by paying the public 1-sat L402 test endpoint end to end. Proves the wallet is connected, returns a preimage, and can complete an L402 payment. Costs about 1 satoshi. Use this to verify setup or answer 'is my wallet actually working?'. If your budget config requires confirmation for this amount, the verdict is 'needs_confirmation' and the server prints a code to its console — re-run with confirmation_nonce set to that code.
unpublish_agent_capabilityTake a published listing down. Retires the L402 proxy and publishes a NIP-09 kind 5 deletion plus a status=removed 38400 replacement, so other agents stop seeing a dead listing. Works for marketplace listings created via the L402 proxy/dashboard pipeline. Requires LIGHTNING_ENABLE_API_KEY.
verify_confirmation_codeVerify whether a payment confirmation code (relayed by the human from the server console) is still valid and what it authorizes. VERIFICATION ONLY — never executes a payment. To pay, call the original payment tool again with confirmation_nonce.
verify_l402_paymentVerify 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 to the resource. Requires LIGHTNING_ENABLE_API_KEY with an Agentic Commerce subscription.
BEFORE YOU INSTALL
26 tools when we connected. 17 work with just a wallet; the other 9 need LIGHTNING_ENABLE_API_KEY. Four of those, publish_agent_capability, request_agent_service, publish_agent_attestation and get_agent_reputation, are in preview and currently return errors on the hosted API.
LIGHTNING_ENABLE_API_KEY in your environment
Both documented setups run the server on your machine.
CONTEXT COST
Rated by the size of the 26 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
pip install lightning-enable-mcp{
"mcpServers": {
"lightning-enable": {
"command": "uvx",
"args": [
"lightning-enable-mcp"
],
"env": {
"STRIKE_API_KEY": "<YOUR_STRIKE_API_KEY>"
}
}
}
}{
"mcpServers": {
"lightning-enable": {
"command": "dotnet",
"args": [
"tool",
"run",
"lightning-enable-mcp"
],
"env": {
"STRIKE_API_KEY": "<YOUR_STRIKE_API_KEY>"
}
}
}
}