关于 keremurat-jsonmcp
keremurat-jsonmcp 是面向开发者的 JSON 比较 MCP 服务,可递归比较两个 JSON 字符串。它忽略对象、属性和数组顺序,并报告差异路径及类型。
主要功能
- 01递归比较嵌套对象和数组
- 02忽略对象、属性及数组顺序
- 03报告缺失键、多余键和值差异
- 04标注差异所在路径
- 05检查值的数据类型
适用场景
- 01检查配置 JSON 的变更
- 02比较接口返回的 JSON 数据
- 03定位嵌套结构中的差异
MCP 相关
向 MCP 客户端提供 `compare_json` 工具,接收两个 JSON 字符串并返回差异报告。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
服务地址
https://server.smithery.ai/@keremurat/jsonmcp/mcp一键复制安装命令
Claude CodeTerminal
claude mcp add --transport http ai-smithery-keremurat-jsonmcp https://server.smithery.ai/@keremurat/jsonmcp/mcpCursor.cursor/mcp.json
{"mcpServers":{"ai-smithery-keremurat-jsonmcp":{"type":"http","url":"https://server.smithery.ai/@keremurat/jsonmcp/mcp"}}}在 Cursor 中打开VS Code.vscode/mcp.json
{"servers":{"ai-smithery-keremurat-jsonmcp":{"type":"http","url":"https://server.smithery.ai/@keremurat/jsonmcp/mcp"}}}在 VS Code 中打开Claude Desktopclaude_desktop_config.json
{"mcpServers":{"ai-smithery-keremurat-jsonmcp":{"type":"http","url":"https://server.smithery.ai/@keremurat/jsonmcp/mcp"}}}Windsurf~/.codeium/windsurf/mcp_config.json
{"mcpServers":{"ai-smithery-keremurat-jsonmcp":{"serverUrl":"https://server.smithery.ai/@keremurat/jsonmcp/mcp"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
全部服务地址
Streamable HTTP
https://server.smithery.ai/@keremurat/jsonmcp/mcp需要授权工具
详细介绍
🔍 JSON Compare MCP Server
✨ 功能
- 🔍 深度比较 - 涵盖所有层级,包括嵌套对象和数组
- 🔀 无序比较 - 属性和对象的顺序无关紧要
- 📊 详细报告 - 详细报告缺失、多余和不同的值
- 🎯 路径追踪 - 每处差异的准确位置(例如:
root.user.settings.theme) - 🏷️ 类型检查 - 同时比较值的类型
- ⚡ 快速高效 - 经过优化的递归算法
🎯 快速开始
1. 安装
git clone https://github.com/yourusername/json-compare-mcp.git
cd json-compare-mcp
pip install -r requirements.txt
2. 启动 MCP 服务
python server.py
3. 测试
python test_compare.py
📦 包含内容
json-compare-mcp/
├── 🐍 app.py # JSON karşılaştırma implementasyonu
├── 🚀 server.py # MCP server yapılandırması
├── 🧪 test_compare.py # Test suite
├── 📋 requirements.txt # Python bağımlılıkları
├── 🐳 Dockerfile # Container yapılandırması
├── ⚙️ smithery.yaml # Smithery deployment config
└── 📁 test_samples/ # Örnek JSON dosyaları
├── file1.json
├── file2.json
└── file3_different.json
🚀 使用方法
MCP 工具:compare_json
# İki JSON string'ini karşılaştır
compare_json(
json1='{"name": "Ahmet", "age": 30, "city": "Istanbul"}',
json2='{"age": 30, "city": "Istanbul", "name": "Ahmet"}'
)
注意: 现在请直接使用 JSON 字符串,而不是文件路径!
输出格式
{
"status": "different",
"total_differences": 11,
"differences": [
{
"type": "missing_key",
"path": "root.user.settings.language",
"key": "language",
"file1_value": "tr",
"message": "Key 'language' exists in file1 but missing in file2"
},
{
"type": "value_mismatch",
"path": "root.user.name",
"file1_value": "Ahmet Yılmaz",
"file2_value": "Mehmet Demir",
"message": "Value mismatch at 'root.user.name'"
}
],
"summary": {
"missing_keys": 1,
"extra_keys": 2,
"value_mismatches": 8,
"type_mismatches": 0
}
}
🔍 比较逻辑
第 1 层:顶层对象比较
- ✅ 检测两个 JSON 中的顶层对象/键
- ✅ 顺序无关紧要 - 对象可以有不同的顺序
- ✅ 检测缺失/多余的对象并发出警告
- ✅ 对匹配的对象继续进行第 2 层比较
第 2 层:内部对象/属性比较
- ✅ 比较所有属性
- ✅ 顺序无关紧要 - 属性可以有不同的顺序
- ✅ 检查属性是否存在、类型和内容
- ✅ 对数组进行无序比较
差异类型
| 类型 | 说明 |
|---|---|
missing_key | 键存在于 file1 中,但不存在于 file2 中 |
extra_key | 键存在于 file2 中,但不存在于 file1 中 |
value_mismatch | 值不同 |
type_mismatch | 数据类型不同 |
🧪 测试
运行测试套件
python test_compare.py
测试场景
- 无序测试:内容相同,顺序不同 →
identical - 差异检测:值不同 → 详细差异报告
- 与自身比较:同一个文件 →
identical
测试输出
✅ Test 1 - Sıra-bağımsız: BAŞARILI
✅ Test 2 - Farklılık tespiti: BAŞARILI
✅ Test 3 - Aynı dosya: BAŞARILI
🔍 Test 2 Detayları:
- Eksik anahtarlar: 1
- Fazla anahtarlar: 2
- Değer uyuşmazlıkları: 8
- Tip uyuşmazlıkları: 0
- Toplam fark: 11
🛠️ 开发
添加新工具
在 app.py 文件中添加新函数:
def myNewTool(param: str) -> str:
# Your logic
return result
在 server.py 文件中将其注册为 MCP 工具:
@mcp.tool()
async def my_new_tool(param: str) -> str:
"""Tool açıklaması"""
return myNewTool(param)
🚀 部署
Smithery 部署
- 将 Repository 推送到 GitHub
- 在 Smithery 中连接 Repository
- 一键部署!🎉
Docker 部署
docker build -t json-compare-mcp .
docker run -p 8000:8000 json-compare-mcp
手动部署
pip install -r requirements.txt
python server.py
📋 要求
- Python 3.11+
- mcp
- requests
🤝 参与贡献
- 🍴 Fork
- 🌱 创建 Feature 分支
- 💻 进行更改
- 🧪 测试
- 📝 提交 Pull Request
📄 许可证
MIT License - 详情请参阅 LICENSE 文件。
为更出色的 JSON 比较倾注 ❤️
无序、深度、可靠 🚀
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。