Home / MCP / Diff Python MCP Server

Diff Python MCP Server

Provides a Python-based MCP server that returns unified text diffs for two input strings.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "diff_python": {
            "command": "uvx",
            "args": [
                "mcp-server-diff-python"
            ]
        }
    }
}

You can use this MCP server to generate unified diffs between two texts, which is useful for version comparisons, text analysis, and integration with MCP clients. It leverages Python's standard library to produce compact, unified-diff formatted output you can review or feed into other tooling.

How to use

To use this server with an MCP client, you expose the get-unified-diff tool through the MCP runtime and pass two strings for comparison. Provide string_a as the source text and string_b as the target text. The server will return the differences in Unified diff format that you can display, save, or feed into a patch application workflow.

How to install

Prerequisites you need before starting include a working MCP runtime that supports stdio servers (uvx/uv) and Git to clone the project. You will also need Python installed because the server logic is built on Python’s standard library to generate diffs.

Install and run steps

git clone https://github.com/tatn/mcp-server-diff-python.git
cd mcp-server-diff-python
uv sync
uv build

# Start using the MCP runtime with a direct stdio invocation
uvx mcp-server-diff-python

# Or start via the UV runtime by pointing to the local directory
uv --directory path\\to\\mcp-server-diff-python run mcp-server-diff-python

Notes on running with MCP clients

When your MCP client or environment invokes the server, you can choose either the direct stdio method or the UV-based method shown above. The direct method runs the server by name, while the UV-based method explicitly references the local directory and command to start the server. Both approaches will expose the same get-unified-diff functionality to your client.

Additional content

The server focuses on a single capability: producing unified diffs between two input strings. The output is a plain text diff in the widely used Unified Diff format, suitable for patch generation and textual analysis workflows.

Available tools

get-unified-diff

Returns the differences between two input strings in Unified diff format. This tool takes two arguments, string_a and string_b, and outputs a single string containing the diff.