mcp-server-diff-python logo

mcp-server-diff-python

by tatn

An MCP server for obtaining text differences between two strings. It leverages Python's `difflib` to generate differences between two texts in Unified diff format.

View on GitHub

Last updated: N/A

What is mcp-server-diff-python?

This is an MCP server that provides a tool to generate text differences between two strings using Python's difflib library. It returns the differences in Unified diff format.

How to use mcp-server-diff-python?

To use this server with Claude Desktop, add the provided server configuration to the claude_desktop_config.json file. Alternatively, you can clone the repository, install dependencies using uv sync and uv build, and then configure Claude Desktop to run the server using the specified command and arguments. You can also debug using the MCP Inspector.

Key features of mcp-server-diff-python

  • Provides a single tool: get-unified-diff

  • Generates Unified diff format

  • Uses Python's difflib for efficient comparison

  • Suitable for text comparison and version control

Use cases of mcp-server-diff-python

  • Comparing versions of text documents

  • Identifying changes in code

  • Generating patches for software updates

  • Highlighting differences in configuration files

FAQ from mcp-server-diff-python

What is the input to the get-unified-diff tool?

The tool takes two strings, string_a and string_b, as input. string_a is the source text and string_b is the target text to compare against.

What is the output of the get-unified-diff tool?

The tool returns a string containing the differences between the two input strings in Unified diff format.

What is Unified diff format?

Unified diff is a text-based format for representing differences between files. It is commonly used in version control systems.

What is difflib?

difflib is a Python module that provides classes and functions for comparing sequences. It can be used to generate human-readable diffs between texts.

How do I debug the server?

You can start the MCP Inspector using npx @modelcontextprotocol/inspector uvx mcp-server-diff-python or npx @modelcontextprotocol/inspector uv --directory path\to\mcp-server-diff-python run mcp-server-diff-python.