MCP (Model Context Protocol)

The Compare JSON MCP server provides a standardized interface for AI assistants to compare JSON data structures through the Model Context Protocol.

Configuration

Add the MCP server to your Claude Code or other MCP-compatible client:

{
  "mcpServers": {
    "compare-json": {
      "command": "npx",
      "args": ["@compare-json/cli@latest", "--mcp"]
    }
  }
}

What is MCP?

The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. The Compare JSON MCP server implements this protocol to provide JSON comparison capabilities.

Features

  • Standardized Interface: Implements the MCP specification for seamless integration
  • Tool-Based Architecture: Exposes JSON comparison as an MCP tool
  • Secure Communication: Uses stdio transport for secure data exchange
  • Type-Safe: Built with TypeScript for reliability
  • Flexible Input: Accepts JSON strings or file paths

Available Tools

compare_json

Compares two JSON values and returns their differences.

Parameters:

  • baseJSON (any): The base JSON (file path or JSON string)
  • contrastJSON (any): The contrast JSON (file path or JSON string)
  • options (object, optional): Comparison options
    • arrayCompareMethod: "lcs" | "unordered" | "by-index"
    • keyCaseInsensitive: boolean
    • valueCaseInsensitive: boolean

Returns: Array of difference objects with type, path, and values.

Example Usage

When using Claude Code or another MCP client, you can ask:

"Compare the JSON in config.json with config.prod.json"

The AI assistant will use the MCP tool to perform the comparison and present the results.

Learn More