MCP Bridge
@bolthub/mcp-bridge: MCP server that bridges AI agents to L402 paywalled APIs.
Overview
@bolthub/mcp-bridge is an MCP (Model Context Protocol) server that bridges AI agents to bolthub L402 paywalled APIs. It auto-discovers endpoints from a gateway's OpenAPI spec and handles Lightning payments transparently.
Install
npm install -g @bolthub/mcp-bridgeOr use directly with npx:
npx @bolthub/mcp-bridge --gateway https://btc-intel.gw.bolthub.aiMinimal dependencies. Only
@modelcontextprotocol/sdkandzodbeyond the core@bolthub/agent(which itself has zero runtime dependencies).
Configuration
Add to your MCP client config (Cursor, Claude Desktop, OpenClaw, etc.):
{
"mcpServers": {
"btc-intel-api": {
"command": "npx",
"args": ["@bolthub/mcp-bridge", "--gateway", "https://btc-intel.gw.bolthub.ai"],
"env": {
"NWC_URI": "<your-nwc-connection-string>"
}
}
}
}Environment variables
The bridge supports multiple wallet types. You only need one.
| Variable | Description |
|---|---|
LND_REST_HOST | Recommended. LND REST API URL (e.g. from the bolthub Node Launcher or https://your-node:8080). Fast payments (<200ms); use a pay-scoped macaroon in production. |
LND_MACAROON | Hex-encoded macaroon for LND. Required when using LND_REST_HOST. |
NWC_URI | Recommended for easy setup. Free start: CoinOS — no-KYC signup, copy the connection string, done. Set a per-connection budget and keep only a few thousand sats (custodial); its single relay refuses connections intermittently, so retry if a payment fails to connect. Reliability upgrade: Alby Hub (v1.21.5+, hosted or free self-hosted) puts two relays in every connection string and our client fails over automatically. Expect 2–15s per payment over NWC. Bundled as of v0.1.4 — no extra packages needed. |
LNBITS_URL | LNbits instance URL. Fast (<300ms). Accounts system built on any Lightning funding source. Use if you already run LNbits. |
LNBITS_ADMIN_KEY | Admin API key for LNbits. Required when using LNBITS_URL. |
PHOENIXD_URL | Phoenixd HTTP API URL. Supported if you already run Phoenixd for outbound payments. |
PHOENIXD_PASSWORD | HTTP password for Phoenixd. Required when using PHOENIXD_URL. |
BUDGET_SATS | Optional. Maximum sats the MCP can spend per session. When exceeded, API calls return an error instead of paying. Unset = unlimited. |
Priority order: If multiple wallet types are configured, the bridge uses the first available: LND > NWC > LNbits > Phoenixd.
Which wallet should I use?
Pick by how your wallet will be used, not by brand:
- Interactive use (you're present): Zeus — free, non-custodial, well-known. Great for trying APIs from the playground or manual CLI calls. Not for unattended agents: its wallet service runs on your phone, so payments only succeed while the app is running.
- Unattended agents, free start: NWC with CoinOS — the only zero-cost always-on option; about 2 minutes to a working wallet. Set a per-connection budget and keep only a few thousand sats there (it's custodial). Its relay refuses connections intermittently; retry the call if it fails to connect (clients built on
@bolthub/agent≥ 0.1.3 retry automatically). - Unattended agents, reliable: Alby Hub (v1.21.5+) — non-custodial, two relays in every connection string with automatic failover in our client. Hosted plan or free self-hosted.
- Production / power users: LND via the bolthub Node Launcher or your own node with a pay-scoped macaroon (see Umbrel or similar if you self-host) — payments in under 200ms. Pairs naturally with Lightning Labs' agent stack (lnget, lightning-agent-tools), which speaks the same standard L402 as every bolthub API.
- Whatever the wallet: always set a budget on connections an agent can spend from.
Spending budget
Set BUDGET_SATS to cap spending per session, or use the --budget CLI flag:
npx @bolthub/mcp-bridge --gateway https://btc-intel.gw.bolthub.ai --budget 1000| Budget | Use case |
|---|---|
100–500 | Testing and light use |
1000–5000 | Typical daily development |
10000+ | Heavy or production use |
| Unset | No limit (pays any invoice as long as wallet has funds) |
A session lasts as long as the MCP server process runs, typically the lifetime of your Cursor or Claude Desktop window.
Alternatives
This bridge is one way to give agents L402 payment capabilities. There are also third-party MCPs that handle Lightning payments:
- Alby MCP: Recommended for most users. Uses NWC under the hood. Works with any Alby Hub or CoinOS wallet.
- Fewsats MCP: Zero-config custodial option. Single API key, no Lightning node needed.
How it works
- On startup, fetches the gateway's OpenAPI spec from
/.well-known/openapi.json - Converts each API endpoint into an MCP tool with proper
inputSchema - When an agent calls a tool, makes the HTTP request to the gateway
- If the gateway returns 402 (Payment Required), automatically pays the Lightning invoice and retries
- Returns the API response to the agent
SDKs
For building custom agents without MCP, use the SDKs directly:
- TypeScript:
@bolthub/agent - Python:
bolthub