compare-xml

stackio/compare-xml
0 Stars 5 次浏览 更新于 2026-08-23

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

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

服务介绍

Start the MCP Server

# from a global install
compare-xml --mcp

# or via npx
npx @compare-xml/cli --mcp

The server communicates over stdio.

Online Playground

Try it out at https://comparexml.com

Available Tools

compare_xml

Compare two XML values and return their differences.

Input parameters:

Parameter Type Required Description
baseXML string conditional Base XML string.
baseXMLString string conditional Base XML as a string (same as baseXML).
baseXMLFilePath string conditional Path to a base XML file (read and parsed by the server).
contrastXML string conditional Contrast XML string.
contrastXMLString string conditional Contrast XML as a string (same as contrastXML).
contrastXMLFilePath string conditional Path to a contrast XML file.
options object No Comparison options (see below).

At least one of baseXML / baseXMLString / baseXMLFilePath must be provided, and at least one of contrastXML / contrastXMLString / contrastXMLFilePath. When more than one is set for a side, file path takes precedence, then string, then raw value.

Options:

Option Type Default Description
arrayCompareMethod 'byIndex' | 'lcs' | 'unordered' 'byIndex' Array comparison strategy.
keyCaseInsensitive boolean false Case-insensitive key comparison.
valueCaseInsensitive boolean false Case-insensitive value comparison.

Output:

Returns structuredContent.differences — an array of XMLValueDifference objects — and a content[0].text mirror of the same data as JSON text.

{
  "differences": [
    {
      "pathSegments": ["root", "name"],
      "pathString": "root.name",
      "pathBelongsTo": "both",
      "diffType": "valueChanged"
    }
  ]
}

MCP Client Configuration

Add the following to your MCP client config (e.g. mcp.json):

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

相关 MCP 服务