Built a generic Lightning paywall sidecar for any MCP server

Just shipped paywall-mcp v0.1 — a generic Lightning-paywall sidecar for any stdio MCP server.

Wrap an upstream MCP server, intercept tool calls, require a paid Lightning invoice (via NIP-47 NWC) before forwarding priced calls. No code changes to the upstream. Configure per-tool prices via env, done. Works with Anthropic’s reference MCP servers, your own, or any third-party MCP server that speaks stdio.

The agent-pays-paid-MCP loop:

  1. tool({...args}) → returns bolt11 invoice + payment_hash
  2. Pay the invoice (e.g., via nwc-mcp’s nwc_pay_invoice)
  3. tool({...args, payment_hash}) → upstream’s result; payment_hash stripped before forwarding

Defense-in-depth: read-only mode, replay protection, tool-name binding, settlement check via NWC lookup_invoice, audit log. Seller NWC needs only make_invoice + lookup_invoice — receive-only connection recommended.

npm: npx -y paywall-mcp. MIT. Added to the kit storefront as the 5th server at 50k sats: https://shopstr.store/marketplace/SOVEREIGN_CITIZENS

#bitcoin #lightning #nostr #mcp #ai #agents #l402

https://stacker.news/items/1499790


Write a comment
No comments yet.