Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

402-mcp

MCP server by forgesworn Verified · forgesworn.dev

402-mcp is an MCP server that lets AI agents find, pay for and call Lightning and ecash payment-gated APIs. Spending stays within limits the user sets. It suits people who want their AI assistant to use paid APIs without registering or managing API keys.

  • Score 84
  • 0 stars
  • 345 a week
  • MIT
  • Updated

Install 402-mcp

Built from the published package, never by AI.

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

Run in your terminal. Add --scope user to use it in every project.

Step-by-step: install 402-mcp in Claude Code

MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the 402-mcp block.

About

402-mcp is an L402 client MCP server. It lets AI agents discover paid APIs on Nostr, pay for calls, and consume the data returned. Payment options include Lightning through Nostr Wallet Connect (NWC), Cashu ecash, LNURLcash bearer notes, or a human QR fallback. Stored credentials are cached and encrypted at rest with AES-256-GCM.

Spending is capped by settings the user chooses, including a maximum per automatic payment, a per-minute limit and a rolling daily limit. The server works with any L402 server, such as toll-booth or Aperture. It is aimed at people who want an AI assistant to use paid APIs within set limits, without human registration or API keys.

Written from the project's README and checked against it.

Tools it gives your assistant

  • l402-configIntrospects payment capabilities, including wallets, limits and credential count.
  • l402-searchDiscovers paid APIs listed on Nostr, without needing URLs up front.
  • l402-discoverProbes an endpoint to discover its pricing without paying.
  • l402-fetch-previewShows what an endpoint costs without paying.
  • l402-fetchSends an HTTP request and pays a 402 challenge when autoPay is set and the price is within limits.
  • l402-buy-creditsBuys a credit balance from a service so later calls use the stored credential.
  • l402-payPays a challenge by its payment hash. Other invoices need the human's approval.
  • l402-reconcileLists or resolves payments with unknown outcomes and pauses auto-pay until they are resolved.
  • l402-credentialsLists stored credentials and cached balances.

What you need

  • Node.js 22.4 or newer
  • An NWC wallet with pay_invoice permission and a spending budget, for paid calls
  • A wallet that supports NIP-44 v2 encryption
SettingNeededWhat it is
NWC_URIEnvironment variable, secretOptionalNostr Wallet Connect URI for autonomous Lightning payments
MAX_AUTO_PAY_SATSEnvironment variableOptionalMaximum sats to auto-pay per request

From the publisher's entry in the official MCP Registry. Required settings are already in the install config below as placeholders.

Try asking

  • Search for paid joke APIs using l402-search
  • Check what this paid endpoint costs before paying with l402-fetch-preview
  • Show my stored L402 credentials and cached balances

Good to know

  • Paid calls need an NWC, Cashu or LNURLcash wallet, and the wallet must support NIP-44 v2 for NWC.
  • A raw NWC_URI variable is refused; the URI must be read from a private file.
  • Auto-pay to a service is paused while any payment outcome is unknown.
  • SOCKS5 proxy support is marked experimental by Node and prints an ExperimentalWarning.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: README.md, package.json. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to 402-mcp

All alternatives →
mcp stripe
96

Connects AI assistants to Stripe through the hosted Stripe MCP server at mcp.stripe.com. It is for developers building AI-powered products and businesses on Stripe.

AAA Remote 2.1k
TradingMCPatilaahmettaner
94

Gives AI assistants market data, technical analysis, backtests, options activity and news sentiment for stocks, crypto, FX and metals. Built for traders and developers using Claude, ChatGPT, Cursor or other MCP clients. Its outputs are informational, not financial advice.

AAA Remote 5.4k
CCXTccxt
94

CCXT is an official MCP server for market data and trading across more than 100 exchanges and prediction markets. It is aimed at developers, traders and AI agents.

AAA Local 45k
Finance ToolkitJerBouma
94

Calculates over 1400 transparent financial methods from raw statements and exposes them to AI assistants through an MCP server. Suited to analysts and developers who want to see how each metric is computed.

AAA Local and remote 5.6k
Vapi Network MCP vAPI-Network
94

Lets an AI assistant search x402 APIs and pay for them in USDC from a local, non-custodial wallet. Built for people and agents that need to pay APIs per call under spend caps.

AAA Local 6.2k
Finance DatabaseJerBouma
94

Lets AI assistants explore a free database of over 300,000 symbols, including equities, ETFs, funds, indices, currencies and cryptocurrencies, categorised by sector, industry and country. It suits private investors who want to discover products rather than look up fundamentals or stock data.

AAA Local and remote 9.7k

Compare with mcp, TradingMCP or CCXT

402-mcp: common questions

Does 402-mcp need API keys or accounts with each API?

The source says no human registration, no API keys and no middlemen are needed. Payment is made per call to the L402 server.

How does 402-mcp limit how much an agent can spend?

Settings such as MAX_AUTO_PAY_SATS, MAX_SPEND_PER_MINUTE_SATS and MAX_SPEND_PER_DAY_SATS cap automatic spending. Payments above the cap are not made and the challenge is returned to the agent.

Can 402-mcp work over Tor?

Yes. Setting TOR_PROXY or SOCKS_PROXY routes .onion and paid-API requests through a SOCKS5 proxy such as Tor.

How do I install 402-mcp?

In Claude Code run claude mcp add 402-mcp -- npx -y 402-mcp. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.

Is 402-mcp the official server?

402-mcp is published by forgesworn.dev from its verified domain in the official MCP Registry.

Is 402-mcp free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is 402-mcp safe to use?

It scores 84 of 100. Grades: maintenance A, licence A, quality C. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to 402-mcp?

Similar MCP servers: mcp, TradingMCP, CCXT, Finance Toolkit.

Does 402-mcp work with ChatGPT?

Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.

402-mcp Install

Add to stack

Loading.