Skip to main content
Glama

402-mcp

Nostr: npub1mgvlrnf5hm9yf0n5mf9nqmvarhvxkc6remu5ec3vf8r0txqkuk7su0e7q2

MIT licence TypeScript Node Coverage Nostr GitHub Sponsors

L402 + x402 client MCP that gives AI agents economic agency. Discover, pay for, and consume any payment-gated API — 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.

Related MCP server: Loop MCP DualRail

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.trotters.cc"

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

2. l402-discover("https://routing.trotters.cc/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.trotters.cc/api/route?from=...&to=...")
   -> 200 OK, route data, 545 credits remaining

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

Configuration

Variable

Default

Description

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_SATS

1000

Safety cap; payments above this require human confirmation

CREDENTIAL_STORE

~/.402-mcp/credentials.json

Persistent macaroon/credential storage

TRANSPORT

stdio

Transport mode: stdio or http

PORT

3402

HTTP server port (when TRANSPORT=http)

TRANSPORT_PREFERENCE

onion,hns,https,http

Preferred transport order for multi-URL services (comma-separated)

TOR_PROXY

-

SOCKS5 proxy for .onion addresses (e.g. socks5h://127.0.0.1:9050)

SOCKS_PROXY

-

Generic SOCKS5 proxy for all requests when set

HNS_GATEWAY_URL

-

HTTP gateway for Handshake (.hns) domains (e.g. https://hns.to)

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 — if TRANSPORT_PREFERENCE=tor and a .onion URL is available, it is tried first.

  2. Availability fallback — if the preferred transport is unreachable (proxy not configured, timeout), the client falls back to the next URL in the list.

  3. Clearnet default — if no preference is set, clearnet URLs are tried before .onion or HNS entries.

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.

Tools

Core L402 (any server)

Tool

Description

l402-config

Introspect payment capabilities (wallets, limits, credential count)

l402-discover

Probe an endpoint to discover pricing without paying

l402-fetch

HTTP request with L402 support; auto-pays if within budget

l402-pay

Pay a specific invoice (NWC, Cashu, or human-in-the-loop)

l402-credentials

List stored credentials and cached balances

l402-balance

Check cached credit balance for a server

l402-search

Discover L402 services on Nostr relays (kind 31402 announcements)

l402-store-token

Store an L402 token obtained from a payment page

toll-booth extensions

Tool

Description

l402-buy-credits

Browse and purchase volume discount tiers

l402-redeem-cashu

Redeem 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 five HTTP 402 challenge variants transparently:

Protocol

Challenge header

Payment

L402

WWW-Authenticate: L402

Lightning invoice via wallet stack

IETF Payment (draft-ryan-httpauth-payment-01)

WWW-Authenticate: Payment

Lightning 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

X-Payment-Required: x402

On-chain EVM transfer; surfaced to human with EIP-681 deeplink

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.

Safety

MAX_AUTO_PAY_SATS caps any single autonomous payment. Above this limit, the agent must ask the human for approval. The agent can read this limit via l402-config and factor it into purchasing decisions.

Privacy

402-mcp stores credentials locally on your machine only (~/.402-mcp/credentials.json, encrypted at rest). No data is sent to any third party. No accounts, no tracking, no analytics. Payments use Lightning or Cashu — pseudonymous by design.

Ecosystem

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

Project

Role

toll-booth

Payment-backend agnostic HTTP 402 middleware

satgate

Pay-per-token AI inference proxy (built on toll-booth)

402-mcp

MCP client — AI agents discover, pay, and consume L402 + x402 APIs

402-announce

Publish L402 services on Nostr for decentralised discovery

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

402-mcp

Lightning Labs agent tools

Payer methods

NWC + Cashu + human fallback

Lightning only

Node required?

No — connects to any NWC wallet

Yes — runs LND

Server compatibility

Any L402 server

Aperture-focused

Spend safety

Per-payment cap + rolling 60s window

Per-call max-cost

Credential storage

Encrypted at rest (AES-256-GCM)

File permissions

Privacy

No PII, SSRF protection, error sanitisation

Standard

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.

Library

What it does

nsec-tree

Deterministic sub-identity derivation

ring-sig

SAG/LSAG ring signatures on secp256k1

range-proof

Pedersen commitment range proofs

canary-kit

Coercion-resistant spoken verification

spoken-token

Human-speakable verification tokens

toll-booth

L402 payment middleware

geohash-kit

Geohash toolkit with polygon coverage

nostr-attestations

NIP-VA verifiable attestations

dominion

Epoch-based encrypted access control

nostr-veil

Privacy-preserving Web of Trust

Licence

MIT

Available Tools

11 tools
l402-balanceA
Read-only

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
originYesThe server origin (e.g. https://api.example.com)

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses key behaviors beyond the readOnlyHint annotation: it returns 'last known balance' from a credential store, performs no network request, and explains the condition for the 'stale' flag (updated more than 5 minutes ago). This adds meaningful context that annotations alone don't provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences deliver all essential information: the action, the caching behavior, and the staleness rule. Every sentence earns its place with no redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool with no output schema, the description explains the return concept (balance and stale flag) sufficiently well. It stops short of detailing the full response structure or edge cases (e.g., no cached value), but given the simplicity, this is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and the only parameter 'origin' already has a clear description with a URI format and example. The description adds no additional parameter-specific meaning, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Check cached credit balance for a server.' It distinguishes this tool from siblings by emphasizing that it uses a cached value and makes no network request, which sets it apart from other l402 tools like l402-fetch or l402-pay.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies when to use this tool: when you want a fast, cached balance check without network overhead. However, it doesn't explicitly name alternatives or state when not to use it, so it lacks explicit exclusions that would merit a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

l402-buy-creditsA
Destructive

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesThe toll-booth server URL
methodNoPayment method override
amountSatsNoAmount in sats to purchase. Omit to list available tiers.

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already flag destructiveHint=true and openWorldHint=true, so the safety profile is handled. The description adds the mode behavior and the toll-booth restriction, but it does not clarify side effects of a purchase, such as spending funds, irreversibility, or error/response behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences front-load the purpose and immediately state the key branching behavior. Minor redundancy exists between 'from a toll-booth server' and 'Only works with toll-booth servers,' but overall it is tight.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a three-parameter tool with no nested objects, core invocation is covered: required URL, optional method, optional amountSats, and the toll-booth constraint. However, there is no output schema and the description does not say what a successful purchase or tier-discovery response contains, which is a notable gap for a financial operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The narrative about omitting/providing amountSats adds a little clarity, but it largely repeats the schema's description of amountSats and does not enrich method or url beyond what the schema already says.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific action ('Buy credits') and identifies the resource ('a toll-booth server') and a differentiator ('volume discounts'). It distinguishes this from sibling payment tools by restricting it to toll-booth servers, though it never names a sibling explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit branching guidance: omit amountSats to discover tiers, provide amountSats to buy a specific tier, and only works with toll-booth servers. This gives clear when-to-use context, but it does not compare against siblings such as l402-pay or l402-discover, so it falls just short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

l402-configA
Read-only

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.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare readOnlyHint=true, which the description aligns with by using 'Introspect'. The description adds value beyond the annotation by revealing what kind of read-only data is returned: wallet configuration, spending limits, and credential count. No hidden mutation or side effects are suggested.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two tight sentences with no filler. The first sentence states exactly what the tool does and its outputs; the second gives actionable usage guidance. Every clause earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no parameters and no output schema, the description sufficiently explains what the tool returns at a categorical level. It could be more explicit about output format or whether any setup is required, but for a zero-input introspection tool it is adequately complete for an agent to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, so there is no schema burden to compensate for. The description accurately describes the tool's no-input introspection behavior, and the baseline of 4 is appropriate since no parameter documentation is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description uses specific verb 'Introspect' with resource 'payment capabilities' and enumerates concrete outputs: wallets configured, spending limits, stored credential count. The instruction to call this first also distinguishes it from sibling tools like l402-pay or l402-fetch, making its role clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly says 'Call this first to understand what payment methods are available', giving clear context for when to invoke it. It does not explicitly list alternatives or when not to use it, but the sequencing guidance and broad discovery purpose sufficiently differentiate it from siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

l402-credentialsA
Read-only

List all stored L402 credentials. Shows origin, cached credit balance, and server type. Balance values are cached and may be stale; check lastUsed timestamp.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The readOnlyHint annotation already marks it safe, and the description adds genuinely useful behavior: balances are cached and possibly stale, and the lastUsed timestamp is the way to judge freshness. This is beyond the annotation and gives the agent a realistic expectation of data reliability. No contradiction exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two tight sentences front-load the action and displayed fields, then add the stale-balance caveat. Every sentence carries operational value, and no redundant filler is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, read-only listing tool, this description is complete: it says what is listed, what fields are shown, and warns about cache freshness. The lack of an output schema is mitigated by naming the visible fields, and there are no params/options whose behavior would need elaboration.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema is empty (0 parameters), so there are no parameter semantics for the description to enrich. With schema coverage at 100%, the description cannot add anything parameter-related, and the baseline of 4 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States the action ('List all stored L402 credentials') and the resource/scope precisely, then names the displayed fields (origin, cached credit balance, server type). This distinguishes it from siblings like l402-store-token or l402-balance by focusing on stored credentials rather than operations or current balance.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: an agent can infer this is for inspecting stored credentials, and the 'cached/may be stale' caveat hints that l402-balance might be the alternative for fresh numbers. However, it never explicitly states when to prefer this tool or names an alternative, so it stops short of clear routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

l402-discoverA
Read-only

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL to probe for L402 pricing
methodNoHTTP method to useGET

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With readOnlyHint=true and openWorldHint=true already present, the description adds meaningful behavioral details: no payment is committed, the challenge is cached for later reuse, and responses include pricing and payment-method information. It does not contradict the annotations and gives enough context for safe usage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and front-loaded: the core action appears first, followed by return-value highlights and the caching behavior. Every sentence earns its place without fluff or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple probe tool with one required parameter and no output schema, the description covers what the tool returns, when to use it, and the relevant caching side effect. It does not specify failure behavior or non-L402 endpoints, but those are minor gaps given the overall clarity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents both parameters and their defaults. The description reinforces that 'url' is the endpoint being probed but adds little about 'method' beyond what the schema provides. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Probe') and resource ('endpoint') and states the purpose: discover L402 pricing without payment. It also names concrete outputs (cost in sats, payment methods, credit tiers) and distinguishes itself from l402-pay by mentioning challenge caching. This makes the tool's role clear even among many siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies the tool is a pre-payment discovery step: 'without committing to payment' and 'a subsequent l402-pay can reuse it' provide strong context for when to use it. It does not explicitly enumerate exclusions or alternative tools, but the intended workflow is evident.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

l402-fetchA
Destructive

Fetch a URL with automatic payment handling (L402 Lightning + x402 on-chain + ecash and LUD-25 bearer notes). Manages credentials, pays automatically when autoPay is true and cost is within budget, and retries. For human wallets, returns a payment page URL or QR code. For x402 services, returns payment details (receiver address, network, asset, amount) — the user pays in their wallet and provides the transaction hash. Set autoPay to true for seamless access. When a 402 is returned with tiers, present the pricing options to the user and use l402-buy-credits to purchase their chosen tier. For widget hosts, call l402-fetch-preview first to show a payment confirmation dialog before spending.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesThe primary URL to request. When using search results, pass the first URL here and all URLs in the urls field.
bodyNoRequest body (for POST/PUT)
urlsNoAll transport URLs from l402-search results (clearnet, onion, HNS). When present, transports are tried in preference order with automatic fallback on connection failure.
methodNoHTTP methodGET
pubkeyNoService pubkey from l402-search results — used to share credentials across all transport URLs for the same service
txHashNoTransaction hash from a completed x402 on-chain payment. When provided, retries the request with X-Payment header for server verification.
autoPayNoAutomatically pay if within MAX_AUTO_PAY_SATS budget
headersNoAdditional request headers

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only signal openWorldHint and destructiveHint; the description carries the burden and does so well. It discloses that the tool manages credentials, pays automatically when autoPay is true and cost is within budget, retries, and returns different payment artifacts depending on wallet type. This goes far beyond the generic annotations and warns of spending behavior without contradicting them.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense and front-loaded, with each sentence contributing to core behavior or routing. It is longer than strictly necessary—'Set autoPay to true for seamless access' partly repeats the schema—but the extra scenario-based guidance is earned rather than filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex, spend-capable tool with no output schema, the description covers the high-risk and non-obvious payment paths: automatic payment, human-wallet returns, x402 verification via txHash, tier handling, and preview flow. It does not explicitly describe the normal successful fetch response body or exact retry/budget limits, but it provides enough context for correct invocation in the main scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds value by explaining the behavioral effect of autoPay (automatic payment within budget), txHash (replays the request with X-Payment header), and how responses differ for human wallets vs x402 services. It does not add much for url, body, method, headers, or pubkey, but those are already well-described in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific action: 'Fetch a URL with automatic payment handling' and enumerates the supported payment protocols (L402 Lightning, x402 on-chain, ecash and LUD-25). It also differentiates itself from siblings by routing tiered payments to l402-buy-credits and widget-host flows to l402-fetch-preview, so an agent can distinguish it without opening other tool definitions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit if-then usage guidance: when a 402 response includes tiers, present pricing and use l402-buy-credits; widget hosts should call l402-fetch-preview first. It also explains when autoPay should be true and distinguishes human-wallet flows from x402 flows, which is strong practical routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

l402-fetch-previewA
Read-only

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesURL to preview payment requirements for
urlsNoBatch: multiple URLs to preview
methodNoHTTP methodGET
pubkeyNoNostr pubkey for xcashu auth
headersNoAdditional request headers

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, so the description's claim of 'without spending any sats' reinforces but adds specific meaning (no financial side effect). It also describes what the tool returns (cost, protocol, payment method) and the intended UI usage, which goes beyond the annotation. However, it does not mention potential errors or connection issues, a minor gap given the annotations cover safety.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the primary purpose, and no filler. The usage guidance is embedded efficiently. Every clause earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a preview tool with read-only annotations, the description covers the core purpose, return data, and usage context. It does not describe the exact output schema (since none exists), but that is compensated by stating the key fields. Minor gaps like error handling or authentication requirements are not addressed, but given the simplicity, it is largely complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so each parameter is already documented. The description adds no parameter-specific usage detail beyond what the schema provides. It does not explain how to format arrays or headers, but the schema already covers that. Thus, baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Preview'), resource ('payment requirements for a URL'), and outcome ('without spending any sats'). It clearly distinguishes from l402-fetch by positioning itself as a pre-check. The purpose is unambiguous and actionable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly instructs to 'Use this before l402-fetch' and gives the condition (to give the user a chance to approve or cancel payment). Also mentions the widget host context. This directly routes the agent to the correct tool and tells when not to use the alternative.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

l402-payA
Destructive

Confirm payment and store credentials. Call this after l402-fetch returns a 402 with a paymentHash — polls the payment server for settlement (up to 30s for human wallet), then stores the credential so the next l402-fetch succeeds. For human wallets, call this immediately after showing the payment URL to the user.

ParametersJSON Schema
NameRequiredDescriptionDefault
methodNoPayment method override. Defaults to wallet priority: NWC > Cashu > LNURLcash > human.
invoiceNoBOLT-11 invoice to pay. Optional if paymentHash matches a cached challenge from l402-discover.
macaroonNoMacaroon from the L402 challenge. Optional if paymentHash matches a cached challenge.
paymentHashNoPayment hash to look up cached challenge from l402-discover.

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations, the description discloses meaningful runtime behavior: it 'polls the payment server for settlement' and can block 'up to 30s for human wallet,' and it stores a credential as a side effect. This adds real context about latency and state mutation without contradicting the openWorldHint/destructiveHint annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences with no filler. It front-loads the essential action, then gives the triggering condition, timing behavior, and a human-wallet special case. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a consequential payment tool with no output schema, the description covers preconditions, blocking behavior, side effects, and sequencing well. It doesn't describe failure modes or return values, but the annotations and sibling context (l402-fetch, l402-discover) fill most gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters in detail. The description references paymentHash and the cached-challenge flow, but it doesn't add parameter meaning beyond what the input schema provides, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a clear verb+resource pair, 'Confirm payment and store credentials,' and then anchors the tool's role to a concrete trigger: 'Call this after l402-fetch returns a 402 with a paymentHash.' This specific integration point makes it easy to distinguish from siblings like l402-fetch or l402-store-token.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides explicit when-to-use guidance: after l402-fetch returns a 402, and it adds a temporal nuance for human wallets ('call this immediately after showing the payment URL to the user'). It doesn't enumerate alternative tools or explicit when-not-to-use conditions, so it falls just short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

l402-redeem-cashuA
Destructive

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesThe toll-booth server URL
tokenYesCashu token string to redeem (e.g. cashuAey...)

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations, the description reveals an important behavioral trait: it automatically handles the two-step flow of creating an invoice then redeeming the token. It also clarifies that the tool only works against toll-booth servers. It does not detail the destructive consumption of the Cashu token, but destructiveHint=true already signals the mutation risk.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the core purpose, and contains no fluff. The only minor inefficiency is repeating the toll-booth-server constraint in both the first and final sentences.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter tool with no output schema, the description covers the main selection criteria, the target server type, and the internal two-step flow. It does not specify return values or post-redemption behavior, but the annotations and simple parameter surface make this a minor gap rather than a blocking one.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already documents both parameters with 100% coverage, so the baseline is 3. The description adds contextual flow details but no additional parameter-level meaning beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Redeem Cashu ecash tokens directly on a toll-booth server', and adds a clear differentiator by noting it avoids the Lightning round-trip. It also closes with a scope limitation ('Only works with toll-booth servers'), making it easy to distinguish from siblings like l402-pay or l402-fetch.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives useful context for when to choose this tool: it is for direct Cashu redemption on toll-booth servers, avoids Lightning, and automates the two-step flow. It does not explicitly name alternative sibling tools or state 'use X instead', but the toll-booth-only constraint and direct-vs-Lightning framing provide adequate selection guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

l402-store-tokenA
Idempotent

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesThe service URL this token is for
tokenYesThe L402 token in macaroon:preimage format

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds behavioral context beyond the idempotentHint annotation by stating the token is persistently 'stored as a credential' and that this makes subsequent l402-fetch calls authenticated. It does not contradict the annotations; the readOnlyHint=false aligns with the mutation implied by 'Store.'

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with no wasted words. It front-loads the core action, then provides the usage trigger and downstream benefit, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter store operation, the description covers what the token is, where it comes from, and why it matters. It does not describe the return value or error behavior, but given the simple side-effect model and the idempotentHint annotation, this is a minor gap rather than a blocking omission.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already has 100% coverage with clear descriptions for both parameters, including the token format 'macaroon:preimage'. The description reinforces the token format and purpose but does not add meaningfully beyond the schema's parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Store an L402 token (macaroon:preimage) obtained from a payment page.' It also clarifies the token's role as a stored credential for authenticating subsequent l402-fetch calls, making the purpose unambiguous and distinguishable from sibling tools like l402-credentials or l402-fetch.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives an explicit trigger: 'Use this when a user pastes back a token from a toll-booth payment page.' It also explains the downstream effect by noting the token is stored for later l402-fetch authentication, but it does not explicitly mention alternatives or cases where this tool should not be used.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.1/5.0
Disambiguation4/5

Most tools target clearly distinct steps in the L402 flow: discovery, preview, fetch, pay, credentials, balance, and search. However, l402-discover and l402-fetch-preview both check payment requirements without spending, and l402-pay vs l402-store-token have some overlap around credential storage, requiring careful description reading.

Naming Consistency4/5

All tools share the l402- prefix and use lowercase hyphenated names, which makes the set feel cohesive and predictable. There is minor inconsistency in verb style—bare verbs like fetch and pay, verb-noun names like buy-credits and store-token, and noun names like credentials and balance—but the pattern is still easy to follow.

Tool Count5/5

Eleven tools is well within the ideal range for a domain-specific server, and each tool covers a distinct part of the payment lifecycle: discovery, preview, fetch, payment confirmation, credential management, balance checks, credit purchases, cashu redemption, and service search. No tool feels redundant or out of place.

Completeness4/5

The core L402 lifecycle is well covered, including discovery, preview, fetch with autopay, payment confirmation, credential storage, credit purchasing, cashu redemption, and service search. Minor gaps exist, such as no explicit credential deletion/forgetting and no forced balance refresh, but agents can work around these without major failures.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    MCP server that enables AI agents to make autonomous Bitcoin Lightning Network payments using the L402 protocol. Agents can pay for API access, purchase resources, and complete transactions without human intervention — invoice comes in, sats go out, done.
    17
    9
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to pay for MCP tool calls using either Bitcoin/Lightning (L402) or USDC (x402) rails, with unified settlement and a 21% discount for Bitcoin payments.
    32
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server for the x402 protocol that lets AI agents discover and call payment-gated HTTP APIs automatically.
    428
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/forgesworn/402-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server