
Paywall Mcp
io.github.llmops-pro由 GitHub 帳號 llmops-pro 發布v0.1.2更新於 Oct 24, 2026
Lightning-paywall sidecar: wraps any stdio MCP server, requires paid invoices before tool calls.
概覽
一個本機邊車,可包裝任意 stdio MCP 伺服器,並在轉送呼叫前要求付費的 Lightning 發票。
- 可以做什麼
- 列出上游工具,並在每個工具描述後附加依工具的 sats 價格,免費工具原樣透傳給被包裝的伺服器。攔截收費工具呼叫:首次呼叫回傳 bolt11 發票與 payment hash,攜帶已結算 hash 的第二次呼叫經核驗後轉送。透過 Nostr Wallet Connect 錢包核驗結算,並做重放保護,每個 hash 只能兌換一次。將每個請求寫入 NDJSON 稽核日誌,並可在唯讀模式下阻擋所有付費呼叫。
- 適用情境
- 當你已有 stdio MCP 伺服器,想在不改動其程式碼的情況下依工具呼叫收取 sats 時使用,例如轉售第三方伺服器或測試依工具定價的級距。
- 執行需求
- 需要 Node 20+ 以及一個要包裝的現有 stdio MCP 伺服器,透過 PAYWALL_UPSTREAM_COMMAND 與 PAYWALL_UPSTREAM_ARGS 設定。只要有工具價格非零,就需要在 NWC_CONNECTION_STRING 中提供賣家收款錢包的 NIP-47 NWC 連線字串;具備 make_invoice 與 lookup_invoice 權限即可。價格透過 PAYWALL_PRICE_MAP 與 PAYWALL_DEFAULT_PRICE_SATS 設定。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Paywall Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
paywall-mcp
Paywall ANY stdio MCP server with Lightning, without modifying it. paywall-mcp is a generic sidecar: configure it with an upstream MCP server command and a per-tool price map, and it transparently:
- Forwards
tools/listfrom the upstream to the LLM client, with prices appended to each tool's description. - Intercepts
tools/call: free tools pass through; priced tools require a paid Lightning invoice (via Nostr Wallet Connect / NIP-47) before the call is forwarded.
No code changes to the upstream server. Works with Anthropic's reference MCP servers, your own, or any third-party MCP server that speaks stdio.
v0.1 — proxy + payment gate complete. Spawns a stdio upstream as a child process; per-tool pricing via env; in-memory invoice cache + replay protection; audit log; read-only mode. Persistent cache + HTTP/SSE upstream transport deferred to v0.2.
Why this exists
Modern paid-API patterns (Lightning paywall, L402, micropayments) exist for HTTP but the MCP ecosystem has no standard for paid tool calls. Building it into each individual server is repetitive and error-prone. paywall-mcp is the missing sidecar: write your tools as a normal MCP server, then wrap it with paywall-mcp to charge sats per call.
How the dual-call pattern works
For any priced tool:
- First call — LLM calls
priced_tool({...args})withoutpayment_hash. paywall-mcp issues a bolt11 invoice through your NWC wallet and returns: - Payment — the LLM (or its operator) pays the invoice. Easiest path: use
nwc-mcp— the same LLM can callnwc_pay_invoiceto settle. - Second call — LLM calls
priced_tool({...args, payment_hash: "abc123..."}). paywall-mcp verifies settlement via NWClookup_invoice, stripspayment_hashfrom the args, forwards the original call to the upstream, returns the upstream's result.
Replay protection: the same payment_hash cannot be redeemed twice. Buyers pay a fresh invoice for each call.
What you can build with it
- Charge sats for premium tools in an MCP server you already have, by adding one wrapper process.
- Per-tool pricing tiers —
free_lookup: 0,premium_analysis: 100,rare_alpha_signal: 5000. Buyers see prices in tool descriptions. - Bundle-and-resell third-party MCP servers — wrap someone else's open-source MCP server with your paywall and offer it as a managed paid service.
- A/B test pricing — adjust
PAYWALL_PRICE_MAPin env, restart, you're at the new price. - Time-limited promotional pricing — start at 21 sats, raise to 100 sats once usage proves the value.
Requirements
- Node 20+
- An existing stdio MCP server to wrap (paywall-mcp doesn't host tools itself; it gates an upstream's tools).
- A NIP-47 NWC connection string for the seller's receive wallet.
make_invoice+lookup_invoiceare the only permissions paywall-mcp needs. A receive-only NWC connection is perfectly fine and recommended — paywall-mcp never spends.
Install
Configure
The server auto-loads .env from its own directory (next to dist/) — deliberately NOT from cwd, to avoid env collisions when running multiple MCP servers in the same Claude Code session.
Required
Required when any tool has a non-zero price
Pricing
Optional
End-to-end example: paywall the bundled paywall-mcp-test server
The companion paywall-mcp-test package exposes a single tool — premium_compliment. It already implements its own paywall pattern internally, but it's also a convenient stand-in for "any upstream MCP server" to demonstrate paywall-mcp itself.
.env:
Wire paywall-mcp (not the upstream directly) into your MCP client:
Now from your agent:
Safety model
Audit log entries (NDJSON, one per request):
outcome: "ok"— invoice issued, free passthrough, or paid passthrough completedoutcome: "blocked"— read-only refusal, invalid hash, replay, mismatch, not-settledoutcome: "error"— upstream call failed, NWClookup_invoicefailed, etc.
Tail the audit log for ground truth — independent of whatever the LLM tells you.
Wire into Claude Desktop / Claude Code / Cursor
Same .env-via-binary-dir pattern as the rest of the substrate — leave env empty in the client config; secrets stay in paywall-mcp/.env.
Testing
Companion servers
nwc-mcp— Lightning wallet for the buyer. Lets the agent pay the invoices paywall-mcp issues. The matching half of the agent-pays-a-paid-tool loop.nostr-ops-mcp— NOSTR identity, publishing, encrypted DMs.marketplace-mcp— Run a NIP-15 / Shopstr storefront from an agent.albyhub-admin-mcp— Alby Hub node-admin via HTTP API.
License
MIT — see LICENSE.
Contact / Issues
Built by LLMOps.Pro.
- NOSTR:
npub1hdg932jvwc3jdvkqywgqv0ue4nn60exrf92asy8mtazt3hjg7d2s2yw0nw— follow, DM, zap. - Lightning Address:
[email protected]— for support zaps and "this was useful" tips. - Bug reports / feature requests: open a GitHub issue (link forthcoming).
- Security issues: please disclose privately via NOSTR DM before opening a public issue.
來源:README.md,提交 bc54c1d
工具
0版本歷史
1- v0.1.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分