CCM
/MCP
SkillsMCPMarketplacesDigestToolsAdvertise

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by Category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP Servers by Category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by Category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control

Claude Code Marketplaces

Discover Claude Code plugins, extensions, and tools. Automatically updated directory of Anthropic Claude AI marketplaces with development tools, productivity plugins, and integrations.

Resources

  • Browse Skills
  • Browse MCP Servers
  • Browse Marketplaces
  • Skill index
  • MCP index
  • Marketplace index
  • Plugins Reference

Community

  • About
  • Tools
  • Feedback
  • Privacy Policy
  • Advertise

Built for the Claude Code community with Claude Code by mertbuilds.com

Independent project, not affiliated with Anthropic
forgesworn avatar

402 Mcp

forgesworn/402-mcp
authSTDIOregistry active
Summary

Gives Claude the ability to pay for and consume Lightning-gated APIs autonomously. It discovers services via Nostr (kind 31402 events), probes endpoints for pricing without paying, then auto-pays invoices using NWC or Cashu if under your configured budget cap. Credentials are cached locally and encrypted. Works with any L402-compliant server including toll-booth and Aperture. The agent can browse volume discount tiers, reason about cost versus usage, and make purchasing decisions within your spend limits. Supports onion routing and Handshake domains with fallback. Useful when you want Claude to consume paid data APIs, routing services, or AI inference endpoints without manual API key management or per-service registration.

CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Lid closed, agents working
Lid closed, agents working
Keeps your Mac awake while Claude Code, Codex or Cursor works. Lets it sleep when they are done.
Try free for 7 days →
Block distraction from your iPhone for freeBlock distraction from your iPhone for free
Block distraction from your iPhone for free
Block distracting apps from your iPhone permanently without a 3rd party app. Free and open source.
Block now (100% free) →
Granola, the best AI meeting recorder
Granola, the best AI meeting recorder
Notes, actions and memory. Without a meeting bot. First month 100% off.
Download for free →
belt - the only tool your agent needs
belt - the only tool your agent needs
belt cli automatically finds the best tools and skills for your agent. image, video, music, tts...
one prompt install →
Open Steps
Open Steps
Free an open-source skills that make AI coding agents easier to understand, verify, and control.
Download for free →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →
Agent, connect blockchain
Agent, connect blockchain
Connect your Claude agent to live crypto prices and trading routes via 1inch
Get the MCP →
CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Lid closed, agents working
Lid closed, agents working
Keeps your Mac awake while Claude Code, Codex or Cursor works. Lets it sleep when they are done.
Try free for 7 days →
Block distraction from your iPhone for freeBlock distraction from your iPhone for free
Block distraction from your iPhone for free
Block distracting apps from your iPhone permanently without a 3rd party app. Free and open source.
Block now (100% free) →
Granola, the best AI meeting recorder
Granola, the best AI meeting recorder
Notes, actions and memory. Without a meeting bot. First month 100% off.
Download for free →
belt - the only tool your agent needs
belt - the only tool your agent needs
belt cli automatically finds the best tools and skills for your agent. image, video, music, tts...
one prompt install →
Open Steps
Open Steps
Free an open-source skills that make AI coding agents easier to understand, verify, and control.
Download for free →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →
Agent, connect blockchain
Agent, connect blockchain
Connect your Claude agent to live crypto prices and trading routes via 1inch
Get the MCP →

402-mcp

Nostr: npub1mgvlrnf5hm9yf0n5mf9nqmvarhvxkc6remu5ec3vf8r0txqkuk7su0e7q2

MIT licence TypeScript Node Coverage Nostr GitHub Sponsors

L402 client MCP that gives AI agents economic agency. Discover, pay for, and consume Lightning and ecash payment-gated APIs within limits you set: no human registration, no API keys, no middlemen.

  • Discover paid APIs on Nostr — no URLs needed upfront
  • Auto-pay with Lightning (NWC), Cashu ecash, LNURLcash bearer notes, or human QR fallback
  • Credentials cached and encrypted at rest (AES-256-GCM)
  • Works with any L402 server — toll-booth, Aperture, or any future implementation

Quick start

1. Install

npx 402-mcp

2. Connect to Claude Code

claude mcp add 402-mcp -- npx 402-mcp

3. Try it

Ask Claude: "Search for paid joke APIs using l402-search" — no wallet needed, just discovery.

Ready to make paid calls? See the full quickstart guide to set up a wallet and watch your agent pay for its first API call.

Requires Node.js 22 or newer.

How it works

graph LR
    A["1. l402-config()"] --> B["2. l402-discover(url)"]
    B --> C["3. Agent reasons<br/>about pricing"]
    C --> D["4. l402-buy-credits()<br/>or l402-fetch()"]
    D --> E["5. l402-fetch(url)<br/>with credentials"]
    E --> F["6. Data returned<br/>+ balance cached"]

