
L402 Kit
io.github.ThiagoDataEngineerPublished by GitHub account ThiagoDataEngineerv1.8.7Updated Oct 24, 2026
MCP server for L402-protected APIs via Bitcoin Lightning. Pay-per-call AI tools in sats.
Overview
Lets an assistant call L402-protected APIs and pay per request automatically over the Bitcoin Lightning Network.
- What you can do
- L402 Kit is a payment layer for APIs that return HTTP 402 with a BOLT11 Lightning invoice and a macaroon. An agent client can detect the 402, pay the invoice from a configured Lightning wallet, and retry the request with an L402 authorization header. It also ships server-side middleware for TypeScript, Python, Go and Rust so developers can charge for their own endpoints, plus a VS Code extension for monitoring payments.
- When to use it
- Worth adding when an assistant needs to consume paid APIs that use the L402 or x402 pay-per-call model and you want the payment step handled without a human approving each request. It is aimed at autonomous agent workflows and at developers monetizing their own APIs.
- Requirements
- Runs locally over stdio, typically launched with npx l402-kit-mcp. Needs Node.js and a Lightning wallet credential supplied through the environment, such as BLINK_API_KEY (with BLINK_WALLET_ID), ALBY_TOKEN, OPENNODE_KEY or LNBITS_KEY, depending on the provider. A Lightning address or self-hosted node is needed to receive payments. Network access to the Lightning provider and the paid API is required.
Installation
In SourceWeft
- Open L402 Kit in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
l402-kit
Add Bitcoin Lightning pay-per-call to any API. 3 lines of code.
[License: MIT] [Live Demo] [Tests] [l402-kit MCP server]
[VS Code Marketplace] [Installs]
▶ Watch end-to-end demo — install → 402 → pay → 200 OK
Live traction
🌍 Available in 11 languages — click to expand
🇺🇸 Charge for your API in Bitcoin Lightning. 3 lines of code. 🇧🇷 Monetize sua API com Bitcoin Lightning. 3 linhas de código. 🇪🇸 Monetiza tu API con Bitcoin Lightning. 3 líneas de código. 🇨🇳 用 3 行代码,通过比特币闪电网络收费。 🇮🇳 अपने API को Bitcoin Lightning से 3 लाइनों में मोनेटाइज़ करें। 🇸🇦 اكسب من API الخاص بك عبر Bitcoin Lightning. 3 أسطر فقط. 🇫🇷 Monétisez votre API en Bitcoin Lightning. 3 lignes de code. 🇩🇪 Monetarisiere deine API mit Bitcoin Lightning. 3 Zeilen Code. 🇷🇺 Монетизируй свой API через Bitcoin Lightning. 3 строки кода. 🇯🇵 Bitcoin LightningでAPIを3行で収益化。 🇮🇹 Monetizza la tua API con Bitcoin Lightning. 3 righe di codice.
📖 Official docs: 🇺🇸 · 🇧🇷 · 🇪🇸 · 🇨🇳 · 🇮🇳 · 🇸🇦 · 🇫🇷 · 🇩🇪 · 🇷🇺 · 🇯🇵 · 🇮🇹
Install
AI Agents / LLMs: See
llms.txtfor machine-readable instructions. Agent discovery:/.well-known/agent.json·/.well-known/l402.json
For AI Agents
l402-kit is the payment layer for autonomous agents. Agents can pay for APIs without human intervention.
System prompt snippet — add this to any agent to enable L402 payments:
Agent SDK quickstart:
MCP Server (for Claude Desktop, Cursor, and any MCP-compatible agent):
Compatible with: LangChain · OpenAI Agents · CrewAI · Vercel AI SDK · AutoGPT · Any MCP client
Protocol support: L402 (Bitcoin Lightning) · x402 (USDC/Coinbase) compatible
How it works
Quickstart
TypeScript
Python
Go
Rust
Test it live
Why not Stripe?
Providers
Bring your own node — implement the LightningProvider interface in 5 lines:
Security model
- Unforgeable — SHA256 is a one-way function; you cannot fake a preimage
- No chargebacks — cryptographic settlement, not reversible card auth
- Replay-safe — MemoryReplayAdapter (dev) or RedisReplayAdapter (production, multi-instance)
- 600+ automated tests across 5 runtimes (TS, Python, Go, Rust, Cloudflare Workers) — production-grade reliability for autonomous agent workflows
- Fully auditable — MIT, every line open source
VS Code Extension
Monitor every sat in real-time without leaving your editor.
- ⚡ Live payment feed per endpoint
- 📊 Bar chart — 1D / 7D (free) · 30D / 1Y / ALL (Pro)
- 🌍 11 languages built-in
- 🎨 Light / dark / auto theme
- 🔧 Zero config — just set your Lightning Address
Get a Lightning Address (free)
Sign up at dashboard.blink.sv — free, no credit card, instant.
Your address: [email protected]
Other wallets: Wallet of Satoshi · Phoenix · Zeus · Alby
Links
Source: README.md at commit a9a2161
Tools
0Version history
1- v1.8.7LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts