Alby Bitcoin Payments MCP Server


What is this?

The Alby Bitcoin Payments MCP Server is a specialized Model Context Protocol (MCP) server that connects AI agents to the Bitcoin Lightning Network via the Alby Lightning Wallet. Packaged as @modelcontextprotocol/server-alby-bitcoin, it enables real-time invoice generation, payment monitoring, and peer-to-peer transfers with minimal latency.

By tapping into the Lightning Network, it offers instant settlement with near-zero fees and global reach. AI agents can query balances, execute payments, and subscribe to webhooks or server-sent events for confirmations. Secure key management is handled natively via the Alby Wallet connector.

Quick Start

Install the server using npm:

npm install @modelcontextprotocol/server-alby-bitcoin

Then add it to your MCP client configuration:

{
  "mcpServers": {
    "server-alby-bitcoin": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-alby-bitcoin"],
      "env": {
        "API_KEY": "your-api-key-here"
      }
    }
  }
}

Key Features

Feature 1: Instant, low-fee transactions powered by the Lightning Network for real-time payments.

Feature 2: Native integration with the Alby Wallet for secure key management and hardware wallet support.

Feature 3: Fully MCP-compliant API that fits seamlessly into AI agent workflows, including invoice creation and automated payment execution.

Example Usage

Here’s a simple example of generating a Lightning invoice through the MCP interface:

// Example code
const result = await client.callTool({
  name: "invoiceTool.createInvoice",
  arguments: {
    amount: 15000,
    memo: "Payment for data analysis",
    expiry: 3600
  }
});

This call returns a BOLT11 invoice string, expiry timestamp, and payment hash that your agent can present or store for later payment.

Configuration

The server accepts the following environment variables:

API_KEY – Your Alby Developer Portal API key for authenticating requests.

MCP_PORT (optional) – Port on which the MCP server listens (default: 4000).

Available Tools/Resources

invoiceTool.createInvoice: Generate BOLT11 invoices with custom memo, amount, and expiry.

payTool.executePayment: Pay any valid Lightning invoice with retry and fee cap options.

Who Should Use This?

This server is perfect for:

Use case 1: E-commerce platforms looking to automate invoice payments and order fulfillment.

Use case 2: Serverless microtransaction APIs charging per-request fees.

Use case 3: Real-time SaaS billing that charges by the second or minute for compute or data streaming.

Conclusion

The Alby Bitcoin Payments MCP Server makes it easy to integrate Lightning Network payments into AI-driven workflows. With instant settlement, secure key management, and a standardized MCP interface, you’re ready to build fast, low-cost payment functionality for any application.

Check out the GitHub repository for more information and to contribute.