Example session:

Agent: "I need routing data from routing.example.com"

1. l402-config()
   -> nwcConfigured: true, maxAutoPaySats: 1000

2. l402-discover("https://routing.example.com/api/route")
   -> 10 sats/request, toll-booth detected, tiers available

3. Agent reasons: "I need ~20 requests. The 500-sat tier
   gives 555 credits. Better value."

4. l402-buy-credits(url, amountSats=500)
   -> Paid 500 sats, received 555 credits

5. l402-fetch("https://routing.example.com/api/route?from=...&to=...")
   -> 200 OK, route data, 545 credits remaining

For detailed architecture and payment flow diagrams, see docs/architecture.md.

Configuration

VariableDefaultDescription
NWC_URI_FILE-Path to a private 0600 file containing the NWC bearer URI
CASHU_TOKENS-Path to Cashu token store file
LNURLCASH_NOTES-Path to LNURLcash bearer note store file (LUD-25)
MAX_AUTO_PAY_SATS1000Most a single automatic payment may cost. Anything dearer is not paid; the challenge goes back to the agent
MAX_SPEND_PER_MINUTE_SATS10000Automatic spend allowed in any rolling 60 seconds. 0 blocks all auto-pay
MAX_SPEND_PER_DAY_SATS5000Automatic spend allowed in any rolling 24 hours, kept in ~/.402-mcp/spend-ledger.json so a restart does not reset it. 0 blocks all auto-pay
CREDENTIAL_STORE~/.402-mcp/credentials.jsonPersistent macaroon/credential storage
TRANSPORTstdioTransport mode: stdio or http
PORT3402HTTP server port (when TRANSPORT=http)
BIND_ADDRESS127.0.0.1HTTP bind address
HTTP_AUTH_TOKEN_FILE-Private 0600 file holding the bearer token HTTP clients must send. Required when TRANSPORT=http
HTTP_ALLOWED_HOSTS-Extra Host header values the HTTP transport accepts (comma-separated), such as a reverse proxy's name
TRANSPORT_PREFERENCEonion,hns,https,httpPreferred transport order for multi-URL services (comma-separated)
TOR_PROXY-SOCKS5 proxy for .onion addresses only (e.g. socks5h://127.0.0.1:9050)
SOCKS_PROXY-SOCKS5 proxy for every paid-API request (e.g. Tor at socks5h://127.0.0.1:9050). Set this or TOR_PROXY, not both
HNS_GATEWAY_URLhttps://query.hdns.io/DNS-over-HTTPS resolver used for Handshake names. Any host name that ordinary DNS cannot find is looked up here

Transport selection and fallback

When a kind 31402 event advertises multiple URLs (one per transport), 402-mcp selects the best one based on your configuration:

  1. Preference first: URLs are tried in TRANSPORT_PREFERENCE order, onion,hns,https,http by default. Use onion, hns, https and http as the values. A URL counts as hns when its TLD is .hns. One whose TLD is merely unfamiliar (.pub, .fyi) is more likely an ICANN name, so it is tried just after https.
  2. Capability filter: .onion URLs are skipped unless TOR_PROXY or SOCKS_PROXY is set, so without a proxy the default order starts at HNS and clearnet.
  3. Availability fallback: if a transport is unreachable (connection refused, timeout), the next URL is tried.

Services can announce multiple endpoints for the same service (same pricing, same macaroon key) on different transports. This is purely for censorship resistance; you do not need to re-authenticate when switching transports. To reach Tor or HNS endpoints you must configure the corresponding proxy/gateway env vars above.

Tor and SOCKS5

  • TOR_PROXY sends .onion requests through the proxy. Everything else connects directly.
  • SOCKS_PROXY sends every request to a paid API through the proxy, including redirects. Host names are resolved by the proxy, never by this machine, so a Tor proxy hides both your IP and the names you look up. The SSRF guard still refuses private IP literals and local names such as localhost; it cannot see what a name resolves to on the far side, which Tor exits refuse for private ranges anyway.

Neither setting covers wallet or discovery traffic: NWC relays, Cashu and LNURLcash mints, and the Nostr relays l402-search queries still connect directly. Handshake lookups are switched off under SOCKS_PROXY, because the DNS-over-HTTPS query would go around the proxy.

SOCKS5 support comes from undici's Socks5ProxyAgent, which Node marks experimental; expect one ExperimentalWarning on stderr when a proxy is configured.

Tools

Core L402 (any server)

ToolDescription
l402-configIntrospect payment capabilities (wallets, limits, credential count)
l402-discoverProbe an endpoint to discover pricing without paying
l402-fetch-previewShow what an endpoint costs without paying; drives the payment confirmation widget
l402-fetchHTTP request that pays a 402 challenge when autoPay is set and the price is within the limits
l402-payPay a challenge returned by l402-fetch or l402-discover, by its payment hash. Any other invoice needs the human's approval
l402-reconcileList or resolve payments whose outcome is unknown; auto-pay to that service is paused until they are resolved
l402-credentialsList stored credentials and cached balances
l402-balanceCheck cached credit balance for a server
l402-searchDiscover L402 services on Nostr relays (kind 31402 announcements)
l402-store-tokenStore an L402 token obtained from a payment page

Widgets (MCP Apps hosts)

ToolDescription
l402-service-directoryInteractive, searchable directory of services found by l402-search
l402-wallet-dashboardInteractive view of wallet status, limits and stored credentials

l402-fetch-preview also has a payment confirmation widget.

toll-booth extensions

ToolDescription
l402-buy-creditsBrowse and purchase volume discount tiers
l402-redeem-cashuRedeem Cashu tokens directly (avoids Lightning round-trip)

Payment methods

Four payer methods, tried in priority order:

  1. NWC (Nostr Wallet Connect) — fully autonomous; pays from your connected wallet
  2. Cashu — fully autonomous; melts ecash tokens to pay invoices
  3. LNURLcash: fully autonomous; melts LUD-25 bearer notes to pay invoices
  4. Human-in-the-loop — presents QR code, polls for settlement

The agent can override the method per-call, or you can configure only the methods you want.

l402-fetch handles four HTTP 402 challenge variants, plus an experimental x402 format:

ProtocolChallenge headerPayment
L402WWW-Authenticate: L402Lightning invoice via wallet stack
IETF Payment (draft-ryan-httpauth-payment-01)WWW-Authenticate: PaymentLightning invoice via wallet stack
LNURLcash (LUD-25)X-LNURLcash: lnurlcashreq1…Bearer note handed over directly (requires a note store)
xCashu (NUT-18)X-Cashu: creqA…Ecash token sent directly (requires Cashu wallet)
x402 (experimental, custom format)X-Payment-Required: x402 + JSON bodyA custom format, not the x402 specification (whose servers send a base64 PAYMENT-REQUIRED header), so real x402 services are not supported. Payment details are shown to the human, who pays from their own wallet

An LNURLcash challenge is tried first. A bearer note is already money in hand, so paying one costs no Lightning hop and no swap at the mint: the note goes straight into the retry header and the server settles it. When the price does not match a note exactly, one is split at the mint and the change stays in the store. If no note covers it, the other rails are tried as usual.

Spending limits

402-mcp checks every automatic payment against these, and the agent can read them with l402-config:

  • MAX_AUTO_PAY_SATS caps each payment. A dearer challenge is returned to the agent unpaid.
  • maxCostSats on l402-fetch lowers that cap for one call, so the price shown by l402-fetch-preview is binding. It can never raise it.
  • MAX_SPEND_PER_MINUTE_SATS and MAX_SPEND_PER_DAY_SATS cap total automatic spend over rolling windows. The daily window is persisted, so restarting the server does not reset it. 0 in either blocks auto-pay entirely.
  • A payment whose outcome is unknown pauses auto-pay to that service until l402-reconcile resolves it, so the same thing is not bought twice.

The real hard limit is the budget on your NWC connection. Everything above is enforced in software by this process, on the machine it runs on. Most NWC wallets let you set a spending budget when you create the connection; set one, because that is the limit a bug or a misbehaving agent cannot raise. For Cashu and LNURLcash, the hard limit is what you put in the token or note store.

Privacy

402-mcp stores credentials locally on your machine only (~/.402-mcp/credentials.json, encrypted at rest). There are no accounts, no tracking and no analytics, and 402-mcp has no server of its own. It does talk to parties other than the APIs you call:

  • Nostr relays. l402-search subscribes to public relays (by default relay.damus.io, relay.primal.net and nos.lol) for service announcements, sending any topic or payment-method filter you give it. The query text itself is matched locally.
  • A Handshake resolver. When ordinary DNS cannot find a host name, it is looked up at HNS_GATEWAY_URL (https://query.hdns.io/ by default), which therefore sees that name. This is off under SOCKS_PROXY.
  • Your wallet's services. NWC relays, Cashu mints and LNURLcash mints see the payments you make through them.

Payments use Lightning or ecash, which are pseudonymous rather than anonymous.

Ecosystem

Browse live L402 services at 402.pub — the decentralised marketplace for payment-gated APIs.

ProjectRole
toll-boothPayment-backend agnostic HTTP 402 middleware
satgatePay-per-token AI inference proxy (built on toll-booth)
402-mcpMCP client: AI agents discover, pay for and consume L402 APIs
402-announcePublish L402 services on Nostr for decentralised discovery

402-mcp is the wallet-provider agnostic alternative to Lightning Labs' lightning-agent-tools: no Lightning node required, multiple wallets, encrypted credentials.

Full comparison
402-mcpLightning Labs agent tools
Payer methodsNWC + Cashu + LNURLcash + human fallbackLightning only
Node required?No — connects to any NWC walletYes — runs LND
Server compatibilityAny L402 serverAperture-focused
Spend safetyPer-payment cap, per-call max cost, rolling 60s and persisted 24h windowsPer-call max-cost
Credential storageEncrypted at rest (AES-256-GCM)File permissions
PrivacyNo PII, SSRF protection, error sanitisationStandard

Use Lightning Labs' tools if you want agents that run their own Lightning node. Use 402-mcp if you want agents that pay from any wallet without infrastructure.

See CONTRIBUTING.md for development setup and guidelines.


Built by @forgesworn.

  • Lightning tips: profusemeat89@walletofsatoshi.com
  • Nostr: npub1mgvlrnf5hm9yf0n5mf9nqmvarhvxkc6remu5ec3vf8r0txqkuk7su0e7q2

Part of the ForgeSworn Toolkit

ForgeSworn builds open-source cryptographic identity, payments, and coordination tools for Nostr.

LibraryWhat it does
nsec-treeDeterministic sub-identity derivation
ring-sigSAG/LSAG ring signatures on secp256k1
range-proofPedersen commitment range proofs
canary-kitCoercion-resistant spoken verification
spoken-tokenHuman-speakable verification tokens
toll-boothL402 payment middleware
geohash-kitGeohash toolkit with polygon coverage
nostr-attestationsNIP-VA verifiable attestations
dominionEpoch-based encrypted access control
nostr-veilPrivacy-preserving Web of Trust

Licence

MIT

Wildbloom storage discovery

l402-search also recognises the signed forgesworn-storage-service-v1 profile (kind 31402, shared 402-announce/storage 2.3.0). Paid results identify storage.paymentFlow: "wildbloom-checkout-v1" and autoPaySupported: false. Free shelter accepts authorised mirrors with best-effort evictable retention, not unknown-user direct uploads. The tool contacts only the requested relays; service terms are untrusted operator claims, not recommendations or uptime proof.

Latest valid signed records are selected before expiry/withdrawal/query filtering; equal timestamps use the lowest event ID. Up to 2,000 watermarks are retained in memory per registered search handler across calls, without silently evicting withdrawals. A new handler/process has no memory of records omitted by a relay. Full/paused current listings remain descriptive results; expired/withdrawn ones remain watermarks but are not returned as current offers. No browser, ledger or credential persistence is added by discovery.

Pass the result payment flow to l402-fetch or l402-pay: Wildbloom checkout is explicitly refused before dependency, network, credential or wallet access. l402-fetch also refuses /checkout/v1 paths. Review current /services/v1 separately and use Wildbloom for a bound private NIP-98 quote and explicit payment. The automatic paid-API tools do not implement Wildbloom checkout, free mirroring or an upload allowance. Signature validation does not authorise a purchase.

Featured
CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Lid closed, agents working
Lid closed, agents working
Keeps your Mac awake while Claude Code, Codex or Cursor works. Lets it sleep when they are done.
Try free for 7 days →
Block distraction from your iPhone for freeBlock distraction from your iPhone for free
Block distraction from your iPhone for free
Block distracting apps from your iPhone permanently without a 3rd party app. Free and open source.
Block now (100% free) →
Granola, the best AI meeting recorder
Granola, the best AI meeting recorder
Notes, actions and memory. Without a meeting bot. First month 100% off.
Download for free →
belt - the only tool your agent needs
belt - the only tool your agent needs
belt cli automatically finds the best tools and skills for your agent. image, video, music, tts...
one prompt install →
Open Steps
Open Steps
Free an open-source skills that make AI coding agents easier to understand, verify, and control.
Download for free →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →
Agent, connect blockchain
Agent, connect blockchain
Connect your Claude agent to live crypto prices and trading routes via 1inch
Get the MCP →

Configuration

NWC_URIsecret

Nostr Wallet Connect URI for autonomous Lightning payments

MAX_AUTO_PAY_SATS

Maximum sats to auto-pay per request

Registryactive
Package402-mcp
TransportSTDIO
AuthRequired
UpdatedApr 7, 2026
View on GitHub

More from forgesworn

  • Bray
  • Rendezvous Mcp