developer-tools

JsonDiffPatch

benjamine

by benjamine

JsonDiffPatch: compare and patch JSON with a compact delta format capturing additions, edits, deletions, and array moves

Compares and patches JSON objects with a compact delta format that captures additions, modifications, deletions, and array moves for efficient data synchronization and change visualization.

github stars

5.3K

0 commentsdiscussion

Both formats append explainx.ai attribution and the canonical URL for this MCP server listing.

Smart array diffing with move detectionCompact 16KB footprintReversible patches for undo operations

best for

  • / API developers implementing data synchronization
  • / Building version control for configuration files
  • / Creating undo/redo functionality in applications
  • / Tracking changes in dynamic data structures

capabilities

  • / Compare JSON objects to generate deltas
  • / Apply delta patches to update objects
  • / Reverse deltas to undo changes
  • / Track array element moves and reorders
  • / Generate human-readable diff output
  • / Handle nested object comparisons

what it does

Compares JSON objects and generates compact delta patches that capture all changes including additions, deletions, modifications, and array moves. You can apply these deltas to sync data or reverse them to undo changes.

about

JsonDiffPatch is a community-built MCP server published by benjamine that provides AI assistants with tools and capabilities via the Model Context Protocol. JsonDiffPatch: compare and patch JSON with a compact delta format capturing additions, edits, deletions, and array moves It is categorized under developer tools. This server exposes 1 tool that AI clients can invoke during conversations and coding sessions.

how to install

You can install JsonDiffPatch in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

license

MIT

JsonDiffPatch is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

readme

jsondiffpatch logo

jsondiffpatch

jsondiffpatch.com
Diff & patch JavaScript objects

JsonDiffPatch CI status Created by Benjamin Eidelman License npm stars

