@compare-html/cli provides an MCP (Model Context Protocol) server for AI assistants to compare HTML documents programmatically.
Add the following to your MCP client config (e.g. mcp.json):
{
"mcpServers": {
"compare-html": {
"command": "npx",
"args": ["@compare-html/cli@latest", "--mcp"]
}
}
}
compare_htmlCompare two HTML documents and return their differences.
Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
baseHTMLString | string | No | Base HTML string |
baseHTMLFilePath | string | No | Base HTML file path |
contrastHTMLString | string | No | Contrast HTML string |
contrastHTMLFilePath | string | No | Contrast HTML file path |
options | object | No | Comparison options |
At least one base and one contrast input must be provided.
Options:
| Option | Type | Default | Description |
|---|---|---|---|
arrayCompareMethod | byIndex / lcs / unordered | byIndex | Repeated-element comparison method |
keyCaseInsensitive | boolean | false | Case insensitive tag/attribute name comparison |
valueCaseInsensitive | boolean | false | Case insensitive value comparison |
Output:
Returns an array of HTMLValueDifference objects:
{
"differences": [
{
"pathSegments": ["root", "name"],
"pathString": "root.name",
"pathBelongsTo": "both",
"diffType": "valueChanged"
}
]
}