Featured

Deploy OpenClaw in 60 seconds โ€” 20% off logoDeploy OpenClaw in 60 seconds โ€” 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger โ†’
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger โ†’
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free โ†’
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free โ†’
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data โ€” no proxies, no parsers, no maintenance.

Start building free โ†’
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4โ€“50+ employees): we install, harden, integrate your tools, and maintain it โ€” secured from day one.

Get it set up for you โ†’
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free โ†’
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here โ†’

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

ShinyDapps/l402-kit MCP server](https://glama.ai/mcp/servers/ShinyDapps/l402-kit/badges/score.svg)](https://glama.ai/mcp/servers/ShinyDapps/l402-kit) ๐Ÿ“‡ โ˜๏ธ ๐ŸŽ ๐ŸชŸ ๐Ÿง - Full-stack L402 SDK: server middleware (Express/FastAPI/axum/net/http) + agent client...

README.md

<div align="center">

<picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ShinyDapps/l402-kit/main/docs/logo-dark.svg" height="72"> <img src="https://raw.githubusercontent.com/ShinyDapps/l402-kit/main/docs/logo-light.svg" height="72" alt="l402-kit"> </picture>

l402-kit

Add Bitcoin Lightning pay-per-call to any API. 3 lines of code.

![License: MIT](LICENSE) ![Live Demo](https://docs.l402kit.com/introduction) ![Tests](https://github.com/ShinyDapps/l402-kit) ![l402-kit MCP server](https://glama.ai/mcp/servers/ShinyDapps/l402-kit)

<br/>

<a href="https://marketplace.visualstudio.com/items?itemName=ShinyDapps.shinydapps-l402" title="VS Code Extension โ€” real-time Lightning payment dashboard"> <img src="https://vsmarketplacebadges.dev/version/ShinyDapps.shinydapps-l402.svg" alt="VS Code Marketplace" /> <img src="https://vsmarketplacebadges.dev/installs-short/ShinyDapps.shinydapps-l402.svg" alt="Installs" /> </a>

<br/>

โ–ถ Watch end-to-end demo โ€” install โ†’ 402 โ†’ pay โ†’ 200 OK

<br/>

---

Live traction

| SDK | Version | Downloads | |:----|:-------:|----------:| | ๐Ÿ“ฆ TypeScript ยท npmjs.com/package/l402-kit | ![npm](https://npmjs.com/package/l402-kit) | ![npm total](https://npmjs.com/package/l402-kit) | | ๐Ÿ Python ยท pypi.org/project/l402kit | ![pypi](https://pypi.org/project/l402kit) | ![pypi total](https://pypi.org/project/l402kit) | | ๐Ÿฆ€ Rust ยท crates.io/crates/l402kit | ![crates](https://crates.io/crates/l402kit) | ![crates dls](https://crates.io/crates/l402kit) | | ๐Ÿ”Œ VS Code Extension ยท marketplace | ![vscode ver](https://marketplace.visualstudio.com/items?itemName=ShinyDapps.shinydapps-l402) | ![marketplace](https://marketplace.visualstudio.com/items?itemName=ShinyDapps.shinydapps-l402) | | ๐Ÿฆซ Go ยท pkg.go.dev | ![go](https://pkg.go.dev/github.com/shinydapps/l402-kit/go) | ![go report](https://goreportcard.com/report/github.com/shinydapps/l402-kit/go) |

---

</div>

---

<details> <summary>๐ŸŒ Available in 11 languages โ€” click to expand</summary>

<br/>

๐Ÿ‡บ๐Ÿ‡ธ 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: ๐Ÿ‡บ๐Ÿ‡ธ ยท ๐Ÿ‡ง๐Ÿ‡ท ยท ๐Ÿ‡ช๐Ÿ‡ธ ยท ๐Ÿ‡จ๐Ÿ‡ณ ยท ๐Ÿ‡ฎ๐Ÿ‡ณ ยท ๐Ÿ‡ธ๐Ÿ‡ฆ ยท ๐Ÿ‡ซ๐Ÿ‡ท ยท ๐Ÿ‡ฉ๐Ÿ‡ช ยท ๐Ÿ‡ท๐Ÿ‡บ ยท ๐Ÿ‡ฏ๐Ÿ‡ต ยท ๐Ÿ‡ฎ๐Ÿ‡น

</details>

---

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 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

![Powered by L402-Kit](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, < 1 second, any country)
       โ†“
4. Client sends Authorization: L402 <macaroon>:<preimage>
       โ†“
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 <macaroon>:<preimage>"
# โ† { "data": "Payment confirmed." }

โ–ถ Try the interactive demo

---

Why not Stripe?

| | Stripe | l402-kit | |--|--------|----------| | Minimum fee | $0.30 | < 1 sat (~$0.001) | | Settlement time | 2โ€“7 days | < 1 second | | Chargebacks | Yes | Impossible โ€” cryptographic proof | | Requires account | Yes | No โ€” any Lightning wallet | | AI agent support | No | Yes โ€” 4 SDKs, native | | Countries blocked | ~50 | 0 โ€” global by default | | Reversible | Yes | No โ€” final on receipt | | Open source | No | Yes โ€” MIT |

---

Providers

import { BlinkProvider, OpenNodeProvider, LNbitsProvider } from "l402-kit";

// Blink (recommended โ€” free, instant setup)
const provider = new BlinkProvider(process.env.BLINK_API_KEY!, process.env.BLINK_WALLET_ID!);

// OpenNode (production, custodial)
const provider = new OpenNodeProvider(process.env.OPENNODE_KEY!);

// LNbits (self-hosted)
const provider = new LNbitsProvider(process.env.LNBITS_KEY!, "https://your.lnbits.host");

Bring your own node โ€” implement the LightningProvider interface in 5 lines:

import type { LightningProvider } from "l402-kit";

class MyNode implements LightningProvider {
  async createInvoice(amountSats: number) { /* return Invoice */ }
  async checkPayment(paymentHash: string) { /* return boolean */ }
}

---

Security model

Invoice creation:  paymentHash = SHA256(preimage)
Client payment:    Lightning Network releases preimage to payer
API verification:  SHA256(preimage) == paymentHash  โœ“
Replay protection: each preimage is marked used โ€” works exactly once
Token expiry:      macaroons expire after 1 hour
  • 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.

![VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=ShinyDapps.shinydapps-l402)

  • โšก 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: yourname@yourdomain.com

Other wallets: Wallet of Satoshi ยท Phoenix ยท Zeus ยท Alby

---

Links

| Resource | URL | |----------|-----| | ๐Ÿ“– Docs (11 languages) | l402kit.com/docs | | ๐Ÿ“ฆ npm | npmjs.com/package/l402-kit | | ๐Ÿ PyPI | pypi.org/project/l402kit | | ๐Ÿฆซ Go | pkg.go.dev/github.com/shinydapps/l402-kit/go | | ๐Ÿฆ€ Rust | crates.io/crates/l402kit | | ๐Ÿ”Œ VS Code | marketplace.visualstudio.com | | โšก Lightning | shinydapps@blink.sv | | ๐Ÿ™ GitHub | github.com/ShinyDapps/l402-kit |

---

<div align="center">

MIT โ€” use freely, build freely.

Bitcoin has no borders.

<br/>

Built with โšก by ShinyDapps

<br/>

<a href="https://l402kit.com/docs">Docs</a> ยท <a href="https://docs.l402kit.com/introduction">Demo</a> ยท <a href="https://marketplace.visualstudio.com/items?itemName=ShinyDapps.shinydapps-l402">VS Code</a> ยท <a href="https://npmjs.com/package/l402-kit">npm</a>

</div>

See related servers & alternatives โ†’

Related MCP servers

Browse all โ†’

Related guides

Hand-picked reading to help you choose and use Other servers.