Skip to main content
Glama

Lightning Tools MCP Server

by getAlby
request_invoice.ts1.3 kB
import { LightningAddress } from "@getalby/lightning-tools"; import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; export function registerRequestInvoiceTool(server: McpServer) { 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), }, ], }; } ); }

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