402 MCP server
{
"mcpServers": {
"forgesworn-402": {
"command": "npx",
"args": [
"-y",
"402-mcp@latest"
],
"env": {
"HNS_GATEWAY_URL": "https://..."
}
}
}
}{
"mcpServers": {
"forgesworn-402": {
"command": "npx",
"args": [
"-y",
"402-mcp@latest"
],
"env": {
"HNS_GATEWAY_URL": "https://..."
}
}
}
}{
"mcpServers": {
"forgesworn-402": {
"command": "npx",
"args": [
"-y",
"402-mcp@latest"
],
"env": {
"HNS_GATEWAY_URL": "https://..."
}
}
}
}{
"servers": {
"forgesworn-402": {
"command": "npx",
"args": [
"-y",
"402-mcp@latest"
],
"env": {
"HNS_GATEWAY_URL": "${input:hns_gateway_url}"
}
}
},
"inputs": [
{
"id": "hns_gateway_url",
"type": "promptString",
"description": "Hns gateway url",
"password": true
}
]
}{
"mcpServers": {
"forgesworn-402": {
"command": "npx",
"args": [
"-y",
"402-mcp@latest"
],
"env": {
"HNS_GATEWAY_URL": "https://..."
}
}
}
}file .mcp.json (in your project root)file claude_desktop_config.jsonfile ~/.cursor/mcp.jsonfile .vscode/mcp.jsonfile ~/.codeium/windsurf/mcp_config.jsoninstall npx -y 402-mcpversion 3.15.2
What it does
An MCP server that enables AI agents to autonomously discover, pay for, and consume Lightning-gated APIs. Agents can find L402-protected endpoints on Nostr, evaluate pricing, and make payments using Lightning wallets, Cashu tokens, or human confirmation, without requiring pre-registration or API keys.
- Discover paid APIs advertised on Nostr and probe them for pricing before committing to payment
- Automatically pay for API access using Lightning Network wallets (NWC) or ecash (Cashu tokens) and cache credentials for future requests
- Fetch data from L402-protected endpoints with built-in payment handling and credit balance tracking
Tools this server exposes
| Tool | Does |
|---|---|
| l402-config | Introspect payment capabilities including configured wallets, spending limits, and stored credentials |
| l402-discover | Probe an endpoint to discover L402 pricing and service details without making a payment |
| l402-fetch | Make HTTP requests to L402-protected endpoints with automatic payment handling if within budget |
| l402-pay | Pay a specific Lightning invoice using NWC, Cashu, LNURLcash, or human QR code confirmation |
| l402-credentials | List all stored credentials and cached credit balances for discovered services |
| l402-balance | Check the cached credit balance for a specific L402 server |
| l402-search | Discover L402 services advertised on Nostr relays via kind 31402 announcements |
| l402-store-token | Store an L402 token obtained from a payment page for future requests |
| l402-buy-credits | Browse and purchase volume discount tiers from toll-booth L402 servers |
| l402-redeem-cashu | Redeem Cashu tokens directly to pay invoices without a Lightning round-trip |
Before you enable it
An MCP server runs with whatever access you give it. Start with a development account rather than production, and check which tools the server exposes before you let an agent call them unattended.