Sponsored by Deepsite.site

MCP Diff Editor

Created By
samihalawa9 months ago
Content

MCP Diff Editor

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

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
  • View examples of common diff operations
  • Security controls to prevent unauthorized file access

Usage as MCP

The MCP diff editor provides the following methods:

start

Start the diff editor server

stop

Stop the diff editor server

status

Check server status

edit_file

Open the diff editor for a specific file

  • Parameters:
    • file_path: Path to the file to edit

apply_diff

Apply a diff to a file

  • Parameters:
    • file_path: Path to the file to modify
    • diff_content: Diff content to apply

preview_diff

Preview a diff without applying it

  • Parameters:
    • file_path: Path to the file to preview changes for
    • diff_content: Diff content to preview

Example Usage

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>`
});

Environment Variables

  • PORT: HTTP port (default: 3009)
  • MCP_FILE_DIR: Directory to use as base for file operations (default: current directory)
  • MCP_ALLOW_ANY_PATH: Set to 'true' to allow accessing files outside the working directory

Installation

This module is intended to be used as an MCP in the /Users/samihalawa/Documents/MCP directory and should be automatically available in the MCP interface after installation.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Playwright McpPlaywright MCP server
Tavily Mcp
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
ChatWiseThe second fastest AI chatbot™
Serper MCP ServerA Serper MCP Server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Amap Maps高德地图官方 MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
WindsurfThe new purpose-built IDE to harness magic
CursorThe AI Code Editor
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop