Mcp Legal Doc Analyzer

io.github.dbsectrainer由 GitHub 账号 dbsectrainer 发布v1.0.1更新于 Nov 4, 2026

Domain-specific MCP tooling for legal document workflows

已验证STDIO仅桌面效率与工作流文件与存储

概览

AI 生成的概览

本地 MCP 服务器,让助手对合同文档(PDF、DOCX、TXT)提取条款、标记风险、检查合规并比较版本。

可以做什么
  • 从合同中提取并标注条款,附带置信度评分,并用通俗语言总结关键条款
  • 依据合规模板标记风险条款,并执行逐条通过/不通过的清单校验
  • 在条款层面比较两个文档版本,并列出可用的合规模板
  • 导出单文件 HTML 分析报告,或以 JSON、CSV 导出审计日志
  • 批量分析一组合同文件,返回逐文件结果与汇总摘要
适用场景
适合需要审阅合同或法律文档、希望获得条款提取、风险标记、合规清单、版本差异和可打印报告,且不希望把文档发送到外部服务的场景。它只是分析辅助工具而非法律意见,结果仍需由合格法律专业人士复核。
运行要求
通过 npx 以 stdio 在本地运行,需要 Node.js v20.19 或更高版本及 npm。可选参数可指定自定义模板目录、SQLite 数据库路径、置信度阈值、条款模式文件、批量并发数、OCR(需额外 peer 依赖)或 HTTP 模式。声明需要一个 API 密钥环境变量。
安装前请注意
文档在本地解析,分析历史默认存入本地 SQLite 数据库,因此数据库导出文件可能包含机密内容。条款提取依赖模式匹配与启发式规则,对非标准格式可能不完整或有误。服务器声明需要必填的 API 密钥环境变量,但 README 未说明其用途。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Mcp Legal Doc Analyzer,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

MCP Legal Document Analyzer

npm mcp-legal-doc-analyzer package

Domain-specific MCP tooling for legal document workflows. Extract key clauses from contracts, flag risky provisions against configurable rule templates, compare document versions at the clause level, and check compliance against standard checklists — all locally, without documents leaving your machine.

Tool reference | Configuration | Contributing | Troubleshooting

Key features

  • Clause extraction: Identifies and labels clause boundaries (termination, liability, IP, governing law, and more) from PDF, DOCX, and plain-text files.
  • Risk flagging: Checks extracted clauses against YAML rule templates and returns severity-ranked findings.
  • Compliance checking: Validates documents against structured checklists (NDA, employment agreement, SaaS terms) with pass/fail per requirement.
  • Version diffing: Compares two versions of a document at the clause level — not raw text lines.
  • Configurable templates: Rule sets are YAML files that legal professionals can review and edit without writing code.
  • Local-only processing: All parsing and analysis runs on-device; documents are never transmitted externally.

Disclaimers

mcp-legal-doc-analyzer is an analysis aid, not legal advice. Outputs should be reviewed by a qualified legal professional before making decisions. Clause extraction uses pattern matching and heuristics; results may be incomplete or incorrect for non-standard document formats. Low-confidence extractions are flagged explicitly.

Document contents are processed locally and stored in a local SQLite database. Do not share database exports containing confidential documents.

Requirements

  • Node.js v20.19 or newer.
  • npm.

Getting started

Add the following config to your MCP client:

json
{  "mcpServers": {    "legal-analyzer": {      "command": "npx",      "args": ["-y", "mcp-legal-doc-analyzer@latest"]    }  }}

To load custom compliance templates from a directory:

json
{  "mcpServers": {    "legal-analyzer": {      "command": "npx",      "args": ["-y", "mcp-legal-doc-analyzer@latest", "--templates=~/legal/my-templates"]    }  }}

MCP Client configuration

Amp · Claude Code · Cline · Cursor · VS Code · Windsurf · Zed

Your first prompt

Provide a PDF or DOCX contract file, then enter:

Extract the key clauses from this NDA and flag any risky provisions.

Your client should return a list of extracted clauses and a risk report ranked by severity.

Tools

Document analysis (4 tools)

  • extract_clauses — identify and label clause boundaries with confidence scores; supports .pdf, .docx, .txt
  • flag_risks — severity-ranked risk findings against a compliance template
  • check_compliance — structured pass/fail checklist validation per rule
  • summarize_terms — plain-English bullet-point summary of key provisions

Comparison (1 tool)

  • compare_versions — clause-level diff between two document versions

Templates (1 tool)

  • list_templates — enumerate all available compliance templates

Export & bulk (3 tools)

  • export_analysis_report — self-contained HTML report with clause table and risk findings; suitable for printing
  • export_audit_log — export the analysis audit log in JSON or CSV format with optional date-range filtering
  • bulk_analyze — process a portfolio of contract files in batch with progress notifications

Bundled templates

Nine compliance templates are included out of the box:

  1. NDA
  2. Employment Agreement
  3. SaaS Customer Agreement
  4. Software License Agreement
  5. Vendor Agreement
  6. Consulting Agreement
  7. Data Processing Agreement
  8. IP Assignment
  9. Loan Agreement

Use list_templates to enumerate all available templates at runtime, including any custom templates loaded via --templates.

Configuration

--templates / --templates-dir

