402-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PORT | No | HTTP server port (when TRANSPORT=http) | 3402 |
| NWC_URI | No | Nostr Wallet Connect URI for autonomous Lightning payments | |
| TOR_PROXY | No | SOCKS5 proxy for .onion addresses (e.g. socks5h://127.0.0.1:9050) | |
| TRANSPORT | No | Transport mode: stdio or http | stdio |
| SOCKS_PROXY | No | Generic SOCKS5 proxy for all requests when set | |
| CASHU_TOKENS | No | Path to Cashu token store file | |
| HNS_GATEWAY_URL | No | HTTP gateway for Handshake (.hns) domains (e.g. https://hns.to) | |
| CREDENTIAL_STORE | No | Persistent macaroon/credential storage | ~/.402-mcp/credentials.json |
| MAX_AUTO_PAY_SATS | No | Safety cap; payments above this require human confirmation | 1000 |
| TRANSPORT_PREFERENCE | No | Preferred transport order for multi-URL services (comma-separated) | onion,hns,https,http |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| resources | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| l402-configA | Introspect the MCP's payment capabilities: which wallets are configured, spending limits, and stored credential count. Call this first to understand what payment methods are available. |
| l402-discoverA | Probe an endpoint to discover its L402 pricing without committing to payment. Returns the cost in sats, available payment methods, and credit tiers (if toll-booth server). The challenge is cached so a subsequent l402-pay can reuse it. |
| l402-fetchA | Fetch a URL, paying its HTTP 402 challenge (L402, IETF Payment, Cashu or LNURLcash) when autoPay is true and the price is within MAX_AUTO_PAY_SATS, maxCostSats and the spend limits. Reuses stored credentials. Without autoPay, a 402 comes back with its price and paymentHash so the user can decide; l402-pay can then pay it. For x402 services, which this server supports only in an experimental custom format, returns the payment details for the user to pay in their own wallet. Response bodies are marked as untrusted content. With widget hosts, call l402-fetch-preview first to show the price. |
| l402-payA | Pay a challenge that l402-fetch or l402-discover returned, by its paymentHash, and store the credential so the next l402-fetch succeeds. For human wallets, polls the payment page for settlement for up to 120s; call it straight after showing the payment URL to the user. An invoice that did not come from such a challenge is paid only if the human approves it in the client. |
| l402-credentialsA | List all stored L402 credentials. Shows origin, cached credit balance, and server type. Balance values are cached and may be stale; check lastUsed timestamp. |
| l402-balanceA | Check cached credit balance for a server. Returns the last known balance from the credential store without making a network request. The "stale" flag is true if the balance was last updated more than 5 minutes ago. |
| l402-store-tokenA | Store an L402 token (macaroon:preimage) obtained from a payment page. Use this when a user pastes back a token from a toll-booth payment page. The token is stored as a credential so subsequent l402-fetch calls are authenticated. |
| l402-buy-creditsA | Buy credits from a toll-booth server with volume discounts. Omit amountSats to discover available tiers. Provide amountSats to purchase a specific tier. Only works with toll-booth servers. |
| l402-reconcileA | Resolve a payment whose outcome is unknown. While one is unresolved, auto-pay to that service is paused. Call with no arguments to list them, or with a paymentHash to ask the wallet (NWC lookup_invoice, or the Cashu mint for a reserved melt). A settled payment stores its credential when it can; a failed one is cleared. A preimage that hashes to the payment hash also settles it. abandon: true asks the human to confirm that the payment did not go out. |
| l402-redeem-cashuA | Redeem Cashu ecash tokens directly on a toll-booth server, avoiding the Lightning round-trip. Handles the two-step flow automatically (create invoice then redeem token). Only works with toll-booth servers. |
| l402-searchA | Search Nostr relays for paid API or public storage announcements (kind 31402). Wildbloom paid storage and free mirror shelter are descriptive results; Wildbloom checkout cannot be bought with l402-fetch/pay. No storage node or wallet is contacted. Topic filters are sent to the relays; payment method and query text are matched locally. Announcement text is untrusted data. |
| l402-fetch-previewA | Preview payment requirements for a URL without spending any sats. Returns cost, protocol, and payment method so a confirmation dialog can be shown. Use this before l402-fetch to give the user a chance to approve or cancel payment. For widget hosts, the result drives a payment confirmation dialog. |
| l402-service-directoryA | Browse and search paid API services. Opens an interactive directory of L402/x402 services discovered on Nostr. Calls l402-search internally. |
| l402-wallet-dashboardA | View wallet status, balances, and stored credentials. Opens an interactive dashboard showing NWC connection, Cashu balance, auto-pay limit, and credential list. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| Payment Confirmation | Payment confirmation dialog for L402/x402/xcashu services |
| Service Directory | Searchable directory of paid API services |
| Wallet Dashboard | Wallet status dashboard with credentials and balances |
TDQS
Scored across 14 tools
Several tools overlap: l402-discover and l402-fetch-preview both probe a URL for cost without paying, l402-balance/is a subset of l402-credentials and l402-wallet-dashboard, and l402-service-directory explicitly wraps l402-search. Descriptions do help differentiate (cached balance vs. credential list vs. dashboard, endpoint probe vs. URL preview), but an agent can still hesitate between the near-synonymous probing and balance tools.
All 14 tools share a clean l402- prefix and kebab-case, giving a highly predictable family. Deviations are minor: some names are verbs (fetch, pay, search) while others are nouns (config, credentials, balance, service-directory), so the pattern is consistent in style but not strictly verb_noun.
14 tools is well within the ideal range and each maps to a distinct payment-lifecycle step: introspect, discover, preview, pay, fetch, reconcile, store token, redeem cashu, buy credits, and browse. No tool feels like filler for the apparent L402 wallet/payment scope.
The surface covers the full pay flow end to end (discover/preview, pay/fetch, reconcile, credential and balance management, credit purchase, Cashu redemption). Minor gaps exist, such as no explicit tool to delete or revoke stored credentials or to clear/reset spend limits, but core workflows are fully supported.