Skip to main content
Glama
getAlby

Lightning Tools MCP Server

by getAlby

parse_invoice

Extract payment details from BOLT-11 lightning invoices to verify amounts, destinations, and expiration times for Lightning Network transactions.

Instructions

Parse a BOLT-11 lightning invoice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoiceYesthe bolt11 invoice

Implementation Reference

  • The async handler function that takes the invoice parameter, parses it using the Invoice class from @getalby/lightning-tools, and returns a structured content response with the JSON-stringified invoice data.
    async (params) => { const invoice = new Invoice({ pr: params.invoice }); return { content: [ { type: "text", text: JSON.stringify(invoice, null, 2), }, ], }; }
  • Input schema defined using Zod: requires 'invoice' as a string, described as 'the bolt11 invoice'.
    { invoice: z.string().describe("the bolt11 invoice"), },
  • The registerParseInvoiceTool function registers the parse_invoice tool with the MCP server, specifying name, description, input schema, and handler function.
    export function registerParseInvoiceTool(server: McpServer) { server.tool( "parse_invoice", "Parse a BOLT-11 lightning invoice", { invoice: z.string().describe("the bolt11 invoice"), }, async (params) => { const invoice = new Invoice({ pr: params.invoice }); return { content: [ { type: "text", text: JSON.stringify(invoice, null, 2), }, ], }; } ); }
  • src/index.ts:30-30 (registration)
    Invocation of registerParseInvoiceTool during the LightningToolsServer constructor to register the tool with the MCP server instance.
    registerParseInvoiceTool(this._server);
Install Server

Other 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