Skip to main content
Glama
LDK MCP Server

LDK MCP Server

by StevenGeller

LDK MCP Server

Real-time Lightning Development Kit (LDK) expertise for accelerating iOS Lightning wallet development. This MCP server provides instant access to LDK APIs, Swift patterns with proper Bindings namespace usage, comprehensive event handling, NetworkGraph with RapidGossipSync, and multiple chain synchronization methods.

๐Ÿš€ Features

Lightning Development Tools

  • Invoice Generation - Create real Lightning invoices with proper encoding

  • Payment Processing - Test payment flows with simulated Lightning operations

  • Channel Management - Open, monitor, and close Lightning channels

  • Balance Tracking - Monitor channel liquidity and wallet balances

  • Fee Estimation - Calculate routing fees and on-chain costs

iOS Development Integration

  • Keychain Security - iOS Keychain patterns for secure key storage

  • Background Processing - Lightning sync in iOS background tasks

  • Push Notifications - Payment notification implementation

  • Biometric Auth - Touch/Face ID integration for Lightning operations

Architecture & Best Practices

  • Swift Code Examples - Production-ready LDK Swift implementations

  • Project Structure - Recommended iOS Lightning wallet architecture

  • Security Patterns - Best practices for key management and crypto

  • Testing Scenarios - Complete test scenarios for Lightning operations

Related MCP server: FrameLayoutKit MCP Server

๐Ÿ“ฆ Installation

  1. Clone the repository:

git clone https://github.com/StevenGeller/ldk-mcp.git
cd ldk-mcp
  1. Install dependencies:

npm install
  1. Build the project:

npm run build
  1. Configure MCP Client:

Add to your MCP client configuration file:

Configuration varies by MCP client. For example configurations, see the documentation.

{
  "mcpServers": {
    "ldk-mcp": {
      "command": "node",
      "args": ["/path/to/ldk-mcp/dist/index.js"],
      "env": {
        "NETWORK": "testnet"
      }
    }
  }
}
  1. Restart Claude Desktop

๐Ÿ› ๏ธ Available Tools

Lightning Operations

ldk_generate_invoice

Generate Lightning invoices for testing payment flows.

await ldk_generate_invoice({
  amountSats: 10000,
  description: "Test payment",
  expirySeconds: 3600
})

ldk_pay_invoice

Simulate Lightning payments for development.

await ldk_pay_invoice({
  invoice: "lnbc10000n1...",
  maxFeeSats: 50
})

ldk_create_channel

Open Lightning channels with configuration options.

await ldk_create_channel({
  remotePubkey: "02abc...",
  capacitySats: 1000000,
  pushSats: 100000,
  isPublic: false
})

ldk_channel_status

Monitor channel states and balances.

await ldk_channel_status({
  includeOffline: true
})

iOS Integration Tools

ios_keychain_test

Test iOS Keychain integration for secure storage.

await ios_keychain_test({
  keyType: "seed",
  testValue: "test_data"
})

ios_background_test

Implement Lightning background sync.

await ios_background_test({
  taskType: "sync"
})

ios_biometric_auth

Integrate Touch/Face ID with Lightning operations.

await ios_biometric_auth({
  operation: "send_payment",
  requireAuth: true
})

Development Helpers

ldk_get_swift_code

Get production-ready Swift code examples.

await ldk_get_swift_code({
  operation: "channel_manager_setup"
})

ldk_get_architecture

Access architectural patterns and best practices.

await ldk_get_architecture({
  topic: "security_architecture"
})

ldk_test_scenario

Run complete Lightning development scenarios.

await ldk_test_scenario({
  scenario: "multi_hop_payment"
})

๐Ÿ’ก Usage Examples

Quick Start: Building a Lightning Invoice Feature

// 1. Use MCP to generate a test invoice
const invoice = await ldk_generate_invoice({
  amountSats: 5000,
  description: "Coffee payment"
})

// 2. Get the Swift implementation
const swiftCode = await ldk_get_swift_code({
  operation: "payment_handling"
})

// 3. The MCP server provides complete SwiftUI code with:
// - QR code generation
// - Invoice display
// - Payment handling
// - Error management

Advanced: Implementing Channel Management

// 1. Get architecture guidance
const architecture = await ldk_get_architecture({
  topic: "channel_management"
})

// 2. Create test channel
const channel = await ldk_create_channel({
  remotePubkey: "02...",
  capacitySats: 500000
})

// 3. Run test scenarios
const test = await ldk_test_scenario({
  scenario: "channel_lifecycle"
})

๐Ÿ—๏ธ Development Workflow

1. Initial Setup

# Request initial setup
"Help me set up a new iOS Lightning wallet project"

# MCP provides:
# - Complete project structure
# - LDK initialization code  
# - Security setup
# - Basic UI components

2. Feature Implementation

# Request specific features
"Implement Lightning payment sending with biometric authentication"

# MCP provides:
# - Swift implementation
# - Security best practices
# - UI/UX patterns
# - Test scenarios

3. Testing & Validation

# Test your implementation
"Run a multi-hop payment test scenario"

# MCP provides:
# - Test setup code
# - Mock Lightning network
# - Validation steps
# - Debugging guidance

