APIs, data, tools — paid per request, in seconds, with no account, no API key, and no card on file. The free, open-source Lightning Enable MCP server gives any MCP-capable agent a Lightning wallet and the L402 protocol — and, on the selling side, everything it needs to publish a paid API of its own. Here's how it works.
L402 is a small convention built on three old, boring, reliable pieces: an HTTP status code from 1997, a payment network that settles in about a second, and a credential you can verify without a database lookup.
HTTP 402 Payment Required with two
things attached: a Lightning invoice (the price, often a single
sat) and a macaroon — a scoped credential that isn't valid yet.
The MCP server is free and open source (MIT), published on PyPI, NuGet, and Docker Hub — 24,000+ downloads and counting. Three steps from zero to a paid API call.
# 1 — Install (pick your runtime)
pip install lightning-enable-mcp # Python
uvx lightning-enable-mcp # Python, no install
dotnet tool install -g LightningEnable.Mcp # .NET
docker pull refinedelement/lightning-enable-mcp:latest # Docker
2 — Connect one L402-capable wallet. L402 needs a
wallet that returns the payment preimage: Strike (easiest to start),
NWC (CoinOS / CLINK / Alby Hub), or your own LND node. Add the MCP
to your agent host — for Claude Desktop, that's one entry in
claude_desktop_config.json:
{
"mcpServers": {
"lightning-enable": {
"command": "uvx",
"args": ["lightning-enable-mcp"],
"env": { "STRIKE_API_KEY": "your-strike-api-key" }
}
}
}
3 — Prove the whole loop works. Ask your agent to
run test_l402_payment. It pays a public 1-sat L402
endpoint end to end — wallet connected, preimage returned, response
served. Total cost: about one satoshi. Then try the fun one: ask it
to buy a t-shirt from the
Lightning Enable Store.
The same MCP server puts your agent on the selling side. It opens its own producer account, points payouts at a wallet the human controls, publishes a priced endpoint, and collects sats — every step a tool call, with no human in the payment plumbing. The human supplies four things: a funded Lightning wallet, a spend ceiling, the API, and the price.
# The whole ask, from the human
Set me up to sell my API over Lightning at 5 sats per call.
create_lightning_enable_account.
Pays the ~100-sat L402 Fast Lane challenge from the connected
wallet and returns a merchant API key with a 30-day Agentic
Commerce trial, saved to ~/.lightning-enable/config.json.
No card. Use the operator's real email, never an invented one.
l402_producer, action configure_receive.
Registers a Nostr Wallet Connect connection string as the receiving
wallet, so sats settle into a wallet the human already runs. No
Strike or OpenNode account to open. setup_wallet
handles the spending side.
create_proxy, add_endpoint, publish.
Gates the upstream API and prices each route in sats. The proxy
serves an OpenAPI 3.1 document whose x-payment block
states the scheme, supported protocols, price_sats,
token validity, and auth header format, plus a 402 response per
operation — so a buying agent reads the price before it calls.
status and list_challenges report what has
been minted and what has been paid.
producer-setup.
The producer-setup Claude Skill drives steps 1 through 4
in one sequence, so a single instruction from the human is enough.
l402_producer also carries create and
verify for minting and checking individual challenges.
The human keeps the boundaries: which wallet you may use, how much you may spend, which API you may sell, and at what price. Lightning Enable does not hold funds — the wallet (or payment provider) facilitates custody and settlement.
Simple split: spending money is free, making money is the product.
Building an agent? The MCP is free — install it and
your agent can pay any L402 API today.
Building an API? Gate your first endpoint in the
free sandbox, no card required — or hand the setup to your agent with
the producer-setup skill.
pip install lightning-enable-mcp ·
dotnet tool install -g LightningEnable.Mcp ·
MCP quickstart