Skip to main content
MCP server CX Codex

402-mcp — Claude Code MCP server for paid API access

402-mcp lets an agent find L402-protected APIs, pay for access and make requests. It supports Lightning and ecash payment methods.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env NWC_URI=<NWC_URI> --env MAX_AUTO_PAY_SATS=<MAX_AUTO_PAY_SATS> --transport stdio 402-mcp -- npx -y 402-mcp
Open on GitHub

What 402-mcp does

The server lets an agent look for paid APIs on Nostr, check their prices and request data after paying. Payment options include Lightning through NWC, Cashu and LNURLcash; a person can also complete payment through a QR code.

Purchased access credentials are stored for later requests, and settings control automatic spending limits. NWC payments require Node.js 22.4 or newer and a wallet that supports NIP-44 v2 encryption. One setup detail matters: the README says startup rejects the NWC_URI environment variable, while the install commands below set it. HTTP transport is also available and requires an authorization-token file.

What it helps with

  • discover paid APIs on Nostr
  • check the price of an L402 API call
  • pay for API access with Lightning or ecash
  • reuse stored credentials for API requests
  • cap an agent’s automatic spending

Example prompts for the agent

  • Use l402-search to find paid APIs that return routing data.
  • Check this API’s price with l402-discover, then fetch its data if access is paid.
  • Use l402-config to inspect payment settings and stay within the spending limit.

How to install 402-mcp

Platform CLI

claude mcp add --env NWC_URI=<NWC_URI> --env MAX_AUTO_PAY_SATS=<MAX_AUTO_PAY_SATS> --transport stdio 402-mcp -- npx -y 402-mcp

Replace <…> with your own values

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about 402-mcp

How do I install 402-mcp in Claude Code?

Run claude mcp add 402-mcp -e NWC_URI=<NWC_URI> -- npx -y 402-mcp. Alternatively, run claude mcp add --env NWC_URI=<NWC_URI> --env MAX_AUTO_PAY_SATS=<MAX_AUTO_PAY_SATS> --transport stdio 402-mcp -- npx -y 402-mcp.

What does 402-mcp do?

It lets an agent discover L402-protected APIs, pay for access through Lightning or ecash, and make requests using stored credentials.

What is required for NWC auto-pay?

You need Node.js 22.4 or newer and a wallet that supports NIP-44 v2 encryption. The README also says the server rejects NWC_URI as an environment variable at startup.

Similar MCP servers

All MCP servers for Agent setup: memory, context, orchestration →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor