Fast Diff MCP Server

Fast Diff MCP Server

A high-performance Model Context Protocol server that provides text diffing capabilities, enabling LLMs to compare two blocks of text and receive differences in unified diff format.

Category
访问服务器

README

Fast Diff MCP Server

CI License Built with Rust

A high-performance Model Context Protocol server that provides text diffing capabilities. This server enables LLMs to efficiently compare two blocks of text and receive the differences in the standard unified diff format.

The core logic is implemented in Rust for maximum speed, offering a significant performance improvement over standard Python libraries. The server exposes both the high-performance Rust implementation and Python's native difflib for comparison and flexibility.

Available Tools

  • diff_tool_rust_similar - Compares two multiline strings using a high-performance Rust implementation (the similar crate's Myers diff algorithm). This is the recommended tool for performance.

    • original_text (string, required): The original text content.
    • modified_text (string, required): The modified text content.
  • diff_tool_python_difflib - Compares two multiline strings using the standard Python difflib library (Ratcliff/Obershelp algorithm). Useful for comparison or when difflib-specific behavior is required.

    • original_text (string, required): The original text content.
    • modified_text (string, required): The modified text content.

Installation & Usage

This project is a Python package with a Rust extension, so it requires a compilation step. The recommended way to install and run it is from a local clone of the repository.

Prerequisites

  • Git
  • Python (>= 3.10)
  • Rust Toolchain
  • uv (for Python environment and package management)

Running from Source

  1. Clone the repository:

    git clone https://github.com/kweinmeister/fast-diff-mcp.git
    cd fast-diff-mcp
    
  2. Install dependencies and compile the extension: This command sets up a virtual environment and installs the package in editable mode.

    uv pip install -e .
    
  3. Run the server: From the root of the project directory, run:

    uv run server.py
    

Configuration

To use this server with an MCP client, you must configure the client to run the server from your local clone of this repository. The commands below assume you are running them from the root of the cloned fast-diff-mcp directory.

Configure for Gemini CLI

Add the following to your ~/.gemini/settings.json file, replacing /path/to/fast-diff-mcp with the absolute path to where you cloned the repository.

<details> <summary>Using uv (from source)</summary>

{
  "mcpServers": {
    "diff": {
      "command": "uv",
      "args": ["run", "server.py"],
      "options": {
        "cwd": "/path/to/fast-diff-mcp"
      }
    }
  }
}

</details>

Configure for Claude.app

Add the following to your Claude settings, replacing /path/to/fast-diff-mcp with the absolute path to where you cloned the repository.

<details> <summary>Using uv (from source)</summary>

{
  "mcpServers": {
    "diff": {
      "command": "uv",
      "args": ["run", "server.py"],
      "options": {
        "cwd": "/path/to/fast-diff-mcp"
      }
    }
  }
}

</details>

Configure for VS Code

Add the following JSON block to your User Settings (JSON) file or a .vscode/mcp.json file in your workspace. Remember to replace /path/to/fast-diff-mcp with the correct absolute path.

Note that the mcp key is needed when using the mcp.json file.

<details> <summary>Using uv (from source)</summary>

{
  "mcp": {
    "servers": {
      "diff": {
        "command": "uv",
        "args": ["run", "server.py"],
        "options": {
          "cwd": "/path/to/fast-diff-mcp"
        }
      }
    }
  }
}

</details>

Benchmarking

This repository includes a script to benchmark the performance of the Rust implementation against Python's difflib.

To run the benchmark, execute the following command from the project root:

uv run benchmark.py

Deploying to Google Cloud Run with Docker

This project is optimized for deployment to serverless platforms like Google Cloud Run using its included multi-stage Dockerfile.

The most direct way to deploy is with the gcloud CLI, which will build the container and deploy it in a single step.

Prerequisites:

  • Google Cloud SDK installed and authenticated (gcloud auth login).
  • A Google Cloud project with billing enabled and the Cloud Run API activated.

To deploy, run the following commands:

# 1. Set your project, region, and service name
export PROJECT_ID="your-google-cloud-project-id"
export REGION="us-central1"
export SERVICE_NAME="fast-diff-mcp"

# 2. Configure gcloud to use your project
gcloud config set project $PROJECT_ID

# 3. Deploy from source
# gcloud will build the image and deploy it to Cloud Run
gcloud run deploy $SERVICE_NAME \
  --allow-unauthenticated \
  --region=$REGION \
  --source .

After a few minutes, gcloud will provide a public URL for your service.

Contributing

Pull requests are welcome! We encourage contributions to help improve this server. Whether you want to add new features, fix bugs, or improve documentation, your input is valuable.

License

Fast Diff MCP Server is licensed under the Apache License 2.0. For more details, please see the LICENSE file in the project repository.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选