Skip to main content
Glama

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
NameRequiredDescriptionDefault
recovery_codeYesRecovery code from registration

Implementation Reference

  • 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,
      };
    }
  • 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),
          },
        ],
      };
    }
  • 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'],
      },
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lightningfaucet/lightning-wallet-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server