MCP HubMCP Hub
hexitex

MCP-Backup-Server

by: hexitex

A Model Context Protocol (MCP) server implementation that provides file backup and restoration capabilities

2created 10/03/2025
Visit
backup
restore

📌Overview

Purpose: To provide a specialized backup server that enables quick, contextual backups and restoration for AI agents and code editing tools.

Overview: The MCP Backup Server is designed to facilitate instant, targeted backups that preserve the thought process and context of edits made by AI agents. It enhances safety during code modifications, particularly in environments like Cursor and Windsurf editors, without the complexities of traditional version control systems such as Git.

Key Features:

  • Context Preservation: Captures the reasoning behind changes, enabling users to maintain a clear understanding of modifications.

  • Targeted Backups: Creates minimal backups that focus strictly on the files or folders involved in any operational change, streamlining the backup process.

  • Version Tracking and Safety: Maintains a history of backup versions and provides a secure method to restore previous states, reducing the risk of data loss during critical edits.


MCP Backup Server

A specialized MCP server that provides backup and restoration capabilities for AI agents and code editing tools. Tested in both Cursor and Windsurf editors.

Repository: https://github.com/hexitex/MCP-Backup-Server

Why Use This (Not Git)

This system serves a different purpose than Git:

Pros:

  • Creates instant, targeted backups with agent context
  • Simpler than Git for single-operation safety
  • Preserves thought process and intent in backups
  • No commit messages or branching required
  • Better for AI agents making critical changes
  • Works without repository initialization
  • Faster for emergency "save points" during edits

Cons:

  • Not for long-term version tracking
  • Limited collaboration features
  • No merging or conflict resolution
  • No distributed backup capabilities
  • Not a replacement for proper version control
  • Stores complete file copies rather than diffs

When to use: Before risky edits, folder restructuring, or when you need quick safety backups with context.

When to use Git instead: For proper version history, collaboration, and project management.

Features

  • Preserves agent context and reasoning
  • Creates targeted, minimal backups
  • Supports file and folder operations
  • Maintains version history
  • Provides restore safety
  • Uses pattern filtering
  • Tracks operations
  • Allows cancellation

Setup

Installing via Smithery

To install Backup Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @hexitex/MCP-Backup-Server --client claude

Installing Manually

# Install dependencies
npm install

# Build TypeScript files
npm run build

# Start the backup server
npm start

Config

Environment variables:

  • BACKUP_DIR: Backup directory (default: ./.code_backups)
  • EMERGENCY_BACKUP_DIR: Emergency backup directory (default: ./.code_emergency_backups)
  • MAX_VERSIONS: Version limit (default: 10)

Configure in editor:

Windsurf MCP config example:

{
  "mcpServers": {
    "backup": {
      "command": "node",
      "args": ["./dist/index.js"],
      "env": {
        "BACKUP_DIR": "./.code_backups",
        "EMERGENCY_BACKUP_DIR": "./.code_emergency_backups",
        "MAX_VERSIONS": "20"
      }
    }
  }
}

Cursor: Create .cursor/mcp.json with similar config.

Tools

File Operations

  • backup_create: Create backup with context
  • backup_list: List available backups for a file
  • backup_restore: Restore a file with safety backup

Folder Operations

  • backup_folder_create: Backup folder with pattern filtering
  • backup_folder_list: List folder backups
  • backup_folder_restore: Restore folder structure

Management

  • backup_list_all: List all backups
  • mcp_cancel: Cancel operations

When to Use Backups

Use backups purposefully for:

  1. Before Refactoring important code
  2. Before Removing Folders or reorganizing structure
  3. Multiple Related Changes involving several files
  4. Resuming Major Work to preserve context
  5. Before Restores to create emergency safety backup

Keep backups minimal and document their purpose.

Backup Usage Guidelines

  • Use backup MCP server operations for creating, listing, and restoring backups.
  • Backup only before critical code changes, folder removals, or restoring files.
  • Focus backups on files being changed.
  • Provide clear context for each backup.
  • Use pattern filters to exclude irrelevant files.
  • Use relative file paths.
  • Create emergency backups before restore operations.
  • Regularly clean up old backups to maintain efficiency.

For Human Users

Example commands to mention to MCP tool:

Back up my core file before refactoring

Create backup of the API folder before restructuring

Show me my recent backups

Restore my core file from this morning

Agent Examples

Quick Backups

Before project changes:

{
  "name": "mcp0_backup_folder_create",
  "parameters": {
    "folder_path": "./src",
    "include_pattern": "*.{js,ts}",
    "exclude_pattern": "{node_modules,dist,test}/**",
    "agent_context": "Start auth changes"
  }
}

Before core fix:

{
  "name": "mcp0_backup_create",
  "parameters": {
    "file_path": "./src/core.js",
    "agent_context": "Fix validation"
  }
}

Resume Session

View recent work:

{
  "name": "mcp0_backup_list_all",
  "parameters": {
    "include_pattern": "src/**/*.js"
  }
}

Get last version:

{
  "name": "mcp0_backup_restore",
  "parameters": {
    "file_path": "./src/core.js",
    "timestamp": "20250310-055950-000",
    "create_emergency_backup": true
  }
}

Core Changes

Critical update:

{
  "name": "mcp0_backup_create",
  "parameters": {
    "file_path": "./src/core.js",
    "agent_context": "Add validation"
  }
}

Module update:

{
  "name": "mcp0_backup_folder_create",
  "parameters": {
    "folder_path": "./src/api",
    "include_pattern": "*.js",
    "exclude_pattern": "test/**",
    "agent_context": "Refactor modules"
  }
}

Restore Points

Check versions for a file:

{
  "name": "mcp0_backup_list",
  "parameters": {
    "file_path": "./src/core.js"
  }
}

Check folder backups:

{
  "name": "mcp0_backup_folder_list",
  "parameters": {
    "folder_path": "./src/api"
  }
}

Restore a file:

{
  "name": "mcp0_backup_restore",
  "parameters": {
    "file_path": "./src/core.js",
    "timestamp": "20250310-055950-000",
    "create_emergency_backup": true
  }
}

Restore a folder:

{
  "name": "mcp0_backup_folder_restore",
  "parameters": {
    "folder_path": "./src/api",
    "timestamp": "20250310-055950-000",
    "create_emergency_backup": true
  }
}

Management

List recent backups:

{
  "name": "mcp0_backup_list_all",
  "parameters": {
    "include_pattern": "src/**/*.js"
  }
}

Stop a backup operation:

{
  "name": "mcp0_mcp_cancel",
  "parameters": {
    "operationId": "backup_1234"
  }
}

License

MIT