@powforge/paymcp-l402-provider
v0.1.1
Published
Lightning L402 payment provider for paymcp — drop-in LNBits backend for @price() and @subscription() decorators
Maintainers
Readme
@powforge/paymcp-l402-provider
LNBits Lightning payment provider for paymcp — drop-in backend for @price() and @subscription() decorators.
Install
npm install @powforge/paymcp-l402-providerUsage
const { LnbitsPaymentProvider } = require('@powforge/paymcp-l402-provider');
const provider = new LnbitsPaymentProvider({
lnbitsUrl: process.env.LNBITS_URL,
lnbitsApiKey: process.env.LNBITS_INVOICE_KEY,
satsAmount: 21,
});Wire it into paymcp:
const { PayMCP } = require('paymcp');
PayMCP(mcp, { providers: [provider] });The satsAmount config controls how many sats are charged per call. The amount and currency arguments from paymcp are accepted but ignored — Lightning invoices are denominated in sats, not fiat.
API
new LnbitsPaymentProvider(config)
lnbitsUrl(string, required) — LNBits instance URL (e.g.https://lnbits.example)lnbitsApiKey(string, required) — Invoice/read key (NOT admin key)satsAmount(number, default 10) — Sats charged per paymentfetchImpl(function, optional) — Inject for tests; defaults toglobalThis.fetch
createPayment(amount, currency, description) => Promise<{ payment_id, payment_url }>
Mints a Lightning invoice. The amount and currency arguments are ignored; sats come from config.
getPaymentStatus(payment_id) => Promise<'paid'|'pending'>
Returns 'paid' when LNBits reports the invoice settled, 'pending' otherwise.
License
MIT
