---
title: "MCP server"
description: "Connect Claude Code, Cursor or any MCP client to an ln.bot wallet: one streamable HTTP server per wallet, with 12 tools for payments and L402."
updatedAt: "2026-10-23"
order: 11
tags: ["mcp", "reference", "ai-agents", "tools", "claude", "cursor"]
---

# MCP server

Every wallet has its own Model Context Protocol server. An agent connected to it can check the balance, create invoices, price and send payments, list its history, buy an address and handle L402, through the 12 tools below.

- **Server:** `https://api.ln.bot/v1/wallets/{walletId}/mcp`
- **Transport:** streamable HTTP
- **Auth:** `Authorization: Bearer <key>`
- **Discovery:** `https://ln.bot/.well-known/mcp.json`, the server card agents and clients can find ln.bot by

The tools have no spending limit of their own: `send_payment` and `pay_l402_challenge` can spend the whole balance. Give an agent a wallet that holds only what it may spend, and keep the rest in another wallet. Creating wallets, rotating keys, webhooks and backups aren't MCP tools; use the [CLI](/docs/cli), an [SDK](/docs/sdks) or the [REST API](/docs/api) for those.

## Client config

A client needs the wallet's ID for the URL and a key for the header. `lnbot init` created both: `lnbot whoami` shows the wallet ID, and the key is in `~/.config/lnbot/config.json` (`lnbot key show` prints it). Without the CLI, `POST /v1/register` returns the keys and `POST /v1/wallets` the wallet ID; see [getting started with the API](/docs/api#getting-started).

The CLI prints a ready block for the active wallet, or for another with `--wallet`:

```
$ lnbot mcp config --remote
Add to your MCP client config:

{
  "mcpServers": {
    "lnbot": {
      "headers": {
        "Authorization": "Bearer uk_9Qf3Lx7TzM2pW8vR4kNs6bHc"
      },
      "type": "url",
      "url": "https://api.ln.bot/v1/wallets/wal_c7i0hnuoxxupuwej/mcp"
    }
  }
}
```

The key in that header is the account's primary user key (`uk_`), which reaches every wallet on the account, so treat the file you paste it into like the key itself. For an agent, put that wallet's own key (`wk_...`, from `w.key.create()`) in the header instead: it reaches that wallet and no other. With a wallet key, the URL can also be `https://api.ln.bot/v1/wallets/current/mcp`. Clients differ in the shape they want around the URL and the header.

### Claude Code

```bash
claude mcp add --transport http lnbot https://api.ln.bot/v1/wallets/wal_.../mcp \
  --header "Authorization: Bearer uk_..."
```

