Unified Diff MCP Server

Unified Diff MCP Server

Transforms code diffs into beautiful visual comparisons with support for GitHub Gist sharing and local file output (HTML/PNG).

Category
访问服务器

README

Unified Diff MCP Server

smithery badge

Beautiful diff visualization for Claude Desktop. Transform code diffs into stunning visual comparisons with GitHub Gist integration and local file output.

<img src="examples/screenshot.png" alt="Unified Diff Visualization Screenshot" width="800" style="max-width: 100%; height: auto;">

✨ Features

  • 🎨 Beautiful HTML diff visualization using diff2html
  • 🌐 GitHub Gist integration for instant sharing
  • 📁 Local file output (PNG/HTML)
  • 🔄 Auto-delete functionality for temporary diffs
  • 🖥️ Cross-platform support (Windows, macOS, Linux)
  • ⚡ High-performance with Bun runtime
  • 🛡️ Enhanced Security with multi-level protection for shared diffs
  • 🔒 Multi-level security (Low/Medium/High) for different use cases

🚀 Quick Start

Installing via Smithery

bunx @smithery/cli install @gorosun/unified-diff-mcp --client claude --config '{
  "defaultAutoOpen": true,
  "defaultOutputMode": "html",
  "githubUsername": "your_actual_github_username",
  "githubToken": "ghp_your_actual_token_here"
}'

Manual Installation

  1. Install Claude Desktop and Bun
  2. Clone and build:
    git clone https://github.com/gorosun/unified-diff-mcp.git
    cd unified-diff-mcp
    bun install
    
  3. Configure Claude Desktop - see Configuration below

🛠️ Tools Overview

Tool Purpose Output Best For
visualize_diff_html_content Browser display & sharing GitHub Gist + HTML preview URL Quick sharing, instant viewing
visualize_diff_output_file Local file storage PNG/HTML files Local storage, presentations

📖 Usage Examples

🎯 Optimal Prompts by Purpose

Purpose Recommended Prompt Tool Used Output
Quick Preview Please visualize and preview the following diff:<br>以下のdiffを可視化してプレビューしてください visualize_diff_html_content GitHub Gist + HTML preview URL
Local Storage Please visualize and save the following diff to a file:<br>以下のdiffを可視化してファイルに保存してください visualize_diff_output_file Local HTML/PNG file
Share with Others Please visualize the following diff and create a shareable link:<br>以下のdiffを可視化して共有リンクを作成してください visualize_diff_html_content GitHub Gist with shareable URL
Image Export Please visualize and save the following diff as a PNG image:<br>以下のdiffを可視化してPNG画像で保存してください visualize_diff_output_file Local PNG image
Code Review Please visualize the following diff in side-by-side format:<br>以下のdiffをside-by-side形式で可視化してください Either tool Side-by-side comparison
Documentation Please visualize and save the following diff as an HTML file:<br>以下のdiffを可視化してHTMLファイルで保存してください visualize_diff_output_file Local HTML file
🔒 Secure Sharing Please visualize this diff with high security:<br>以下のdiffを高セキュリティで可視化してください visualize_diff_html_content Secret Gist with auto-delete

Share diff instantly (GitHub Gist)

visualize_diff_html_content:
- Creates temporary GitHub Gist
- Auto-deletes after 30 minutes
- Instant browser-ready URLs
- Perfect for code reviews

Save diff locally

visualize_diff_output_file:
- Saves PNG or HTML to local disk
- Auto-opens in browser (optional)
- Perfect for documentation

🎛️ Configuration

Environment Variables

Variable Description Default
GITHUB_TOKEN GitHub Personal Access Token (for Gist integration) Required for visualize_diff_html_content
DEFAULT_AUTO_OPEN Auto-open generated files false
DEFAULT_OUTPUT_MODE Default output format (html or image) html

GitHub Token Setup

  1. Go to GitHub Settings > Personal Access Tokens
  2. Generate new token with gist scope
  3. Add to your environment:
    export GITHUB_TOKEN="your_token_here"
    

Claude Desktop Configuration

macOS:

code ~/Library/Application\ Support/Claude/claude_desktop_config.json

Windows:

code %APPDATA%\Claude\claude_desktop_config.json

Configuration template:

{
  "mcpServers": {
    "unified-diff-mcp": {
      "command": "bun",
      "args": ["run", "/path/to/unified-diff-mcp/src/index.ts"],
      "env": {
        "GITHUB_TOKEN": "your_github_token_here",
        "DEFAULT_AUTO_OPEN": "true",
        "DEFAULT_OUTPUT_MODE": "html"
      }
    }
  }
}

📋 Parameters Reference

Common Parameters

Parameter Type Default Description
diff string (required) Unified diff text
format string side-by-side Display format (line-by-line or side-by-side)
showFileList boolean true Show file list summary
highlight boolean true Enable syntax highlighting
oldPath string file.txt Original file path
newPath string file.txt Modified file path
autoOpen boolean false Auto-open in browser

GitHub Gist Specific

Parameter Type Default Description
expiryMinutes number 30 Auto-delete time (1-1440 minutes)
public boolean false Public vs secret gist

Local File Specific

Parameter Type Default Description
outputType string html Output format (html or image)

🌍 Platform Support

Platform Auto-Open Commands
Windows ✅ start (primary), explorer (fallback)
macOS ✅ open (primary), AppleScript (fallback)
Linux ✅ xdg-open

🔧 Development

Development mode (with hot reload):

{
  "command": "bun",
  "args": ["--watch", "/path/to/unified-diff-mcp/src/index.ts"]
}

Production mode:

{
  "command": "bun",
  "args": ["run", "/path/to/unified-diff-mcp/src/index.ts"]
}

📚 Advanced Usage

🔒 Enhanced Security Levels

When GitHub Token isn't available or for secure sharing, you can choose from multiple security levels:

Security Level Configuration Features Use Cases
🟢 Low Secret Gist + 60min auto-delete URL-only access Code examples, learning
🟡 Medium Secret Gist + Password + 30min auto-delete URL + Access code required Team reviews
🔴 High Secret Gist + Password + 15min auto-delete URL + Access code + Short duration Sensitive code

Usage Example

Please visualize this diff with high security:
--- a/config.js
+++ b/config.js
@@ -1,3 +1,4 @@
 const config = {
-  apiKey: 'old-key'
+  apiKey: 'new-secure-key',
+  timeout: 5000
 };

Response Example:

🔒 **Secure Diff Visualization**

🔴 **Security Level**: High Security - Secret Gist + Password (15min auto-delete)
📋 **Preview Link**: https://htmlpreview.github.io/?...
🔑 **Access Code**: `a7x9k2`
⏰ **Auto-delete**: 15 minutes

🔄 Fallback Functionality

When GitHub Token is unavailable, the system falls back to local files:

  • HTML saved as temporary file
  • Automatic browser opening
  • Security-based file management

For detailed setup and integration guides:

🤝 Supported Clients

  • Claude Desktop (Primary)
  • Claude Code (CLI)
  • VS Code + MCP Extension
  • Cline and other MCP clients

📄 License

MIT License - see LICENSE file for details.

Dependencies

Library License Purpose
diff2html MIT HTML diff generation
playwright-core Apache 2.0 Browser automation
@modelcontextprotocol/sdk MIT MCP integration

Made with ❤️ for the Claude Desktop community

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选