keyhoffman/diff-mcp
If you are the rightful owner of diff-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Diff MCP Server is a Model Context Protocol server that enhances text comparison and diffing capabilities for Claude, allowing for precise identification of text differences.
Diff MCP Server
A Model Context Protocol (MCP) server that provides Claude with powerful text comparison and diffing capabilities. This server allows Claude to definitively answer whether two pieces of text are identical and show detailed differences between them.
Features
- Text Comparison: Compare two text strings and determine if they're identical
- Detailed Diffing: Show detailed differences between texts with line-by-line analysis
- Flexible Options: Ignore whitespace, case, or line ending differences
- Edge Case Handling: Properly handles spaces, line endings, and formatting differences
Installation
- Clone this repository
- Install dependencies:
npm install
Development
Build the TypeScript code:
npm run build
Run in development mode:
npm run dev
Usage
Building and Running
-
Build the project:
npm run build
-
Run the server:
npm start
MCP Configuration
Add this to your MCP configuration file (e.g., ~/.config/mcp/servers/diff-mcp.json
):
{
"mcpServers": {
"diff-mcp": {
"command": "node",
"args": ["/path/to/your/diff-mcp-server/dist/index.js"],
"env": {}
}
}
}
Available Tools
1. compare_texts
Compares two text strings and returns whether they are identical.
Parameters:
text1
(string): First text to comparetext2
(string): Second text to compareignoreWhitespace
(boolean, optional): Ignore whitespace differencesignoreCase
(boolean, optional): Ignore case differencesignoreLineEndings
(boolean, optional): Ignore line ending differences
Returns:
{
"identical": true/false,
"summary": "Texts are identical" or "Texts differ: X additions, Y removals"
}
2. get_detailed_diff
Provides detailed differences between two text strings with line-by-line analysis.
Parameters:
text1
(string): First text to comparetext2
(string): Second text to comparecontextLines
(number, optional): Number of context lines to show around changesignoreWhitespace
(boolean, optional): Ignore whitespace differencesignoreCase
(boolean, optional): Ignore case differencesignoreLineEndings
(boolean, optional): Ignore line ending differences
Returns:
{
"identical": true/false,
"differences": [
{
"type": "add|remove|equal",
"value": "text content",
"lineNumber": 1
}
],
"summary": "Texts differ: X lines added, Y lines removed"
}
Example Usage
When Claude has access to this MCP server, it can now:
- Definitively answer identity questions: "Are these two files exactly the same?"
- Show precise differences: "What are the exact differences between these texts?"
- Handle edge cases: Properly detect differences in whitespace, line endings, and formatting
Success Criteria
With this MCP server, Claude can now:
- ✅ Answer "yes, these are 100% identical" or "no, here are the exact differences"
- ✅ Handle edge cases like spaces, line endings, and formatting
- ✅ Provide detailed diff information when texts differ
- ✅ Offer flexible comparison options (ignore whitespace, case, etc.)
License
MIT