That stores the server for you in the current project; `--scope user` makes it available in every project. Claude Code's own config files describe this kind of server with `"type": "http"`, so add it with the command rather than pasting the block above. See [Claude Code's MCP docs](https://code.claude.com/docs/en/mcp).

### Cursor

Put this in `.cursor/mcp.json` in your project, or in `~/.cursor/mcp.json` for every project:

```json
{
  "mcpServers": {
    "lnbot": {
      "url": "https://api.ln.bot/v1/wallets/wal_.../mcp",
      "headers": {
        "Authorization": "Bearer ${env:LNBOT_API_KEY}"
      }
    }
  }
}
```

Cursor fills in `${env:LNBOT_API_KEY}` from your environment, which keeps the key out of the file; writing the key in directly works too. See [Cursor's MCP docs](https://cursor.com/docs/context/mcp).

### Other clients

Any client that speaks streamable HTTP and can send a header can connect: add the URL and the `Authorization: Bearer` header in its MCP settings.

## Tools

The parameter descriptions below are the ones the server gives agents.

### `get_wallet`

Get wallet balance and summary. No parameters.

Returns the balance, the on-hold amount, the available balance, and invoice, payment and transaction counts.

### `create_invoice`

Create a Lightning invoice to receive sats.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `amount` | integer | yes | Amount in sats (1 to 1,000,000,000) |
| `reference` | string | no | Optional tracking reference (max 256 chars) |
| `memo` | string | no | Optional memo embedded in the BOLT11 invoice (max 256 chars) |

Returns the invoice number, bolt11 string, amount and expiry.

### `quote_payment`

Price a payment without sending it. Read-only: nothing is sent or held.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `target` | string | yes | Lightning address (user@domain), LNURL (lnurl1...), or BOLT11 invoice string |
| `amount` | integer | no | Amount in sats to price. Omit it for a Lightning address or LNURL to get the most the wallet can send there; a BOLT11 invoice is priced at its own amount. |

Returns what [`GET .../payments/resolve`](/docs/api#get-v1-wallets-walletId-payments-resolve) does: whether the recipient is an ln.bot wallet (`internal`, no fees), the network fee estimate, the service fee, the total, and without an amount the most the wallet can send there now. A fee warning means `send_payment` without `maxFee` would be rejected. Pricing a Lightning address or LNURL fetches an invoice from the recipient, so it takes a moment longer.

### `send_payment`

Send sats to a Lightning address (user@domain), LNURL, or BOLT11 invoice. This sends real money: the amount and the fees are placed on hold until the payment settles.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `target` | string | yes | Lightning address (user@domain), LNURL (lnurl1...), or BOLT11 invoice string |
| `amount` | integer | no | Amount in sats (required for Lightning addresses and LNURLs, optional for BOLT11) |
| `maxFee` | integer | no | Maximum network fee in sats: the routing, on top of the 0.25% service fee (default 1% of the amount, at least 20; ignored for internal transfers) |
| `reference` | string | no | Optional tracking reference (max 256 chars) |

Leave `maxFee` out unless `quote_payment` returned a fee warning. A payment out to Lightning also pays the 0.25% service fee, at least ₿1; between ln.bot wallets there are no fees.

### `list_invoices`

List invoices (newest first).

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `after` | integer | no | Return invoices with number less than this (for pagination) |
| `limit` | integer | no | Number of invoices to return (default 10, max 50) |

Returns invoice summaries with status, amount and bolt11.

### `list_payments`

List payments (newest first).

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `after` | integer | no | Return payments with number less than this (for pagination) |
| `limit` | integer | no | Number of payments to return (default 10, max 50) |

Returns payment summaries with status, amount and destination.

### `list_transactions`

List transaction history (newest first).

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `after` | integer | no | Return transactions with number less than this (for pagination) |
| `limit` | integer | no | Number of transactions to return (default 10, max 50) |

Returns each transaction's type, amount and the balance after it.

### `list_addresses`

List the wallet's Lightning addresses, in user@domain format. No parameters.

### `buy_address`

Buy a vanity Lightning address (name@ln.bot). It costs ₿100 for five characters or more, ₿1,000 for four and ₿10,000 for three, deducted from the wallet's balance.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `address` | string | yes | The vanity address to claim (3-20 lowercase alphanumeric characters) |

### `create_l402_challenge`

Create an L402 challenge (an invoice and a macaroon) for pay-per-use API access.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `amount` | integer | yes | Amount in sats (1 to 1,000,000,000) |
| `description` | string | no | Optional description embedded in the invoice (max 256 chars) |
| `expirySeconds` | integer | no | Optional token expiry in seconds (adds an expiry caveat) |
| `caveats` | string | no | Optional comma-separated caveats (e.g., 'service=api,tier=premium') |

Returns the macaroon, the invoice and a ready-made `WWW-Authenticate` header value for the 402 response.

### `pay_l402_challenge`

Pay an L402 challenge and get a ready-to-use `Authorization` header (`L402 <macaroon>:<preimage>`). The tool parses the `WWW-Authenticate` header, pays the invoice and waits for settlement.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `wwwAuthenticate` | string | yes | The WWW-Authenticate header value from the 402 response |
| `maxFee` | integer | no | Maximum network fee in sats (default 1% of the amount, at least 20) |
| `wait` | boolean | no | Wait for settlement (default true) |

There is no price limit: the tool pays whatever the invoice asks. The [L402 clients](/docs/sdks#l402-libraries) for TypeScript and C# check the invoice's amount against a limit you set before paying.

### `verify_l402_token`

Verify an L402 authorization token.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `authorization` | string | yes | The full Authorization header value: `L402 <base64_macaroon>:<hex_preimage>` |

Checks the macaroon signature, the preimage (proof of payment) and the caveats.