--- ## **[Live Demo](https://jsondiffpatch.com)** - min+gzipped ~ 16KB - browser and server (ESM-only) - deep diff, use delta to patch - smart array diffing using [LCS](http://en.wikipedia.org/wiki/Longest_common_subsequence_problem), **_IMPORTANT NOTE:_** to match objects inside an array you must provide an `objectHash` function (this is how objects are matched, otherwise a dumb match by position is used). For more details, check [Array diff documentation](docs/arrays.md) - (optionally) text diffing of long strings powered by [google-diff-match-patch](http://code.google.com/p/google-diff-match-patch/) (diff at character level) - reverse a delta, unpatch (eg. revert object to its original state using a delta) - multiple output formats: - pure JSON, low footprint [delta format](docs/deltas.md) - visual diff (html), see [demo](https://jsondiffpatch.com) - annotated JSON (html), to help explain the delta format with annotations - JSON Patch ([RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902)), can generate patches, and also apply them - console (colored), try running `./node_modules/.bin/jsondiffpatch left.json right.json` - write your own! check [Formatters documentation](docs/formatters.md) - BONUS: `jsondiffpatch.clone(obj)` (deep clone) ## Supported platforms - Any browser that [supports ES6](https://caniuse.com/es6) - Node.js 18, 20+ ## Usage on your terminal: ```sh npx jsondiffpatch --help ``` ![console_demo!](docs/demo/consoledemo.png) or as a library: ```ts // sample data const country = { name: 'Argentina', capital: 'Buenos Aires', independence: new Date(1816, 6, 9), }; // clone country, using dateReviver for Date objects const country2 = JSON.parse(JSON.stringify(country), jsondiffpatch.dateReviver); // make some changes country2.name = 'Republica Argentina'; country2.population = 41324992; delete country2.capital; const delta = jsondiffpatch.diff(country, country2); assertSame(delta, { name: ['Argentina', 'Republica Argentina'], // old value, new value population: ['41324992'], // new value capital: ['Buenos Aires', 0, 0], // deleted }); // patch original jsondiffpatch.patch(country, delta); // reverse diff const reverseDelta = jsondiffpatch.reverse(delta); // also country2 can be return to original value with: jsondiffpatch.unpatch(country2, delta); const delta2 = jsondiffpatch.diff(country, country2); assert(delta2 === undefined); // undefined => no difference ``` Array diffing: ```ts // sample data const country = { name: 'Argentina', cities: [ { name: 'Buenos Aires', population: 13028000, }, { name: 'Cordoba', population: 1430023, }, { name: 'Rosario', population: 1136286, }, { name: 'Mendoza', population: 901126, }, { name: 'San Miguel de Tucuman', population: 800000, }, ], }; // clone country const country2 = JSON.parse(JSON.stringify(country)); // delete Cordoba country.cities.splice(1, 1); // add La Plata country.cities.splice(4, 0, { name: 'La Plata', }); // modify Rosario, and move it const rosario = country.cities.splice(1, 1)[0]; rosario.population += 1234; country.cities.push(rosario); // create a configured instance, match objects by name const diffpatcher = jsondiffpatch.create({ objectHash: function (obj) { return obj.name; }, }); const delta = diffpatcher.diff(country, country2); assertSame(delta, { cities: { _t: 'a', // indicates this node is an array (not an object) 1: [ // inserted at index 1 { name: 'Cordoba', population: 1430023, }, ], 2: { // population modified at index 2 (Rosario) population: [1137520, 1136286], }, _3: [ // removed from index 3 { name: 'La Plata', }, 0, 0, ], _4: [ // move from index 4 to index 2 '', 2, 3, ], }, }); ``` For more example cases (nested objects or arrays, long text diffs) check `packages/jsondiffpatch/test/examples/` If you want to understand deltas, see [delta format documentation](docs/deltas.md) ## Installing ### NPM This works for node, or in browsers if you already do bundling on your app ```sh npm install jsondiffpatch ``` ```js import {* as jsondiffpatch} from 'jsondiffpatch'; const jsondiffpatchInstance = jsondiffpatch.create(options); ``` ### browser In a browser, you can load a bundle using a tool like [esm.sh](https://esm.sh) or [Skypack](https://www.skypack.dev). ## Options ```ts import * as jsondiffpatch from 'jsondiffpatch'; // Only import if you want text diffs using diff-match-patch import { diff_match_patch } from '@dmsnell/diff-match-patch'; const jsondiffpatchInstance = jsondiffpatch.create({ // used to match objects when diffing arrays, by default only === operator is used objectHash: function (obj) { // this function is used only to when objects are not equal by ref return obj._id || obj.id; }, arrays: { // default true, detect items moved inside the array (otherwise they will be registered as remove+add) detectMove: true, // default false, the value of items moved is not included in deltas includeValueOnMove: false, }, textDiff: { // If using text diffs, it's required to pass in the diff-match-patch library in through this proprty. // Alternatively, you can import jsondiffpatch using `jsondiffpatch/with-text-diffs` to avoid having to pass in diff-match-patch through the options. diffMatchPatch: diff_match_patch, // default 60, minimum string length (left and right sides) to use text diff algorithm: google-diff-match-patch minLength: 60, }, propertyFilter: function (name, context) { /* this optional function can be specified to ignore object properties (eg. volatile data) name: property name, present in either context.left or context.right objects context: the diff context (has context.left and context.right objects) */ return name.slice(0, 1) !== '$'; }, cloneDiffValues: false /* default false. if true, values in the obtained delta will be cloned (using jsondiffpatch.clone by default), to ensure delta keeps no references to left or right objects. this becomes useful if you're diffing and patching the same objects multiple times without serializing deltas. instead of true, a function can be specified here to provide a custom clone(value). */ omitRemovedValues: false /* if you don't need to unpatch (reverse deltas), "old"/"left" values (removed or replaced) are not included in the delta. you can set this to true to get more compact deltas. */, }); ``` ## Visual Diff ```html

