ios_push_notification
Simulate iOS push notifications for Lightning wallet events like payments, channel actions, and sync completion using LDK MCP Server. Test and validate notification flows efficiently.
Instructions
Test payment notification flows and push setup
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amountSats | No | Amount in satoshis (for payment notifications) | |
| notificationType | No | Type of notification to simulate | payment_received |
Input Schema (JSON Schema)
{
"properties": {
"amountSats": {
"default": 1000,
"description": "Amount in satoshis (for payment notifications)",
"type": "number"
},
"notificationType": {
"default": "payment_received",
"description": "Type of notification to simulate",
"enum": [
"payment_received",
"channel_opened",
"channel_closed",
"sync_complete"
],
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/tools/iosPushNotification.ts:25-110 (handler)The main handler function (execute) for the 'ios_push_notification' tool. It calls iosService.testPushNotification(), incorporates input args, and returns detailed results including implementation steps and a server-side APNs example.execute: async (args: any): Promise<ToolResult> => { try { const result = await iosService.testPushNotification(); return { content: [{ type: 'text', text: JSON.stringify({ ...result, notificationType: args.notificationType, amountSats: args.amountSats, implementationSteps: [ '1. Request notification permissions on app launch', '2. Register for remote notifications', '3. Handle notification tokens and updates', '4. Process Lightning events in background', '5. Display rich notifications with payment details', '6. Update app badge with pending actions' ], serverIntegration: ` // Server-side notification example (Node.js) import apn from 'apn'; class LightningNotificationServer { private provider: apn.Provider; constructor() { this.provider = new apn.Provider({ token: { key: process.env.APNS_KEY_PATH, keyId: process.env.APNS_KEY_ID, teamId: process.env.APPLE_TEAM_ID }, production: process.env.NODE_ENV === 'production' }); } async notifyPaymentReceived( deviceToken: string, paymentHash: string, amountSats: number, memo?: string ) { const notification = new apn.Notification({ alert: { title: "Payment Received", subtitle: memo || "Lightning Payment", body: \`You received \${amountSats.toLocaleString()} sats\` }, sound: "payment_received.wav", badge: 1, topic: "com.yourapp.bundle", payload: { type: "payment_received", paymentHash, amountSats }, pushType: "alert", priority: 10 }); const result = await this.provider.send(notification, deviceToken); if (result.failed.length > 0) { console.error('Notification failed:', result.failed[0].response); } return result; } }`.trim() }, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : 'Unknown error' }, null, 2) }], isError: true }; } }
- Input schema defining parameters for the ios_push_notification tool: notificationType and amountSats.inputSchema: { type: 'object', properties: { notificationType: { type: 'string', enum: ['payment_received', 'channel_opened', 'channel_closed', 'sync_complete'], description: 'Type of notification to simulate', default: 'payment_received' }, amountSats: { type: 'number', description: 'Amount in satoshis (for payment notifications)', default: 1000 } } },
- src/index.ts:38-62 (registration)Registration of all tools in the MCP server, including pushNotificationTool (line 46) which is the 'ios_push_notification' tool.const tools = [ generateInvoiceTool, payInvoiceTool, getChannelStatusTool, getNodeInfoTool, backupStateTool, keychainTestTool, backgroundTestTool, pushNotificationTool, biometricAuthTool, createChannelTool, closeChannelTool, getBalanceTool, decodeInvoiceTool, listPaymentsTool, estimateFeeTool, generateMnemonicTool, deriveAddressTool, getSwiftCodeTool, getArchitectureTool, testScenarioTool, networkGraphTool, eventHandlingTool, chainSyncTool, ];
- src/index.ts:20-20 (registration)Import statement for the pushNotificationTool from its implementation file.import { pushNotificationTool } from './tools/iosPushNotification.js';