Skip to main content
Glama

server_backup

Destructive

Create and restore backups or manage cloud snapshots for Kastell servers to protect data and configurations.

Instructions

Backup and snapshot Kastell servers. Backup: 'backup-create' dumps Coolify DB + config via SSH (Coolify servers) or system config files (bare servers), 'backup-list' shows local backups, 'backup-restore' restores from backup — bare servers restore system config, Coolify servers restore DB+config (SAFE_MODE blocks restore). Snapshot: 'snapshot-create'/'snapshot-list'/'snapshot-delete' manage cloud provider snapshots (requires provider API token). Snapshots not available for manually added servers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesBackup: 'backup-create' dumps Coolify DB+config via SSH (or system config for bare servers), 'backup-list' shows local backups, 'backup-restore' restores (SAFE_MODE blocks). Snapshot: 'snapshot-create'/'snapshot-list'/'snapshot-delete'/'snapshot-restore' manage cloud snapshots (requires API token). snapshot-restore restores server disk from a cloud snapshot (SAFE_MODE blocks, destructive).
serverNoServer name or IP. Auto-selected if only one server exists.
backupIdNoBackup timestamp folder name (required for backup-restore).
snapshotIdNoCloud snapshot ID (required for snapshot-delete and snapshot-restore).

Implementation Reference

  • The `handleBackupRestore` function is one of the handlers for `server_backup`, specifically managing the restoration process from a backup. Other handlers for different sub-actions (create, list, snapshot management) are also present in this file.
    export async function handleBackupRestore(
      server: ServerRecord,
      backupId: string | undefined,
    ): Promise<McpResponse> {
      if (isSafeMode()) {
        return mcpError(
          "Restore disabled in SAFE_MODE",
          "Set KASTELL_SAFE_MODE=false to enable restore operations",
        );
      }
    
      if (!backupId) {
        return mcpError(
          "backupId is required for backup-restore",
          "Use backup-list to see available backups",
          [{ command: `server_backup { action: 'backup-list', server: '${server.name}' }`, reason: "List available backups" }],
        );
      }
    
      const bare = isBareServer(server);
      const result = bare
        ? await restoreBareBackup(server.ip, server.name, backupId)
        : await restoreBackup(server.ip, server.name, backupId);
    
      if (!result.success) {
        return {
          content: [{ type: "text", text: JSON.stringify({
            server: server.name,
            ip: server.ip,
            backupId,
            error: result.error,
            steps: result.steps,
            ...(result.hint ? { hint: result.hint } : {}),
          }) }],
          isError: true,
        };
      }
    
      const successPayload: Record<string, unknown> = {
        success: true,
        server: server.name,
        ip: server.ip,
        backupId,
        steps: result.steps,
        suggested_actions: [
          {
            command: `server_info { action: 'health', server: '${server.name}' }`,
            reason: bare ? "Verify SSH access after restore" : "Verify Coolify is running",
          },
        ],
      };
    
      if (bare) {
        successPayload.hint = "Config restored. You may need to restart services (e.g., nginx, fail2ban) for changes to take effect.";
      }
    
      return mcpSuccess(successPayload);
    }
  • The schema definition for the `server_backup` MCP tool, validating input actions and parameters.
    export const serverBackupSchema = {
      action: z.enum([
        "backup-create", "backup-list", "backup-restore",
        "snapshot-create", "snapshot-list", "snapshot-delete", "snapshot-restore",
      ]).describe(
        "Backup: 'backup-create' dumps Coolify DB+config via SSH (or system config for bare servers), 'backup-list' shows local backups, 'backup-restore' restores (SAFE_MODE blocks). Snapshot: 'snapshot-create'/'snapshot-list'/'snapshot-delete'/'snapshot-restore' manage cloud snapshots (requires API token). snapshot-restore restores server disk from a cloud snapshot (SAFE_MODE blocks, destructive).",
      ),
      server: z.string().optional().describe(
        "Server name or IP. Auto-selected if only one server exists.",
      ),
      backupId: z.string().regex(/^[\w-]+$/, "Invalid backupId: only alphanumeric, hyphens, underscores allowed").optional().describe(
        "Backup timestamp folder name (required for backup-restore).",
      ),
      snapshotId: z.string().regex(/^[\w./-]+$/, "Invalid snapshotId: only alphanumeric, hyphens, dots, slashes allowed").optional().describe(
        "Cloud snapshot ID (required for snapshot-delete and snapshot-restore).",
      ),
    };
  • Registration of the `server_backup` tool in the MCP server setup.
    server.registerTool("server_backup", {
      description:
        "Backup and snapshot Kastell servers. Backup: 'backup-create' dumps Coolify DB + config via SSH (Coolify servers) or system config files (bare servers), 'backup-list' shows local backups, 'backup-restore' restores from backup — bare servers restore system config, Coolify servers restore DB+config (SAFE_MODE blocks restore). Snapshot: 'snapshot-create'/'snapshot-list'/'snapshot-delete' manage cloud provider snapshots (requires provider API token). Snapshots not available for manually added servers.",
      inputSchema: serverBackupSchema,
      annotations: {
        title: "Server Backup & Snapshots",
        readOnlyHint: false,
        destructiveHint: true,
        idempotentHint: false,
        openWorldHint: true,
      },
    }, async (params) => {
      return handleServerBackup(params);
    });
    
    server.registerTool("server_provision", {
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds critical behavioral details beyond annotations: SAFE_MODE blocking mechanism, SSH-based extraction for Coolify vs bare servers, authentication requirements (provider API token), and irreversibility implications of restore operations. Annotations indicate destructiveness but description explains the safety guardrails and implementation mechanisms.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Dense but efficient single paragraph categorizes operations into Backup vs Snapshot sections. Every clause conveys specific operational constraints or requirements. Minor deduction for lack of visual separation between concepts, but no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex 7-mode tool with destructive operations and multiple server types, description comprehensively covers: what data is captured (DB+config vs system files), prerequisites (API tokens), limitations (manual servers), and safety mechanisms. No output schema exists, but tool's behavioral complexity is fully documented.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

While schema has 100% coverage, the description adds crucial context not in parameter docs: distinction between bare/Coolify servers, 'manually added servers' exclusion for snapshots, and operational implications of SAFE_MODE. These constraints help interpret parameter values correctly.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States specific actions (backup-create, snapshot-delete, etc.) and resources (Kastell servers, Coolify DB, cloud snapshots) with clear verbs (dumps, restores, manages). Effectively distinguishes from siblings (audit, doctor, secure, etc.) by focusing exclusively on backup/snapshot functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Distinguishes when to use backup vs snapshot operations, mentions prerequisites (API token for snapshots), limitations (snapshots unavailable for manually added servers), and safety constraints (SAFE_MODE blocks restore). Could explicitly contrast with siblings like server_maintain, but internal usage guidance is comprehensive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/kastelldev/kastell'

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