clausediff-mcp
clausediff-mcp — Offline Contract Redline Diff, DOCX Extractor & Unicode Spoof MCP Server + GitHub Action
Zero-dependency, 100% offline Model Context Protocol (MCP) Server, CLI, and GitHub Action enabling AI coding agents (Claude Desktop, Cursor, Windsurf, Antigravity) and pull-request CI pipelines to diff contract/SLA versions, extract .docx paragraphs + <w:delText> Track-Changes deletions without cloud uploads, detect hidden Unicode spoofing, and scan unbalanced commercial risk patterns.
Disclaimer: Risk Checklist Reference — Not Legal Advice. Consult qualified legal counsel before executing binding agreements.
MCP Tools Exposed (stdio)
Tool | Purpose | Safety Annotations |
| Runs Eugene Myers |
|
| Extracts ordered paragraphs and hidden |
|
| Scans legal, policy, or SLA text for zero-width and Bidi characters ( |
|
| Flags unbalanced commercial risk patterns (back-to-back payment, uncapped indemnity, missing acceptance timeout, auto-renewal traps, background IP sweeps) across 18 bilingual rules with balanced alternatives. |
|
Related MCP server: Word AI
Quick Start (MCP Client & Local CLI)
# Start MCP server over stdio (supports both NDJSON and Content-Length framing)
npx -y github:z121245017-ai/clausediff-mcp
# List MCP tool schemas from terminal
npx -y github:z121245017-ai/clausediff-mcp --list
# Diff two contract or SLA clauses directly from CLI
npx -y github:z121245017-ai/clausediff-mcp --cli diff_contract_versions '{"baselineText":"Invoices are due Net 15 days. Liability is capped at 100% of fees paid.","candidateText":"Invoices are due Net 75 days. Liability is uncapped for all claims."}'Claude Desktop / Cursor / Windsurf / Antigravity Config
{
"mcpServers": {
"clausediff": {
"command": "npx",
"args": ["-y", "github:z121245017-ai/clausediff-mcp"]
}
}
}Docker (node:22-alpine, non-root USER node)
docker build -t clausediff-mcp .
docker run -i --rm clausediff-mcpGitHub Action (z121245017-ai/clausediff-mcp@v1)
Add clausediff-mcp@v1 to .github/workflows/ to inspect legal, policy, terms-of-service, and SLA Markdown files (LEGAL/, SECURITY.md, SLA.md, TERMS.md) for hidden zero-width/homoglyph Unicode spoofs and stealth numeric, percentage, date, or obligation-flip edits in pull requests:
name: Legal & SLA Stealth Mutation Audit
on:
pull_request:
paths:
- 'legal/**'
- 'policies/**'
- '**/*SLA*.md'
- '**/*TERMS*.md'
permissions:
contents: read
jobs:
clausediff-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check policy & SLA Markdown for Unicode spoofs and stealth numeric edits
uses: z121245017-ai/clausediff-mcp@v1
with:
paths: 'legal,policies'
baseline-ref: 'origin/main'
fail-on-spoofs: 'true'
fail-on-stealth-mutations: 'true'Action Inputs & Outputs
Name | Kind | Default | Description |
| Input |
| Newline-, comma-, or space-separated files or directories to inspect. |
| Input |
| Optional Git ref (such as |
| Input |
| Exit |
| Input |
| Exit |
| Input |
| Exit |
| Input |
| Comma-separated directory names skipped during recursive workspace scan. |
| Output | — | Number of Markdown and text policy files inspected. |
| Output | — | Count of hidden Unicode, Bidi, homoglyph, or fullwidth spoofing findings. |
| Output | — | Count of stealth numeric, date, or obligation-flip mutations against baseline. |
| Output | — | Count of high-severity commercial risk signals detected. |
| Output | — | Structured JSON summary of findings. |
Verification
npm testLicense
MIT License — 0 external npm dependencies, 0 network calls, 100% local execution.
Available Tools
4 toolsdetect_unicode_spoofsARead-onlyIdempotent
Scans contract, policy, or SLA text for invisible zero-width and Bidi characters (U+200B..U+200F, U+202A..U+202E, U+FEFF), Cyrillic/Greek homoglyphs, and fullwidth/halfwidth digit spoofing.
Inputs: text (required), referenceText.
diff_contract_versionsARead-onlyIdempotent
Runs Myers O(ND) paragraph alignment and inline token/CJK diff between baseline and counterparty contract drafts, isolating stealth numeric, percentage, date, obligation-flip, and hidden-Unicode mutations.
Inputs: baselineText (required), candidateText (required), contractTitle, onlyChangedClauses.
extract_docx_text_offlineARead-onlyIdempotent
Extracts ordered clause paragraphs and hidden <w:delText> Word Track-Changes deletions from a local .docx file path or Base64-encoded .docx archive with zero cloud calls.
Inputs: filePath, docxBase64.
scan_contract_risk_signalsARead-onlyIdempotent
Flags unbalanced commercial risk patterns (back-to-back payment, uncapped indemnity, missing acceptance timeout, auto-renewal traps, background IP sweeps) across 18 bilingual rules with balanced alternatives.
Inputs: text (required), severityFilter.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct stage: ingestion (extract_docx_text_offline), comparison (diff_contract_versions), character-level scanning (detect_unicode_spoofs), and clause-level risk scanning (scan_contract_risk_signals). The one soft boundary is hidden-Unicode detection, which diff_contract_versions also claims to isolate, potentially overlapping with detect_unicode_spoofs.
All names are snake_case verb-first patterns (diff_, extract_, detect_, scan_), which is predictable. extract_docx_text_offline is the outlier, appending a format and an 'offline' qualifier not seen elsewhere, but overall readability and consistency are strong.
Four tools is within the well-scoped 3-15 range for a focused contract-diff pipeline, and each tool covers a distinct, substantial capability rather than being redundant. Nothing feels padded or arbitrarily split.
The surface covers docx ingestion, version diffing, Unicode spoof detection, and risk flagging, but lacks ingestion for PDF/other common contract formats and any structured report/redline export, which are meaningful gaps for a contract-diff domain. Agents can partially work around by consuming raw diff output, but key lifecycle steps are missing.
Maintenance
Related MCP Connectors
Deterministic OpenAPI 3.x SemVer diff, SPF 10-lookup flattener & WCAG 2.2 / EN 301 549 MCP server.
Diff and poisoning detection for MCP servers: catch schema drift and prompt poisoning.
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
B2B, GovCon & LegalTech MCP server for live RFPs, contract parsing, compliance & proposal tools.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server for reading, editing, and validating Microsoft Word documents with specialized support for track changes, comments, and footnotes. It enables structural auditing, heading extraction, and precise OOXML-level document manipulation through natural language tools.101001,116 PyPI71MIT
- AlicenseBqualityCmaintenanceStructure-preserving Word DOCX editing MCP server with a .NET Open XML backend and Office.js live sessions. Enables safe, auditable, incremental editing of Microsoft Word documents for AI agents.6312 npm10AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceMCP server that watches upstream API providers for breaking changes, scans your codebase for impact, and drafts migration fixes locally, all offline-first with zero network.97 npm1AGPL 3.0
- FlicenseAqualityDmaintenanceMCP server for first-pass legal contract review. It loads txt/docx/pdf contracts, detects standard clauses, flags heuristic risks, summarizes, and compares agreements.8-