Install
$ agentstack add mcp-shinydapps-l402-kit Open-source listing — not yet scanned by AgentStack. Follow the source repository for install instructions.
Security review
⚠ Flagged1 finding(s); flagged for manual review. · v1.8.7 How review works →
- • Prompt-injection patterns
- • Secret / credential exfiltration
- • Dangerous shell & filesystem operations
- • Untrusted network calls
- • Known-malicious package signatures
- high Reads credentials/environment and may exfiltrate them.
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v1.8.7. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
l402-kit
Add Bitcoin Lightning pay-per-call to any API. 3 lines of code.
[](LICENSE) [](https://docs.l402kit.com/introduction) [](https://github.com/ShinyDapps/l402-kit) [](https://glama.ai/mcp/servers/ShinyDapps/l402-kit)
▶ Watch end-to-end demo — install → 402 → pay → 200 OK
Live traction
| SDK | Version | Downloads | |:----|:-------:|----------:| | 📦 TypeScript · npmjs.com/package/l402-kit | [](https://npmjs.com/package/l402-kit) | [](https://npmjs.com/package/l402-kit) | | 🐍 Python · pypi.org/project/l402kit | [](https://pypi.org/project/l402kit) | [](https://pypi.org/project/l402kit) | | 🦀 Rust · crates.io/crates/l402kit | [](https://crates.io/crates/l402kit) | [](https://crates.io/crates/l402kit) | | 🔌 VS Code Extension · marketplace | [](https://marketplace.visualstudio.com/items?itemName=ShinyDapps.shinydapps-l402) | [](https://marketplace.visualstudio.com/items?itemName=ShinyDapps.shinydapps-l402) | | 🦫 Go · pkg.go.dev | [](https://pkg.go.dev/github.com/shinydapps/l402-kit/go) | [](https://goreportcard.com/report/github.com/shinydapps/l402-kit/go) |
🌍 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
npm install l402-kit # TypeScript / Node.js / Express
pip install l402kit # Python / FastAPI / Flask
go get github.com/shinydapps/l402-kit/go@v1.10.0 # Go / net/http / Chi / Gin
cargo add l402kit # Rust / axum
> AI Agents / LLMs: See [llms.txt](./llms.txt) for 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:
You have access to paid APIs via the L402 protocol.
When you call an API that returns HTTP 402, use the L402Client from l402-kit
to pay automatically with Bitcoin Lightning.
Budget limit: {BUDGET_SATS} sats per session. Never exceed this limit.
Agent SDK quickstart:
import { l402Client, buildWallet } from "l402-kit/agent";
const client = l402Client({
wallet: buildWallet(process.env), // auto-detects BLINK_API_KEY or ALBY_TOKEN
budgetSats: 1000,
});
const data = await client.fetch("https://api.example.com/paid-endpoint");
MCP Server (for Claude Desktop, Cursor, and any MCP-compatible agent):
{
"mcpServers": {
"l402-kit": {
"command": "npx",
"args": ["l402-kit-mcp"],
"env": { "BLINK_API_KEY": "your-key" }
}
}
}
Compatible with: LangChain · OpenAI Agents · CrewAI · Vercel AI SDK · AutoGPT · Any MCP client
Protocol support: L402 (Bitcoin Lightning) · x402 (USDC/Coinbase) compatible
[](https://l402kit.com)
How it works
1. Client calls your API
↓
2. API returns HTTP 402 + BOLT11 invoice + macaroon
↓
3. Client pays (any Lightning wallet, :
↓
5. API verifies SHA256(preimage) == paymentHash ✓
↓
6. HTTP 200 OK + your data
── Fee flow (managed mode) ─────────────────────────────────
Payment → 99.7% → your Lightning Address (instant)
→ 0.3% → ShinyDapps
Quickstart
TypeScript
import express from "express";
import { l402, AlbyProvider } from "l402-kit";
const app = express();
const lightning = new AlbyProvider(process.env.ALBY_TOKEN!);
app.get("/premium", l402({ priceSats: 100, lightning }), (_req, res) => {
res.json({ data: "Payment confirmed." });
});
app.listen(3000);
Python
from fastapi import FastAPI, Request
from l402kit import l402_required
app = FastAPI()
@app.get("/premium")
@l402_required(price_sats=100, owner_lightning_address="you@yourdomain.com")
async def premium(request: Request):
return {"data": "Payment confirmed."}
Go
package main
import (
"fmt"
"net/http"
l402kit "github.com/shinydapps/l402-kit/go"
)
func main() {
http.Handle("/premium", l402kit.Middleware(l402kit.Options{
PriceSats: 100,
OwnerLightningAddress: "you@yourdomain.com",
}, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, `{"data": "Payment confirmed."}`)
})))
http.ListenAndServe(":8080", nil)
}
Rust
use axum::{middleware, routing::get, Router};
use l402kit::{l402_middleware, Options};
use std::sync::Arc;
#[tokio::main]
async fn main() {
let opts = Arc::new(Options::new(100).with_address("you@yourdomain.com"));
let app = Router::new()
.route("/premium", get(|| async { "Payment confirmed." }))
.route_layer(middleware::from_fn_with_state(opts, l402_middleware));
let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await.unwrap();
axum::serve(listener, app).await.unwrap();
}
Test it live
# Step 1 — triggers 402 + returns invoice
curl http://localhost:3000/premium
# ← { "error": "Payment Required", "invoice": "lnbc1u...", "macaroon": "eyJ..." }
# Step 2 — pay the invoice with any Lightning wallet, then:
curl http://localhost:3000/premium \
-H "Authorization: L402 :"
# ← { "data": "Payment confirmed." }
Why not Stripe?
| | Stripe | l402-kit | |--|--------|----------| | Minimum fee | $0.30 | **
MIT — use freely, build freely.
Bitcoin has no borders.
Built with ⚡ by ShinyDapps
Docs · Demo · VS Code · npm
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: ShinyDapps
- Source: ShinyDapps/l402-kit
- License: MIT
- Homepage: https://shinydapps-api.vercel.app
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v1.8.7 Imported from the upstream source.