Cover image
Try Now
2025-03-31

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

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.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Lists Tailwind CSS classes in monospaced font

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

    Reviews

    2 (1)
    Avatar
    user_fFRME026
    2025-04-16

    As a dedicated user of the mcp-server-diff-editor, I must say this tool by samihalawa is incredibly efficient for managing server-side diff operations. Its seamless integration and user-friendly interface make it an essential resource for developers. The GitHub link provides comprehensive documentation, making it easy to get started and utilize its full potential. Highly recommended!