{
  "markdown": "# MCP Legal Document Analyzer\n\nnpm `mcp-legal-doc-analyzer` package\n\nDomain-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.\n\n[Tool reference](#tools) | [Configuration](#configuration) | [Contributing](#contributing) | [Troubleshooting](#troubleshooting)\n\n## Key features\n\n- **Clause extraction**: Identifies and labels clause boundaries (termination, liability, IP, governing law, and more) from PDF, DOCX, and plain-text files.\n- **Risk flagging**: Checks extracted clauses against YAML rule templates and returns severity-ranked findings.\n- **Compliance checking**: Validates documents against structured checklists (NDA, employment agreement, SaaS terms) with pass/fail per requirement.\n- **Version diffing**: Compares two versions of a document at the clause level — not raw text lines.\n- **Configurable templates**: Rule sets are YAML files that legal professionals can review and edit without writing code.\n- **Local-only processing**: All parsing and analysis runs on-device; documents are never transmitted externally.\n\n## Disclaimers\n\n`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.\n\nDocument contents are processed locally and stored in a local SQLite database. Do not share database exports containing confidential documents.\n\n## Requirements\n\n- Node.js v20.19 or newer.\n- npm.\n\n## Getting started\n\nAdd the following config to your MCP client:\n\n```json\n{\n  \"mcpServers\": {\n    \"legal-analyzer\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-legal-doc-analyzer@latest\"]\n    }\n  }\n}\n```\n\nTo load custom compliance templates from a directory:\n\n```json\n{\n  \"mcpServers\": {\n    \"legal-analyzer\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mcp-legal-doc-analyzer@latest\", \"--templates=~/legal/my-templates\"]\n    }\n  }\n}\n```\n\n### MCP Client configuration\n\nAmp · Claude Code · Cline · Cursor · VS Code · Windsurf · Zed\n\n## Your first prompt\n\nProvide a PDF or DOCX contract file, then enter:\n\n```\nExtract the key clauses from this NDA and flag any risky provisions.\n```\n\nYour client should return a list of extracted clauses and a risk report ranked by severity.\n\n## Tools\n\n### Document analysis (4 tools)\n\n- `extract_clauses` — identify and label clause boundaries with confidence scores; supports .pdf, .docx, .txt\n- `flag_risks` — severity-ranked risk findings against a compliance template\n- `check_compliance` — structured pass/fail checklist validation per rule\n- `summarize_terms` — plain-English bullet-point summary of key provisions\n\n### Comparison (1 tool)\n\n- `compare_versions` — clause-level diff between two document versions\n\n### Templates (1 tool)\n\n- `list_templates` — enumerate all available compliance templates\n\n### Export & bulk (3 tools)\n\n- `export_analysis_report` — self-contained HTML report with clause table and risk findings; suitable for printing\n- `export_audit_log` — export the analysis audit log in JSON or CSV format with optional date-range filtering\n- `bulk_analyze` — process a portfolio of contract files in batch with progress notifications\n\n## Bundled templates\n\nNine compliance templates are included out of the box:\n\n1. NDA\n2. Employment Agreement\n3. SaaS Customer Agreement\n4. Software License Agreement\n5. Vendor Agreement\n6. Consulting Agreement\n7. Data Processing Agreement\n8. IP Assignment\n9. Loan Agreement\n\nUse `list_templates` to enumerate all available templates at runtime, including any custom templates loaded via `--templates`.\n\n## Configuration\n\n### `--templates` / `--templates-dir`\n\nDirectory to load custom YAML compliance rule templates from. Templates in this directory are merged with the built-in set.\n\nType: `string`\n\n### `--db` / `--db-path`\n\nPath to the SQLite database file used to store document analysis history.\n\nType: `string`\nDefault: `~/.mcp/legal.db`\n\n### `--confidence-threshold`\n\nMinimum confidence score (0–1) for extracted clauses to be included in results. Extractions below this threshold are flagged as low-confidence.\n\nType: `number`\nDefault: `0.6`\n\n### `--no-history`\n\nDisable storing document analysis results in the local database.\n\nType: `boolean`\nDefault: `false`\n\n### `--clause-patterns`\n\nPath to a YAML file defining custom clause detection patterns. See `custom-clause-patterns.example.yaml` in the source tree for the schema.\n\nType: `string`\n\n### `--bulk-concurrency`\n\nNumber of files to process in parallel when using `bulk_analyze`.\n\nType: `number`\nDefault: `4`\n\n### `--ocr`\n\nEnable OCR fallback for scanned PDFs that contain no extractable text layer. Requires the optional peer dependencies `tesseract.js`, `pdfjs-dist`, and `canvas`.\n\nType: `boolean`\nDefault: `false`\n\n### `--http-port`\n\nStart 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.\n\nType: `number`\n\nPass flags via the `args` property in your JSON config:\n\n```json\n{\n  \"mcpServers\": {\n    \"legal-analyzer\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"mcp-legal-doc-analyzer@latest\",\n        \"--confidence-threshold=0.8\",\n        \"--templates=~/legal/templates\"\n      ]\n    }\n  }\n}\n```\n\n## Verification\n\nBefore publishing a new version, verify the server with MCP Inspector to confirm all tools are exposed correctly and the protocol handshake succeeds.\n\n> Run `npm run build` first so the packaged templates in `dist/templates` are present during verification.\n\n**Interactive UI** (opens browser):\n\n```bash\nnpm run build && npm run inspect\n```\n\n**CLI mode** (scripted / CI-friendly):\n\n```bash\n# List all tools\nnpx @modelcontextprotocol/inspector --cli node dist/index.js --method tools/list\n\n# List resources and prompts\nnpx @modelcontextprotocol/inspector --cli node dist/index.js --method resources/list\nnpx @modelcontextprotocol/inspector --cli node dist/index.js --method prompts/list\n\n# Call a tool (example — replace with a relevant read-only tool for this plugin)\nnpx @modelcontextprotocol/inspector --cli node dist/index.js \\\n  --method tools/call --tool-name list_templates\n\n# Call a tool with arguments\nnpx @modelcontextprotocol/inspector --cli node dist/index.js \\\n  --method tools/call --tool-name list_templates --tool-arg key=value\n```\n\nRun before publishing to catch regressions in tool registration and runtime startup.\n\n## Contributing\n\nCompliance 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.\n\n```bash\nnpm install && npm test\n```\n\n## MCP Registry & Marketplace\n\nThis plugin is available on:\n\n- [MCP Registry](https://registry.modelcontextprotocol.io)\n- [MCP Market](https://mcpmarket.com)\n\nSearch for `mcp-legal-doc-analyzer`.\n",
  "bytes": 7276,
  "sha": "aa8d7fb83e8a1526d6ee833398a08104d7aa47c2fef9f30f4d6c812a26f2f89f",
  "repo_slug": "dbsectrainer/mcp-legal-doc-analyzer",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_dbsectrainer_mcp_legal_doc_ana_f46089cf/readme"
}