MCP Backup Server

by hexitex
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Offers a complementary approach to Git with simpler, AI-focused backup capabilities for code. Unlike Git, the system creates instant backups with agent context without requiring commit messages or repository initialization, suitable for emergency 'save points' during edits.

  • Uses npm for installation and dependencies, with configuration settings for the MCP server that can be managed through npm scripts and environment variables.

  • Provides backup and restoration capabilities for TypeScript files, allowing targeted backups with pattern filtering (*.ts) and preserving agent context when making critical changes to TypeScript code.

MCP 备份服务器

专用的 MCP 服务器,为 AI 代理和代码编辑工具提供备份和恢复功能。已在 Cursor 和 Windsurf 编辑器中测试。

存储库: https://github.com/hexitex/MCP-Backup-Server

为什么要使用这个(而不是 Git)

该系统的用途与 Git 不同:

优点:

  • 使用代理上下文创建即时、有针对性的备份
  • 比 Git 更简单,确保单操作安全
  • 在备份中保留思考过程和意图
  • 无需提交消息或分支
  • 更适合进行重大改变的人工智能代理
  • 无需初始化存储库即可工作
  • 编辑期间更快地获取紧急“保存点”

缺点:

  • 不适用于长期版本跟踪
  • 有限的协作功能
  • 没有合并或冲突解决
  • 没有分布式备份功能
  • 不能替代适当的版本控制
  • 存储完整的文件副本而不是差异

**何时使用:**在进行有风险的编辑、文件夹重组之前,或者当您需要使用上下文进行快速安全备份时。

**何时使用 Git:**为了正确的版本历史记录、协作和项目管理。

特征

  • 保留代理上下文和推理
  • 创建有针对性的、最小的备份
  • 支持文件和文件夹操作
  • 维护版本历史记录
  • 提供恢复安全
  • 使用模式过滤
  • 轨道操作
  • 允许取消

设置

# Install dependencies npm install # Build TypeScript files npm run build # Start the backup server npm start

配置

环境:

  • BACKUP_DIR :备份目录(./.code_backups)
  • EMERGENCY_BACKUP_DIR :紧急备份(./.code_emergency_backups)
  • MAX_VERSIONS :版本限制(10)

在编辑器中配置:

Windsurf MCP 配置:

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

Cursor:创建具有类似配置的.cursor/mcp.json

工具

文件操作

  • backup_create :使用上下文创建备份
  • backup_list :列出可用的备份
  • backup_restore :使用安全备份恢复

文件夹操作

  • backup_folder_create :使用模式过滤进行备份
  • backup_folder_list :列出文件夹备份
  • backup_folder_restore :恢复文件夹结构

管理

  • backup_list_all :列出所有备份
  • mcp_cancel :取消操作

何时使用备份

仅在真正需要时创建备份:

  1. 重构之前:更改重要代码时
  2. 删除文件夹之前:重组项目结构时
  3. 多个相关更改:更新多个相关文件时
  4. 恢复主要工作:继续进行重大变更时
  5. 恢复前:恢复前创建安全备份

保持备份的最小化和目的性。记录每次备份的必要性。

复制粘贴规则

Always try to use the backup MCP server for operations that require a backup, listing backups and restoring backups. Only backup before critical code changes, folder removal, changes to multiple related files, resuming major work, or restoring files. Keep backups minimal and focused only on files being changed. Always provide clear context for why a backup is being created. Use pattern filters to exclude irrelevant files from folder backups. Use relative file paths when creating backups. Create emergency backups before restore operations. Clean up old backups to maintain system efficiency. Backup tools: backup_create, backup_list, backup_restore, backup_folder_create, backup_folder_list, backup_folder_restore, backup_list_all, mcp_cancel.

对于人类用户

一开始你可能要提到这些简单的命令,比如 MCP 工具

# 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"

代理示例

快速备份

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

恢复会话

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

核心变化

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

还原点

// Check versions { "name": "mcp0_backup_list", "parameters": { "file_path": "./src/core.js" } } { "name": "mcp0_backup_folder_list", "parameters": { "folder_path": "./src/api" } } // 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 } }

管理

// List recent { "name": "mcp0_backup_list_all", "parameters": { "include_pattern": "src/**/*.js" } } // Stop backup { "name": "mcp0_mcp_cancel", "parameters": { "operationId": "backup_1234" } }

执照

麻省理工学院

-
security - not tested
A
license - permissive license
-
quality - not tested

为 AI 代理和代码编辑工具提供备份和恢复功能的专用服务器,创建具有上下文保存的即时目标备份。

  1. Why Use This (Not Git)
    1. Features
      1. Setup
        1. Config
          1. Tools
            1. File Operations
            2. Folder Operations
            3. Management
          2. When to Use Backups
            1. Rules for Copy-Paste
              1. For Human Users
                1. Agent Examples
                  1. Quick Backups
                  2. Resume Session
                  3. Core Changes
                  4. Restore Points
                  5. Manage
                2. License
                  ID: nghymq13i7