Directory to load custom YAML compliance rule templates from. Templates in this directory are merged with the built-in set.

Type: string

--db / --db-path

Path to the SQLite database file used to store document analysis history.

Type: string Default: ~/.mcp/legal.db

--confidence-threshold

Minimum confidence score (0–1) for extracted clauses to be included in results. Extractions below this threshold are flagged as low-confidence.

Type: number Default: 0.6

--no-history

Disable storing document analysis results in the local database.

Type: boolean Default: false

--clause-patterns

Path to a YAML file defining custom clause detection patterns. See custom-clause-patterns.example.yaml in the source tree for the schema.

Type: string

--bulk-concurrency

Number of files to process in parallel when using bulk_analyze.

Type: number Default: 4

--ocr

Enable OCR fallback for scanned PDFs that contain no extractable text layer. Requires the optional peer dependencies tesseract.js, pdfjs-dist, and canvas.

Type: boolean Default: false

--http-port

Start the server in Streamable HTTP mode on the given port instead of stdio. When set, the server accepts HTTP connections suitable for shared team deployments.

Type: number

Pass flags via the args property in your JSON config:

json
{  "mcpServers": {    "legal-analyzer": {      "command": "npx",      "args": [        "-y",        "mcp-legal-doc-analyzer@latest",        "--confidence-threshold=0.8",        "--templates=~/legal/templates"      ]    }  }}

Verification

Before publishing a new version, verify the server with MCP Inspector to confirm all tools are exposed correctly and the protocol handshake succeeds.

Run npm run build first so the packaged templates in dist/templates are present during verification.

Interactive UI (opens browser):

bash
npm run build && npm run inspect

CLI mode (scripted / CI-friendly):

bash
# List all toolsnpx @modelcontextprotocol/inspector --cli node dist/index.js --method tools/list
# List resources and promptsnpx @modelcontextprotocol/inspector --cli node dist/index.js --method resources/listnpx @modelcontextprotocol/inspector --cli node dist/index.js --method prompts/list
# Call a tool (example — replace with a relevant read-only tool for this plugin)npx @modelcontextprotocol/inspector --cli node dist/index.js \  --method tools/call --tool-name list_templates
# Call a tool with argumentsnpx @modelcontextprotocol/inspector --cli node dist/index.js \  --method tools/call --tool-name list_templates --tool-arg key=value

Run before publishing to catch regressions in tool registration and runtime startup.

Contributing

Compliance rule templates live in src/templates/ as YAML files and can be contributed without touching code. Clause extraction tests must use synthetic or anonymized documents only — never include real contracts in the repository. Never log document content.

bash
npm install && npm test

MCP Registry & Marketplace

This plugin is available on:

Search for mcp-legal-doc-analyzer.

来源:README.md,提交 41438d0

工具

9

extract_clauses

Extract and label key clauses from a contract document (PDF, DOCX, or TXT). Returns a structured list of clause types (e.g. termination, liability, confidentiality, governing_law, payment_terms, intellectual_property, dispute_resolution, warranty) with confidence scores. Low-confidence results are flagged for human review.

输入参数file_path必填

flag_risks

Analyze a contract against a compliance template and return a severity-ranked list of risk findings. Available templates: NDA, Employment Agreement, SaaS Customer Agreement, Software License Agreement, Vendor Agreement, Consulting Agreement. If no template is specified, the NDA template is used.

输入参数templatefile_path必填

summarize_terms

Generate a plain-English, bullet-point summary of the key provisions in a contract document. Covers clause types including termination, liability, confidentiality, governing_law, payment_terms, intellectual_property, dispute_resolution, and warranty.

输入参数file_path必填

list_templates

List all available compliance templates that can be used with flag_risks, check_compliance, and export_analysis_report. Bundled templates include: NDA, Employment Agreement, SaaS Customer Agreement, Software License Agreement, Vendor Agreement, Consulting Agreement.

无需输入参数。

check_compliance

Run a structured checklist validation of a contract against a compliance template. For each rule, returns pass/fail/not_applicable with a finding description. Available templates: NDA, Employment Agreement, SaaS Customer Agreement, Software License Agreement, Vendor Agreement, Consulting Agreement.

输入参数templatefile_path必填

compare_versions

Compare two versions of a contract document at the clause level. Shows clauses that were added, removed, changed, or unchanged between version A and version B. Supports .pdf, .docx, and .txt files.

输入参数file_path_a必填file_path_b必填

export_analysis_report

Generate a single-file HTML analysis report for a contract. Includes document metadata, extracted clauses with confidence scores, and an optional risk findings table when a template is provided. The HTML is self-contained with inline CSS and is suitable for printing. Available templates: NDA, Employment Agreement, SaaS Customer Agreement, Software License Agreement, Vendor Agreement, Consulting Agreement.

输入参数templatefile_path必填

export_audit_log

Export the analysis audit log. Supports optional date-range filtering and JSON or CSV output format.

输入参数formatto_datefrom_date

bulk_analyze

Analyze a portfolio of contract files in batch. Processes each file sequentially and returns per-file clause extraction results plus an aggregate summary.

输入参数file_paths必填output_formattemplate_name必填

版本历史

2
  1. v1.0.1最新Nov 4, 2026
  2. v1.0.0Sep 16, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分