mcp-server-diff-editor

mcp-server-diff-editor

3.4

A powerful MCP-integrated diff editor for modifying files with preview capabilities.

The MCP Diff Editor is a robust tool designed to facilitate file modifications through a web interface, offering real-time diff previews. It allows users to apply changes using either a unified diff format or by replacing the entire file. The editor ensures data integrity by automatically creating backups before any modifications and provides the ability to restore from these backups if needed. Security is a priority, with controls in place to prevent unauthorized access to files. This tool is particularly useful for developers and system administrators who need to manage file changes efficiently and securely.

Features

  • Edit files through a web interface with real-time diff preview
  • Apply changes using unified diff format or complete file replacement
  • Create backups automatically before making changes
  • Restore from previous backups
  • Security controls to prevent unauthorized file access

Usage with Different Platforms

mcp

javascript
const mcp = require('mcp');
const diffEditor = mcp.get('diff_editor');

// Start the server
await diffEditor.start();

// Open the editor for a specific file
const result = await diffEditor.edit_file({
  file_path: '/path/to/your/file.txt'
});

// Get the URL to access the editor
console.log(result.url);

// Apply a diff to a file
await diffEditor.apply_diff({
  file_path: '/path/to/your/file.txt',
  diff_content: `@@ -5,7 +5,7 @@
   <title>Sample Page</title>
 </head>
 <body>
-  <h1>Welcome to our website</h1>
+  <h1>Welcome to our awesome website!</h1>
   <p>Thanks for visiting us.</p>
 </body>
 </html>`
});