
Nwc Mcp
io.github.llmops-pro由 GitHub 帳號 llmops-pro 發布v0.2.3更新於 Oct 24, 2026
Lightning wallet for AI agents via Nostr Wallet Connect (NIP-47): budget caps, confirm, audit log.
概覽
以 Nostr Wallet Connect 為基礎的閃電錢包 MCP 伺服器,讓 AI 助理查詢餘額、建立發票並支付 sats,並具備預算上限與稽核日誌。
- 可以做什麼
- 檢視錢包與交易:能力資訊、餘額、依付款雜湊或 bolt11 查詢發票、在本機解析 bolt11、預算狀態
- 依指定金額建立收款發票
- 支付 bolt11 發票、Lightning Address、LNURL 字串,以及一次最多 20 張的批次付款
- 向公鑰發起 keysend 付款,僅在明確開啟時可用
- 以一次性權杖確認待執行的付款
- 每次付款呼叫都會經過唯讀、白名單、預算與二次確認等檢查,並寫入 JSON 稽核日誌
- 適用情境
- 適合讓助理自行支付小額真實 sats 的情境,例如為付費工具呼叫付款、對貼文打賞、依任務支付費用,或向客戶開立收款發票,同時把支出限制在你設定的範圍內。
- 執行需求
- 以本機 Node.js 20+ 程序執行(npm 套件 nwc-mcp,stdio)。需要一個支援 NIP-47 的錢包(如 Alby Hub、Mutiny、Coinos、Phoenix)提供的 NWC 連線字串,透過 NWC_CONNECTION_STRING 傳入;未設定 NWC_DAILY_BUDGET_SATS 時伺服器會拒絕啟動。選用變數可調整上限、唯讀模式、二次確認、keysend、白名單與日誌路徑。需要連線至錢包中繼的網路存取。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Nwc Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
nwc-mcp
A Lightning wallet for your LLM agent. MCP server that exposes Nostr Wallet Connect (NIP-47) wallet operations as tools your agent can call — read balance, generate invoices, pay invoices, pay Lightning Addresses, pay LNURLs, batch payments, keysend — all wrapped in a defense-in-depth safety stack.
Drop it into Claude Desktop, Claude Code, Cursor, or any MCP-speaking client. Hand the agent a sub-wallet (not your main one). Set a daily cap. Let it spend sats on your behalf within rails you control.
v0.2 — all spend tools shipped. Twelve tools (7 read/receive + 5 spend + 1 confirm), four safety gates, full audit log. Validated end-to-end against Alby Hub + Olympus by ZEUS routing — real outbound payment settled in 8 seconds.
What you can do with this
- A coding agent that pays for its own paywalled tool calls (L402-style paid MCP servers).
- A NOSTR bot that zaps interesting notes under a daily cap you set.
- An evaluation harness that pays a small fee per task to a worker agent it consumes.
- A storefront agent that issues receive invoices in response to incoming DMs.
- Personal sats-aware agents — "every Friday, send 1,000 sats to my favorite OSS maintainers via their LN addresses."
The safety stack is the load-bearing reason this is usable in production: the agent can request a payment, but the server refuses anything that breaches your configured limits, demands a second-step confirmation if you set one, and writes every call to a structured audit log.
The twelve tools
Read-only (always enabled, no spend risk)
Receive (safe — only generates invoices, no spend)
Spend (gated by the safety pipeline)
Requirements
- Node 20+
- A NWC connection string from a NIP-47-compatible wallet (Alby Hub, Mutiny, Coinos, Phoenix, …)
The canonical buyer setup is Alby Hub PRO with a dedicated sub-wallet for the agent — that's what this server has been smoke-tested against. But the protocol is wallet-agnostic; anything that speaks NIP-47 works.
Install
Configure
Copy .env.example to .env and fill in your NWC connection string:
The server auto-loads .env from the current working directory and from the project root (one level up from dist/). Env vars passed by the parent process (e.g., claude mcp add --env ...) take precedence over .env. .env is gitignored — keep your NWC string out of any committed file.
Required
Optional safety knobs
Wire into an MCP client
Claude Code (project-scoped, recommended)
From this directory:
This writes a .mcp.json in the project root. Project-scoped servers load only when Claude Code starts from this directory tree. Use /mcp inside a session to inspect what's loaded. Restart the CLI to pick up a fresh dist/index.js after a rebuild.
Switch -s project to -s user if you want the server available everywhere.
Claude Desktop / Cursor / other clients
See examples/claude-desktop-config.json for the manifest snippet. Copy it into your client's config, replace the path placeholder. Because the server loads .env itself, you don't need to pass NWC_* vars through the client config — leave the env block empty.
Safety model
This server is designed for use by autonomous LLM agents that hold the keys to spend real sats. The defense in depth runs in this order on every spend tool call:
NWC_READ_ONLYgate — if set, blocks at the first gate. No decode, no network, audit log entry only.- Invoice decode + amount resolution — for bolt11-based tools. Rejects ambiguity (amount-override conflicting with embedded amount).
- Allowlist check — if
NWC_ALLOWED_DESTINATIONSis set, the payee (pubkey for bolt11, LN address for LUD-16, LNURL string for LUD-01, pubkey for keysend) must match. Empty allowlist = no-op. - Budget check — daily rolling cap + optional total cap + optional per-invoice cap. State is persisted to
NWC_BUDGET_STATE_PATH. - Two-step confirmation gate — if
NWC_REQUIRE_CONFIRM=true, returns a 16-byte hex token with 5-minute TTL instead of executing. Agent must callnwc_confirm_paymentwith the token. Safety re-runs on consume. - Execute — calls the wallet via NIP-47. On success: budget records principal + (over-rounded) fees.
- Audit log — every attempt (success, blocked, error) is appended as one structured JSON line per call.
The floor is your NWC connection's own daily cap, set in your wallet. This server's checks are belt-and-suspenders on top — if you trust nothing about the server, the wallet still won't spend past its connection-level cap.
Verifying calls actually went through
Independent of what the LLM tells you, tail the audit log:
Successful call: {"ts":"...","tool":"nwc_pay_invoice","outcome":"ok","result":{"paid_sats":50,...}}. Blocked: {"ts":"...","tool":"nwc_pay_invoice","outcome":"blocked","blocked_reason":"..."}. The audit log is append-only by intent; rotate it as part of your operational hygiene.
Testing
evaluateSafety is a pure function that the unit tests exercise across the full safety matrix (read-only / amount-conflict / allowlist / budget / confirm) without touching a real wallet.
For end-to-end smoke testing against a live wallet, see paywall-mcp-test/ in the parent project — a throwaway second MCP server that exposes one paid tool (premium_compliment) and validates the full agent → invoice → pay → redeem loop.
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 (https://github.com/llmops-pro/nwc-mcp).
- Security issues: please disclose privately via NOSTR DM before opening a public issue.
來源:README.md,提交 d405e54
工具
0版本歷史
1- v0.2.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分