Skip to main content
Glama
kwgoodwin

AI Legal Watch MCP

by kwgoodwin
README.md
# AI Legal Watch MCP

MCP server for append-only maintenance of an AI legal developments tracker stored as CSV.

It validates candidate rows, checks for duplicates, preserves historical CSV formatting, and helps rank possible article candidates without directly browsing or judging legal authority.

## What it does

- Reads a tracker CSV and exposes filtered list/digest views
- Dry-runs candidate additions before writing anything
- Appends exactly one approved row when the tracker fingerprint still matches
- Uses a lock to prevent duplicate concurrent appends
- Suggests article candidates with transparent scoring

## What it does not do

- It does not browse the web or verify the legal source for you
- It does not rewrite existing tracker history
- It does not silently merge or normalize old rows beyond tolerated legacy repairs
- It does not require a content archive, though it can fail open when one is configured

## Requirements

- Node.js `20` or newer
- A local MCP client that can launch a stdio server

## Installation

```sh
cd tools/ai-legal-watch-mcp
npm install
npm test
npm run smoke
```

## MCP client setup

Example stdio configuration:

```json
{
  "mcpServers": {
    "ai-legal-watch": {
      "command": "node",
      "args": ["/absolute/path/to/ai-legal-watch-mcp/server.mjs"],
      "env": {
        "AI_LEGAL_WATCH_WORKSPACE": "/absolute/path/to/workspace"
      }
    }
  }
}
```

The tracker defaults to `ai-legal-watch-tracker.csv` in the chosen workspace. Override it with `AI_LEGAL_WATCH_TRACKER` if needed.

If you want candidate suggestion to exclude already-covered rows using a local content archive, set `AI_LEGAL_WATCH_ARCHIVE_ROOT` or `CLEARON_CONTENT_ARCHIVE_ROOT`.

## Safety model

- `propose_tracker_update` never writes
- `apply_tracker_update` appends only one encoded CSV row and requires the exact SHA-256 fingerprint returned by the proposal
- The tracker lock, fingerprint check, and duplicate check are all repeated while the lock is held
- Existing rows are not reserialized, preserving tolerated historical formatting quirks
- New rows must use legal classifications, not publication workflow labels

## Tools

1. `list_watch_items`
2. `find_duplicate_development`
3. `propose_tracker_update`
4. `apply_tracker_update`
5. `generate_watch_digest`
6. `suggest_article_candidates`

## Example workflow

1. Call `find_duplicate_development` with the topic, development date, and official source URL.
2. Call `propose_tracker_update` with the full candidate row.
3. Verify the underlying primary source and legal classification outside this MCP.
4. Call `apply_tracker_update` with the exact `tracker_sha256` and unchanged `candidate`.
5. If the fingerprint is stale, generate a fresh proposal instead of retrying an old payload.

## Development

```sh
npm test
npm run smoke
npm run syntax
```

TDQS

A3.5/5.0

Scored across 6 tools

Disambiguation5/5

Each tool addresses a distinct stage of the workflow: listing, duplicate-checking, digest generation, candidate ranking, proposal dry-run, and final append. There is no meaningful overlap or likely misselection between tools.

Naming Consistency4/5

All tool names use snake_case and an action-first style, which is consistent and predictable. The only minor deviation is that 'find_duplicate_development' is less immediately readable and its noun phrase is somewhat awkward, but it still follows the same pattern.

Tool Count5/5

Six tools is a well-scoped size for this domain. The set covers the full workflow without redundant utilities or unnecessary complexity.

Completeness5/5

The tools cover reading, analyzing, summarizing, ranking, proposing, and applying updates. The append-only nature is intentional and enforced, so the absence of update or delete tools is not a gap.

Maintenance

ActivitySlowing
ResponsivenessNo issues