Skip to main content
Glama
lnfi-network

RGB Lightning Network MCP Server

by lnfi-network

rgb_pay_lightning_invoice

Process Lightning Network payments by submitting a BOLT11 invoice string. This tool enables settlement of Lightning invoices through the RGB Lightning Network MCP Server.

Instructions

Pay a Lightning Network invoice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bolt11YesBOLT11 invoice string

Implementation Reference

  • The MCP tool handler function that executes the payment of the Lightning invoice by calling the RGB API client wrapper's payInvoice method and formats the response or error.
    async ({ bolt11 }) => {
      try {
        const result = await rgbClient.payInvoice(bolt11);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return { content: [{ type: 'text', text: `Error: ${errorMessage}` }], isError: true };
      }
    }
  • Zod input schema defining the bolt11 parameter for the tool.
    {
      bolt11: z.string().describe('BOLT11 invoice string'),
    },
  • src/server.ts:204-219 (registration)
    Registration of the rgb_pay_lightning_invoice tool on the MCP server, including name, description, schema, and inline handler.
    server.tool(
      'rgb_pay_lightning_invoice',
      'Pay a Lightning Network invoice',
      {
        bolt11: z.string().describe('BOLT11 invoice string'),
      },
      async ({ bolt11 }) => {
        try {
          const result = await rgbClient.payInvoice(bolt11);
          return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          return { content: [{ type: 'text', text: `Error: ${errorMessage}` }], isError: true };
        }
      }
    );
  • Helper method in RGBApiClientWrapper that wraps the underlying SDK call to pay a Lightning invoice.
    async payInvoice(invoice: string) {
      return await this.client.lightning.payInvoice({ invoice });
    }

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/lnfi-network/rgb-mcp-server'

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