``` To see formatters in action check the [Live Demo](https://jsondiffpatch.com). For more details check [Formatters documentation](docs/formatters.md) ## Plugins `diff()`, `patch()` and `reverse()` functions are implemented using Pipes & Filters pattern, making it extremely customizable by adding or replacing filters on a pipe. Check [Plugins documentation](docs/plugins.md) for details. ## Related Projects - [jsondiffpatch.net (C#) ](https://github.com/wbish/jsondiffpatch.net) - [SystemTextJson.JsonDiffPatch (C#)](https://github.com/weichch/system-text-json-jsondiffpatch) - [Go JSON Diff (and Patch) ](https://github.com/yudai/gojsondiff) - [json-diff-patch (python)](https:// ---

FAQ

What is the JsonDiffPatch MCP server?
JsonDiffPatch is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
How do MCP servers relate to agent skills?
Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
How are reviews shown for JsonDiffPatch?
This profile displays 39 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.6 out of 5—verify behavior in your own environment before production use.

Use Cases

Extended AI Capabilities

Add new capabilities to Claude beyond text generation

Example

Access external data sources, execute code, interact with tools and services

Transform Claude from chatbot to action-taking agent

Context Enhancement

Provide Claude with access to relevant context and data

Example

Load project documentation, access knowledge bases, query databases

Get more accurate, context-aware responses

Workflow Automation

Automate multi-step workflows combining AI and external tools

Example

Research → Summarize → Create document → Send notification

Complete complex tasks end-to-end without manual steps

Implementation Guide

Prerequisites

  • Claude Desktop 0.7.0+ or Cursor IDE with MCP support
  • Basic understanding of MCP architecture and capabilities
  • Access credentials for integrated services (if required)
  • Willingness to experiment and iterate on configuration

Time Estimate

15-60 minutes depending on server complexity

Installation Steps

  1. 1.Install MCP server: npm install -g [package-name] or via GitHub
  2. 2.Add server configuration to ~/.claude/mcp.json
  3. 3.Provide required credentials and configuration
  4. 4.Restart Claude Desktop to load new server
  5. 5.Test basic functionality with simple prompts
  6. 6.Explore capabilities and experiment with use cases
  7. 7.Document successful patterns for reuse

Troubleshooting

  • MCP server not loading: Check config syntax, verify installation
  • Connection errors: Check network, firewall, credentials
  • Feature not working: Read server docs, check required parameters
  • Performance issues: Monitor resource usage, check for network latency
  • Conflicts with other servers: Check port assignments, namespace collisions

Best Practices

✓ Do

  • +Read server documentation thoroughly before setup
  • +Start with simple use cases to validate functionality
  • +Test in non-production environment first
  • +Monitor resource usage and performance
  • +Keep servers updated for bug fixes and new features
  • +Document configuration for team members
  • +Use environment variables for sensitive configuration

✗ Don't

  • Don't grant overly permissive access to MCP servers
  • Don't skip reading security considerations in docs
  • Don't expose sensitive data without proper controls
  • Don't run untrusted MCP servers without code review
  • Don't ignore error messages—investigate root cause

💡 Pro Tips

  • Combine multiple MCP servers for powerful workflows
  • Create custom MCP servers for your specific needs
  • Share successful configurations with team
  • Use MCP inspector for debugging
  • Join MCP community for tips and troubleshooting

Technical Details

Architecture

Model Context Protocol standardizes how AI hosts (Claude, Cursor) communicate with external tools and data sources through server implementations.

Protocols

  • Model Context Protocol (MCP)
  • JSON-RPC 2.0
  • stdio or HTTP transport

Compatibility

  • Claude Desktop
  • Cursor IDE
  • Custom MCP clients

When to Use This

✓ Use When

Use when you need Claude to access external data, execute actions, or integrate with tools. Best for extending AI capabilities beyond conversation.

✗ Avoid When

Avoid when native integrations exist (use official APIs directly), for real-time critical systems, or when security/compliance requires zero external dependencies.

Integration

  • Tool composition: Chain multiple MCP tools in workflows
  • Context augmentation: Provide AI with relevant external data
  • Action delegation: Let AI execute tasks on external systems
  • Bidirectional sync: Keep AI context and external systems in sync

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.

List & Promote Your MCP Server

Share your MCP server with the developer community

GET_STARTED →
MCP server reviews

Ratings

4.639 reviews
  • Shikha Mishra· Dec 24, 2024

    I recommend JsonDiffPatch for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.

  • Naina Menon· Dec 24, 2024

    According to our notes, JsonDiffPatch benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.

  • Layla Abbas· Dec 20, 2024

    JsonDiffPatch has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.

  • Naina Patel· Dec 4, 2024

    JsonDiffPatch reduced integration guesswork — categories and install configs on the listing matched the upstream repo.

  • Aditi Rahman· Nov 23, 2024

    We wired JsonDiffPatch into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.

  • Yash Thakker· Nov 15, 2024

    JsonDiffPatch is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.

  • Li Gill· Nov 15, 2024

    JsonDiffPatch has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.

  • Layla Li· Nov 11, 2024

    According to our notes, JsonDiffPatch benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.

  • Valentina Kapoor· Oct 14, 2024

    We evaluated JsonDiffPatch against two servers with overlapping tools; this profile had the clearer scope statement.

  • Dhruvi Jain· Oct 6, 2024

    JsonDiffPatch has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.

showing 1-10 of 39

1 / 4