diff-patch-tools
Cloudflare Workers MCP server: diff-patch-tools
我该使用它吗
质量与安全性
发现(2)
- LOW在 apply_patch 中
- LOW在 three_way_merge 中
基于对工具定义和协议合规性的自动分析。
上下文开销
这是每次将服务器的工具加载到模型上下文窗口时所消耗的大致 token 数。数值越高,可用于其他任务的注意力就越少。
安装
一键安装
将以下内容添加到你的 `claude_desktop_config.json` 文件中:
{
"mcpServers": {
"diff-patch-tools": {
"url": "https://api.lazy-mac.com/diff-patch-tools/mcp"
}
}
}远程端点
https://api.lazy-mac.com/diff-patch-tools/mcpstreamable-http它能做什么
工具清单
工具(6)
⚪text_diff(original, modified, context, original_file, modified_file)
Generate a unified diff between two text strings. Ideal for comparing file versions before and after edits.
输入模式
{
"type": "object",
"properties": {
"original": {
"type": "string",
"description": "Original text"
},
"modified": {
"type": "string",
"description": "Modified text"
},
"context": {
"type": "number",
"description": "Context lines around each change (default 3)"
},
"original_file": {
"type": "string",
"description": "Label for the original file (default \"original\")"
},
"modified_file": {
"type": "string",
"description": "Label for the modified file (default \"modified\")"
}
},
"required": [
"original",
"modified"
]
}🟢json_diff(original, modified)
Compute a structural diff between two JSON values, showing added, removed, and replaced fields.
输入模式
{
"type": "object",
"properties": {
"original": {
"description": "Original JSON value (object, array, or JSON string)"
},
"modified": {
"description": "Modified JSON value (object, array, or JSON string)"
}
},
"required": [
"original",
"modified"
]
}🟡apply_patch(original, patch)
Apply a unified diff patch to an original text and return the patched result.
输入模式
{
"type": "object",
"properties": {
"original": {
"type": "string",
"description": "Original text to patch"
},
"patch": {
"type": "string",
"description": "Unified diff patch string"
}
},
"required": [
"original",
"patch"
]
}⚪three_way_merge(base, ours, theirs, ours_label, theirs_label)
Perform a three-way merge of base, ours, and theirs. Conflicts are marked with standard diff3 conflict markers.
输入模式
{
"type": "object",
"properties": {
"base": {
"type": "string",
"description": "Common ancestor text"
},
"ours": {
"type": "string",
"description": "Our version of the text"
},
"theirs": {
"type": "string",
"description": "Their version of the text"
},
"ours_label": {
"type": "string",
"description": "Label for ours in conflict markers (default \"ours\")"
},
"theirs_label": {
"type": "string",
"description": "Label for theirs in conflict markers (default \"theirs\")"
}
},
"required": [
"base",
"ours",
"theirs"
]
}🟢diff_stats(diff)
Parse a unified diff string and return line-level statistics: additions, deletions, hunks, files changed.
输入模式
{
"type": "object",
"properties": {
"diff": {
"type": "string",
"description": "Unified diff string to analyse"
}
},
"required": [
"diff"
]
}🟡patch_validate(original, patch)
Check whether a unified diff patch can be applied cleanly to an original text without actually applying it.
输入模式
{
"type": "object",
"properties": {
"original": {
"type": "string",
"description": "Original text"
},
"patch": {
"type": "string",
"description": "Unified diff patch string"
}
},
"required": [
"original",
"patch"
]
}社区
证据