# 402-mcp

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

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI
- Author: forgesworn
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/forgesworn/402-mcp
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/mcp/402-mcp

## What it 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.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `NWC_URI`, `MAX_AUTO_PAY_SATS` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
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

### Codex

**Platform CLI**
```bash
codex mcp add 402-mcp --env NWC_URI=<NWC_URI> --env MAX_AUTO_PAY_SATS=<MAX_AUTO_PAY_SATS> -- npx -y 402-mcp
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "402-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "402-mcp"
            ],
            "env": {
                "NWC_URI": "<NWC_URI>",
                "MAX_AUTO_PAY_SATS": "<MAX_AUTO_PAY_SATS>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "402-mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "402-mcp"
            ],
            "env": {
                "NWC_URI": "<NWC_URI>",
                "MAX_AUTO_PAY_SATS": "<MAX_AUTO_PAY_SATS>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e NWC_URI=<NWC_URI> -e MAX_AUTO_PAY_SATS=<MAX_AUTO_PAY_SATS> 402-mcp npx -y 402-mcp
```
Replace <…> with your own values

## When to use it
- 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
- 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.

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 392262
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33989
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81163
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119231
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47577
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43902

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
