Code Backup MCP server

Provides specialized backup and restoration for code editing tools, creating timestamped snapshots with contextual metadata that preserve both file content and agent reasoning for quick recovery from risky edits.
Back to servers
Setup instructions
Provider
Rob McGlade
Release date
Mar 10, 2025
Language
TypeScript
Stats
8 stars

The MCP Backup Server provides specialized backup and restoration capabilities for AI agents and code editing tools. It creates instant, targeted backups with agent context, preserving your thought process and intent during critical editing operations. Unlike Git, it's designed for quick safety checkpoints rather than comprehensive version control.

Installation

Via Smithery

The easiest way to install the Backup Server for Claude Desktop is automatically via Smithery:

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

Manual Installation

# Install dependencies
npm install

# Build TypeScript files
npm run build

# Start the backup server
npm start

Configuration

Environment Variables

You can configure the server with these environment variables:

  • BACKUP_DIR: Directory for backups (default: ./.code_backups)
  • EMERGENCY_BACKUP_DIR: Directory for emergency backups (default: ./.code_emergency_backups)
  • MAX_VERSIONS: Maximum number of versions to keep (default: 10)

Editor Integration

Windsurf MCP Configuration

Add this to your Windsurf MCP config:

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

Cursor Configuration

Create a .cursor/mcp.json file with similar configuration to the Windsurf example.

Available Tools

File Operations

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

Folder Operations

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

Management Tools

  • backup_list_all: List all backups
  • mcp_cancel: Cancel operations

When to Use Backups

Create backups only in these specific scenarios:

  1. Before Refactoring: When making changes to important code
  2. Before Removing Folders: When reorganizing project structure
  3. Multiple Related Changes: When updating several connected files
  4. Resuming Major Work: When continuing significant changes
  5. Before Restores: Create safety backup before restoring

Usage Examples

Simple Commands for Humans

You may need to explicitly mention the MCP tool when using these commands:

# Back up an important file
"Back up my core file before refactoring"

# Back up a folder before changes
"Create backup of the API folder before restructuring"

# Find previous backups
"Show me my recent backups"

# Restore a previous version
"Restore my core file from this morning"

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
  }
}

Working with Backups

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

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

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

Backup 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"
  }
}

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "backup" '{"command":"node","args":["./dist/index.js"],"env":{"BACKUP_DIR":"./.code_backups","EMERGENCY_BACKUP_DIR":"./.code_emergency_backups","MAX_VERSIONS":"20"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later