recover_account
Regain access to your Lightning Wallet MCP operator account using your recovery code. This process issues a new API key and initiates a 60-minute withdrawal cooldown period.
Instructions
Recover an operator account using the recovery code from registration. Returns a new API key. Triggers 60-min withdrawal cooldown.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recovery_code | Yes | Recovery code from registration |
Implementation Reference
- src/lightning-faucet.ts:793-829 (handler)Implementation of the account recovery logic using an API call to the Lightning Faucet server.
async recoverAccount(recoveryCode: string): Promise<{ operatorId: number; apiKey: string; cooldownUntil?: string; rawResponse: ApiResponse; }> { // Recovery doesn't need auth, so we make a direct request const response = await fetch(API_BASE_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'recover', recovery_code: recoveryCode, }), }); if (!response.ok) { throw new Error(`Request failed (HTTP ${response.status})`); } const result = await response.json() as ApiResponse & { operator_id?: number; api_key?: string; cooldown_until?: string; }; if (!result.success) { throw new Error(result.error || 'Recovery failed'); } return { operatorId: result.operator_id || 0, apiKey: result.api_key || '', cooldownUntil: result.cooldown_until, rawResponse: result, }; } - src/index.ts:1309-1330 (handler)MCP tool handler for the 'recover_account' tool.
case 'recover_account': { const parsed = RecoverAccountSchema.parse(args); // Recovery doesn't need an existing API key — recoverAccount() uses its own fetch const tempClient = session.getClient() || new LightningFaucetClient('recovery-placeholder'); const result = await tempClient.recoverAccount(parsed.recovery_code); // Auto-switch to the new key session.setClient(new LightningFaucetClient(result.apiKey)); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: 'Account recovered successfully. New API key is now active. Withdrawals blocked for 60 minutes.', operator_id: result.operatorId, new_api_key: result.apiKey, cooldown_until: result.cooldownUntil, }, null, 2), }, ], }; } - src/index.ts:196-199 (schema)Zod schema for input validation of the recover_account tool.
const RecoverAccountSchema = z.object({ recovery_code: z.string().min(16, 'Recovery code is too short').max(64, 'Recovery code is too long') .describe('Recovery code received during registration'), }); - src/index.ts:585-594 (registration)Tool registration definition for 'recover_account'.
name: 'recover_account', description: 'Recover an operator account using the recovery code from registration. Returns a new API key. Triggers 60-min withdrawal cooldown.', inputSchema: { type: 'object', properties: { recovery_code: { type: 'string', description: 'Recovery code from registration' }, }, required: ['recovery_code'], }, },