
Nwc Mcp
io.github.llmops-proPublished by GitHub account llmops-prov0.2.3Updated Oct 24, 2026
Lightning wallet for AI agents via Nostr Wallet Connect (NIP-47): budget caps, confirm, audit log.
Overview
Lightning wallet MCP server that lets an AI agent read balance, create invoices and pay sats over Nostr Wallet Connect, with budget caps and an audit log.
- What you can do
- Inspect the wallet and its transactions: capabilities, balance, invoice lookup, local bolt11 decoding, budget status
- Create receive invoices for a given amount of sats
- Pay bolt11 invoices, Lightning Addresses, LNURL strings, and batches of up to 20 invoices
- Send keysend payments to a pubkey, only when explicitly enabled
- Confirm a pending payment by consuming its one-time token
- Every spend call passes through read-only, allowlist, budget and confirmation gates and is written to a JSON audit log
- When to use it
- Use it when an agent should pay small amounts of real sats on its own: paying for paywalled tool calls, zapping notes, paying per-task fees, or issuing invoices to customers, while you keep spending inside limits you set.
- Requirements
- Runs locally as a Node.js 20+ process (npm package nwc-mcp, stdio). Needs a NWC connection string from a NIP-47 wallet such as Alby Hub, Mutiny, Coinos or Phoenix, supplied as NWC_CONNECTION_STRING; the server refuses to start without NWC_DAILY_BUDGET_SATS. Optional variables tune caps, read-only mode, confirmation, keysend, allowlist and log paths. Network access to the wallet relay is required.
Installation
In SourceWeft
- Open Nwc Mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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.
Source: README.md at commit d405e54
Tools
0Version history
1- v0.2.3LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts