Skip to main content
Glama

Lightning Tools MCP Server

by getAlby

request_invoice

Generate and send payment requests via Lightning Network by specifying recipient address, amount in sats, and optional description or payer metadata.

Instructions

Request an invoice from a lightning address

Input Schema

NameRequiredDescriptionDefault
amountYesamount in sats
descriptionNonote, memo or description describing the invoice
lightning_addressYesthe recipient's lightning address
payer_dataNometadata to include with the payment such as the payer's name

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "amount": { "description": "amount in sats", "type": "number" }, "description": { "description": "note, memo or description describing the invoice", "type": [ "string", "null" ] }, "lightning_address": { "description": "the recipient's lightning address", "type": "string" }, "payer_data": { "anyOf": [ { "additionalProperties": true, "description": "metadata to include with the payment such as the payer's name", "properties": {}, "type": "object" }, { "type": "null" } ], "description": "metadata to include with the payment such as the payer's name" } }, "required": [ "lightning_address", "amount" ], "type": "object" }

Implementation Reference

  • The asynchronous handler function that processes the request_invoice tool: creates a LightningAddress from the input, fetches LNURL data, requests an invoice using the provided amount, description, and payer data, then returns the invoice as JSON-formatted text content.
    async (params) => { const ln = new LightningAddress(params.lightning_address); // fetch the LNURL data await ln.fetch(); const invoice = await ln.requestInvoice({ satoshi: params.amount, comment: params.description || undefined, payerdata: params.payer_data || undefined, }); return { content: [ { type: "text", text: JSON.stringify(invoice, null, 2), }, ], }; }
  • Zod input schema for the request_invoice tool, defining required lightning_address (string) and amount (number in sats), optional description (string) and payer_data (passthrough object).
    { lightning_address: z .string() .describe("the recipient's lightning address"), amount: z.number().describe("amount in sats"), description: z .string() .describe("note, memo or description describing the invoice") .nullish(), payer_data: z .object({}) .passthrough() .describe( "metadata to include with the payment such as the payer's name" ) .nullish(), },
  • The server.tool() registration call inside registerRequestInvoiceTool that defines and registers the 'request_invoice' tool with name, description, schema, and handler function.
    server.tool( "request_invoice", "Request an invoice from a lightning address", { lightning_address: z .string() .describe("the recipient's lightning address"), amount: z.number().describe("amount in sats"), description: z .string() .describe("note, memo or description describing the invoice") .nullish(), payer_data: z .object({}) .passthrough() .describe( "metadata to include with the payment such as the payer's name" ) .nullish(), }, async (params) => { const ln = new LightningAddress(params.lightning_address); // fetch the LNURL data await ln.fetch(); const invoice = await ln.requestInvoice({ satoshi: params.amount, comment: params.description || undefined, payerdata: params.payer_data || undefined, }); return { content: [ { type: "text", text: JSON.stringify(invoice, null, 2), }, ], }; } );
  • src/index.ts:28-28 (registration)
    Call to registerRequestInvoiceTool on the main McpServer instance, integrating the request_invoice tool into the LightningToolsServer.
    registerRequestInvoiceTool(this._server);

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/getAlby/lightning-tools-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server