๐Ÿ”ง Configuration

Environment Variables

  • NETWORK - Bitcoin network: mainnet, testnet, or regtest (default: testnet)

  • LOG_LEVEL - Logging verbosity: debug, info, warn, error (default: info)

Custom Configuration

Create a .env file in the project root:

NETWORK=testnet
LOG_LEVEL=debug

๐Ÿงช Testing

Run the test suite:

npm test

Run specific test scenarios:

npm test -- --testNamePattern="Lightning payment"

๐Ÿ“š Documentation

Swift/iOS Integration

Lightning Development

๐Ÿค Contributing

  1. Fork the repository

  2. Create your feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Lightning Dev Kit for the amazing Lightning implementation

  • Bitcoin Dev Kit for on-chain wallet functionality

  • The Lightning Network community for protocol development

๐Ÿ’ฌ Support


Built with โšก for the Lightning Network community

Available Tools

23 tools
ios_background_testC

Test Lightning background processing and channel monitoring

Inputs: taskType.

ios_biometric_authC

Integrate Touch/Face ID with Lightning operations

Inputs: operation, requireAuth.

ios_keychain_testC

Validate private key storage patterns with iOS Keychain

Inputs: keyType (required), testValue.

ios_push_notificationC

Test payment notification flows and push setup

Inputs: notificationType, amountSats.

ldk_backup_stateC

Test channel backup and restore flows

Inputs: action (required), backupData.

ldk_chain_syncC

Get chain synchronization implementations for LDK with Electrum/Esplora

Inputs: syncMethod (required).

ldk_channel_statusC

Monitor channel states and balances while coding

Inputs: includeOffline.

ldk_close_channelB

Close a Lightning channel cooperatively or force close

Inputs: channelId (required), force.

ldk_create_channelC

Open a Lightning channel with a peer node

Inputs: remotePubkey (required), capacitySats (required), pushSats, isPublic.

ldk_decode_invoiceC

Decode and validate Lightning invoices

Inputs: invoice (required).

ldk_derive_addressB

Derive Bitcoin addresses from seed using BIP84

Inputs: mnemonic (required), accountIndex, addressIndex, isChange, +1 more.

ldk_estimate_feeC

Estimate Lightning routing fees for a payment

Inputs: amountSats (required), targetNode.

ldk_event_handlingB

Get comprehensive LDK event handling patterns and implementations

Inputs: eventType (required).

ldk_generate_invoiceC

Generate a Lightning invoice with real payment hash for testing

Inputs: amountSats (required), description, expirySeconds.

ldk_generate_mnemonicC

Generate BIP39 mnemonic for wallet initialization

Inputs: strength, wordCount.

ldk_get_architectureB

Get iOS Lightning wallet architecture patterns and best practices

Inputs: topic (required).

ldk_get_balanceB

Get Lightning wallet balance and channel liquidity

Inputs: no named parameters.

ldk_get_swift_codeC

Get Swift code examples for specific LDK operations

Inputs: operation (required).

ldk_list_paymentsC

List recent Lightning payments with status

Inputs: limit, status.

ldk_network_graphC

Get network graph operations and RapidGossipSync implementation

Inputs: operation (required), nodeId, channelId.

ldk_node_infoB

Get current node status and connectivity information

Inputs: no named parameters.

ldk_pay_invoiceC

Test payment flows by paying a Lightning invoice

Inputs: invoice (required), maxFeeSats.

ldk_test_scenarioC

Run complete Lightning development scenarios for testing

Inputs: scenario (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    B3.2/5.0

    Scored across 23 tools

    Disambiguation4/5

    Most tools have distinct purposes, but some overlap exists, such as 'ldk_event_handling' and 'ldk_test_scenario' which could be confused for general testing, and 'ldk_get_architecture' and 'ldk_get_swift_code' which both provide implementation patterns. However, descriptions clarify their specific focuses, reducing ambiguity.

    Naming Consistency5/5

    All tools follow a consistent snake_case naming pattern with clear prefixes: 'ios_' for iOS-specific tools and 'ldk_' for Lightning-related tools. This predictable structure makes it easy to identify tool categories and purposes at a glance.

    Tool Count3/5

    With 23 tools, the count is borderline high for a Lightning development server, as it includes many specific testing and implementation tools. While comprehensive, it may feel heavy and could potentially be streamlined without losing core functionality.

    Completeness5/5

    The tool set provides complete coverage for Lightning development on iOS, including channel management (create, close, monitor), payments (invoice generation, decoding, paying), wallet operations (balance, addresses, mnemonics), testing (scenarios, background, notifications), and implementation patterns (architecture, Swift code). No obvious gaps are present for the domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Lightning Network wallet operations through the Breez SDK, allowing users to check balances, send/receive payments, create invoices, and manage Bitcoin Lightning transactions via natural language.
      7
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Provides AI-powered assistance for iOS developers using FrameLayoutKit, enabling code generation, Auto Layout conversion to FrameLayoutKit syntax, layout validation, and migration guidance for Swift UIKit projects.
      5
      9 npm
      4
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that provides Swift and SwiftUI best practices, acting as a senior iOS/macOS developer expert.
      30 npm
      4
      -