Skip to main content
Glama
Case Chronology MCP Server

Case Chronology MCP Server

by tolafad
README.md
# Case Chronology MCP Server

An MCP server that lets Claude build a dated, cited chronology of events from a folder of case documents.

> **Work in progress** – scaffold only; no tools are implemented yet.

## Status

| Ticket | Description | Status |
|---|---|---|
| 01 | Project scaffold, config, models, CI | Done |
| 01b | Layered layout (domain / infra) + docs structure | Done |
| 02 | Synthetic sample case + trap map | Done |
| 03 | CaseStore, path security, audit logging | Done |
| 04 | `list_documents`, `read_document`, `search_documents`, `case://index` | Done |
| 05 | Date and actor extraction | Not started |
| 06 | `extract_events` tool | Not started |
| 07 | Matcher + `build_chronology` (conflict detection) | Not started |
| 08 | MCP prompt, SKILL.md, Claude Desktop/Code config | Not started |
| 09 | `person_timeline` | Not started |
| 10 | `export_chronology_docx` | Not started |
| 11 | Evals: gold set, scorer, results table | Not started |
| 12 | README, RUNBOOK, Mermaid diagram, demo prep | Not started |
| 13 | HTTP transport with bearer/OAuth auth | Not started |
| 14 | Microsoft Graph (OneDrive/SharePoint) connector | Not started |
| 15 | TypeScript version of one tool | Not started |

## Documentation

- [Architecture](docs/architecture.md)
- [Decisions](docs/decisions.md)
- [Tickets](planning/tickets/)

## Tools

| Tool | Inputs | Returns |
|---|---|---|
| `list_documents` | `doc_type` (optional: `email`, `witness_statement`, `minutes`, `bank_note`, `registry_note`, `memo`, `document`) | `{documents: [{doc_id, title, doc_type, doc_date, date_source, pages}]}` |
| `read_document` | `doc_id`, `page` (>=1, default 1), `page_chars` (500..8000, default 4000) | `{doc_id, page, total_pages, text}` |
| `search_documents` | `query` (1..200 chars; every word must match, literal), `max_results` (1..50, default 10) | `{results: [{doc_id, snippet, line}], total_matches, truncated}` |

Resource `case://index`: JSON with every document summary and the cast list.

Errors reach the client as `CODE: message` (`INVALID_INPUT`, `DOC_NOT_FOUND`, `FILE_TOO_LARGE`, `INTERNAL`);
never a path or stack trace. Every call appends one line to the audit log (no document text).

## Setup

```bash
uv sync
uv run pytest -q
```

## Configuration (environment variables, prefix `CASE_`)

PowerShell:

```powershell
$env:CASE_ROOT = "C:\path\to\sample_case"
uv run python -m case_chronology.server
```

bash:

```bash
CASE_ROOT=./sample_case uv run python -m case_chronology.server
```

| Variable | Default | Notes |
|---|---|---|
| `CASE_ROOT` | required | existing directory of case documents |
| `CASE_OUTPUT_DIR` | none | required when `CASE_ALLOW_WRITE=true` |
| `CASE_ALLOW_WRITE` | `false` | enables the docx export only |
| `CASE_AUDIT_LOG` | `./logs/audit.jsonl` | JSON-lines audit log |
| `CASE_MAX_FILE_MB` | `10` | 1..100 |
| `CASE_DATE_ORDER` | `DMY` | `DMY` or `MDY` |
| `CASE_MATCH_WINDOW_DAYS` | `30` | 0..365 |
| `CASE_NAME_MATCH_THRESHOLD` | `88` | 50..100 |
| `CASE_LOG_LEVEL` | `INFO` | `DEBUG`, `INFO`, `WARNING`, `ERROR`; logs go to stderr only |

TDQS

A4.2/5.0

Scored across 3 tools

Disambiguation5/5

The three tools have clearly distinct roles: enumeration (list_documents), full reading (read_document), and literal line-level lookup (search_documents). Descriptions explicitly state the intended ordering and hand-off (list first, search then read for context), leaving no ambiguity about which tool to pick.

Naming Consistency5/5

All three names follow the same verb_noun snake_case convention: list_documents, read_document, search_documents. No camelCase or vague verbs, and the resource noun is consistent throughout.

Tool Count4/5

Three tools is a tight, well-scoped set for read-only document access where each tool earns its place. It is on the thin side — there is a single tool per operation and no dedicated timeline/metadata helper despite the 'Case Chronology' framing.

Completeness3/5

Coverage of the retrieval lifecycle (enumerate, read, locate) is complete and no obvious dead ends exist for reading evidence. However, the server's stated purpose is chronology, and there is no tool to extract or assemble dated events/timeline, and no document-metadata tool beyond the listing — a notable gap.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues