LDK MCP Server

LDK MCP Server

Provides real-time Lightning Development Kit expertise for accelerating iOS Lightning wallet development with access to LDK APIs, Swift patterns, event handling, and chain synchronization methods.

Category
访问服务器

Tools

ldk_generate_invoice

Generate a Lightning invoice with real payment hash for testing

ldk_pay_invoice

Test payment flows by paying a Lightning invoice

ldk_list_payments

List recent Lightning payments with status

ldk_channel_status

Monitor channel states and balances while coding

ldk_node_info

Get current node status and connectivity information

ldk_backup_state

Test channel backup and restore flows

ios_keychain_test

Validate private key storage patterns with iOS Keychain

ios_background_test

Test Lightning background processing and channel monitoring

ios_push_notification

Test payment notification flows and push setup

ios_biometric_auth

Integrate Touch/Face ID with Lightning operations

ldk_create_channel

Open a Lightning channel with a peer node

ldk_close_channel

Close a Lightning channel cooperatively or force close

ldk_get_balance

Get Lightning wallet balance and channel liquidity

ldk_decode_invoice

Decode and validate Lightning invoices

ldk_estimate_fee

Estimate Lightning routing fees for a payment

ldk_generate_mnemonic

Generate BIP39 mnemonic for wallet initialization

ldk_derive_address

Derive Bitcoin addresses from seed using BIP84

ldk_get_swift_code

Get Swift code examples for specific LDK operations

ldk_get_architecture

Get iOS Lightning wallet architecture patterns and best practices

ldk_test_scenario

Run complete Lightning development scenarios for testing

ldk_network_graph

Get network graph operations and RapidGossipSync implementation

ldk_event_handling

Get comprehensive LDK event handling patterns and implementations

ldk_chain_sync

Get chain synchronization implementations for LDK with Electrum/Esplora

README

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

📦 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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选