mcpField
C
Compare Html

Compare Html

Local
github.com/unitstackDeveloper Tools0Updated 14w ago

About Compare Html

Compare Html is a structured HTML comparison toolkit for developers and coding agents. It reports changes with paths and change types, and includes a library, CLI, MCP server, and agent skill.

Key features

  1. 01Deep comparison of elements, attributes, and text
  2. 02Three child-node matching strategies
  3. 03Case-insensitive matching options
  4. 04Path tracking for each difference
  5. 05CLI with table and JSON output
  6. 06TypeScript library and agent skill

Use cases

  1. 01Reviewing changes between HTML documents
  2. 02Filtering or processing HTML differences by path
  3. 03Using HTML comparison in an MCP-aware assistant

MCP support

The CLI can launch as an MCP server and expose HTML comparison to MCP-aware AI assistants. Run it with the `--mcp` flag.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"compare-html": {
"command": "npx",
"args": [
"-y",
"@compare-html/cli"
]
}
}
}
Run commandnpx -y @compare-html/cli

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@compare-html/cli

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

compare-html

A toolkit for structured HTML comparison — find what changed between two HTML documents, with control over how elements, attributes, and child nodes are matched.

Why

Most HTML diff tools either output unstructured text or hide the parts that matter (where an element was added, whether an array differs in order or in content). compare-html parses HTML into a structured representation and returns a list of differences — every entry carries a path, the side it belongs to (base / contrast / both), and the kind of change (added, deleted, valueChanged) — so you can render, filter, or program against it.

Features

  • Deep comparison of HTML elements, attributes, arrays, and text values.
  • Three child node comparison strategies: byIndex (default), lcs (minimal diff via Longest Common Subsequence), and unordered (multiset match).
  • Case-insensitive tag/attribute name and/or text/attribute value matching.
  • Path tracking with both segment-array and dot-notation forms.
  • CLI with table or JSON output, reading from inline strings or files.
  • MCP server built in — drop the CLI into any MCP-aware AI assistant.
  • Agent Skill — a single skill that works in Claude Code, OpenAI Codex CLI, and OpenCode.
  • Full TypeScript types.

Packages

This is a pnpm workspace:

PackageDescription
@compare-html/coreCore comparison library (programmatic API).
@compare-html/cliCommand-line tool & MCP server, built on top of core.

Quick Start

Library
npm install @compare-html/core
import { compareHTML } from '@compare-html/core';

const differences = compareHTML({
  baseHTML: '<user><name>Alice</name><age>30</age></user>',
  contrastHTML: '<user><name>Bob</name><age>30</age><email>[email protected]</email></user>',
});

// [
//   { pathString: 'user.name',  pathBelongsTo: 'both',     diffType: 'valueChanged', ... },
//   { pathString: 'user.email', pathBelongsTo: 'contrast', diffType: 'added',        ... },
// ]

See the core README for the full API.

CLI
npm install -g @compare-html/cli

compare-html base.html contrast.html
┌──────────────┬──────────────┐
│ Key          │ Change Type  │
├──────────────┼──────────────┤
│ (Base) a     │ valueChanged │
│ (Base) b     │ deleted      │
│ (Contrast) c │ added        │
└──────────────┴──────────────┘

Use --json-export for machine-readable output, or --mcp to launch as an MCP server. See the CLI README for all flags and the MCP tool schema.

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

A single SKILL.md teaches AI coding assistants how to invoke the CLI on demand. The file follows the open Agent Skills format and works across Claude Code, OpenAI Codex CLI, OpenCode, Cursor, and 50+ others.

The fastest install is npx skills — it auto-detects every agent you have installed and drops the skill into each one:

npx skills add unitstack/compare-html

Development

Requires Node.js ≥ 20 and pnpm.

# install dependencies
pnpm install

# build all packages
pnpm -r build

# run tests across the workspace
pnpm -r test

# lint
pnpm -r lint

The repo layout:

packages/
├── compare-html-core/     # @compare-html/core — library
├── compare-html-cli/      # @compare-html/cli  — CLI + MCP server
└── internal/             # shared eslint/tsconfig (not published)
skills/
└── compare-html/          # SKILL.md for Claude Code / Codex CLI / OpenCode

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.