Skip to main content
Glama

ndlaw

A Model Context Protocol (MCP) server for North Dakota Supreme Court opinions, 1889–present (plus a small number of North Dakota Court of Appeals decisions). Coverage is complete since statehood (November 2, 1889); the court issued its first opinions in 1890. Built on SQLite with FTS5 full-text search and served via FastMCP.

The opinions corpus currently contains 20,146 opinions with 127,505 citation links between them, with per-release corrections summarized in the release notes. Where the court's own print contains an apparent typo, the text is preserved verbatim; where that typo is in a citation, the citation graph still resolves it to the case the court meant.

It also serves North Dakota primary law — the Constitution (a point-in-time layer spanning 1889–present), N.D.C.C. statutes, court rules, and the Administrative Code — from separate per-corpus databases. See Primary law below for what each database contains.

Not an official court product. This is an independent, unofficial project. It is not published, endorsed, or maintained by the North Dakota Supreme Court, the North Dakota Court System, or any agency of the State of North Dakota, and nothing here is an official version of any opinion, statute, rule, or regulation. The official sources are the court's own publications (ndcourts.gov) and the Legislative Branch's (ndlegis.gov); verify there before relying on or filing anything.

No claim to official government works. The opinions, statutes, rules, and regulations reproduced here are works of North Dakota's government, reproduced as public documents; this project claims no rights in them. What the project adds — the compilation, corrections, citation graph, and software — is released under CC0 (see NOTICE.md).

This is a working tool, not an authoritative text. See NOTICE.md for sources, redistribution scope, and attribution.

To install it, jump to Quick start below.


MCP tools exposed

Tool

Purpose

lookup_opinion

Retrieve an opinion by any citation (neutral, N.W.2d, N.W.)

get_opinion_text

Read opinion text in paginated chunks

search_opinions

Full-text search with date/author filters

list_opinions_by_date

Browse opinions by date range

get_database_stats

Corpus summary: totals, date range, coverage by decade, most-published authors

justice_info

Voting record for a case, or aggregate stats for a justice

search_by_case_type

Filter by case type (criminal, civil, etc.)

get_citing_opinions

Find opinions that cite a given opinion

verify_citation

Confirm a cite/case name and return its canonical form + Redbook-ordered cites; flags name drift

report_corpus_issue

Flag an apparent defect in stored text (garbled words, misplaced footnote, wrong version for a date) for human review

get_parallel_citations

Return a case's full parallel-cite set (synthetic IDs bracketed separately)

verify_quotation

Confirm a quoted passage is verbatim (typography-tolerant) and return the pinpoint ¶

get_pinpoint

Resolve a paragraph number to its text, or a quote to the ¶ it lives in

check_treatment

Citator: citing opinions with citing-sentence context + a conservative, non-authoritative treatment signal

get_cited_authorities

Outbound authorities a case relies on (cases, statutes, rules, constitution), grouped with source links

case_summary

One-call bench-memo front matter: cites, panel, voting, disposition, ¶ count, syllabus points

get_subsequent_history

Related opinions sharing the docket (rehearings, supplemental, companions)

authoring_justice_on_issue

A justice's authored opinions matching an issue (predictive bench-memo signal)

search_boolean

Boolean/proximity search (& | % /N /s /p !), translated to FTS5

search_faceted

Filter by date, author, case type, disposition, dissent/concurrence, unanimity (+ optional full text)

find_opinions_construing

Every opinion citing an N.D.C.C. section or court rule, with the official source link

more_like_this

Doctrinally similar opinions (hybrid co-citation + keyword ranking)

detect_overruled_in_draft

Scan a draft's cited cases through the citator; flag possible negative treatment (with citing context)

Primary law (Constitution, court rules, N.D.C.C. statutes, Admin. Code)

Beyond opinions, the server serves North Dakota primary law from separate per-corpus SQLite databases, each ATTACH-ed onto the opinions connection at startup (the server serves whatever corpus DBs are present). All use a shared point-in-time versioned-provision schema, so lookup_authority accepts an as_of_date to return a provision's text as it stood on a given date.

Database

Corpus

Contents (approx.)

opinions.db

ND Supreme Court opinions (+ some Court of Appeals)

20,146 opinions, 127,505 citation links, 1889–present

constitution.db

ND Constitution

~496 provisions / 774 dated versions, point-in-time across the full 1889–present span: a modern article/§ layer (1981–present, with the 1981/1986/1997 article reorganizations and post-1981 amendments reconstructed) + a historical layer in the original 1889 numbering (§§ 1–217 + Schedule + amendment articles, in force 1889–1980), plus the amendment chronology

statutes.db

N.D.C.C. (statutes)

~32,800 Century Code sections, ~54,600 dated versions (point-in-time since the first capture, 1997–2004)

rules.db

ND court rules

~650 rule provisions

admincode.db

ND Administrative Code

~13,800 provisions

ag_opinions.db

ND Attorney General opinions

~6,750 published opinions, 1942–present, cross-linked to the statutes/Constitution/rules/admin/opinions they cite (~35,000 citation links)

N.D.C.C. point-in-time text (since v4.0.0). statutes.db carries every compiled version of each Century Code section since the Legislative Council's PDFs were first captured (1997–2004 for most chapters; 54,600 dated versions of 32,800 sections), so as_of_date returns the text in force on a date and get_authority_history lists the versions with the session law behind each. Read the dating with care, and read the warning the tools attach: a date traced to an act is reliable; a reviser-estimated date is the first capture showing a change no session law explains and the text may have been in force earlier; a floor date is only "in force no later than"; text the Council posts ahead of its effective date is served as a separate, dated version; and where an act amended a section between two captures and the amended text was never captured, a dated lookup inside that gap returns no text and names the act. Sections the code no longer prints at all (3,644 in chapters repealed, expired, redesignated or superseded by the court rules since 2003) are served from the capture chain with the Council's repeal notation as their final version, dated for the act section the notation names (a deferred repeal keeps its deferred date; an expiry ends the day after its "through" date) or by the Council's own "(Repealed effective …)" note, and only where none dates it a flagged estimate or, where no text was ever captured, a floor at the stub's first capture; text the Council kept posting after a repeal took effect ends at the act's date; 66 more are held back (superseded-chapter sections whose captures still print text, and a few parse-suspect captures). Pre-1997 text is not compiled, and the "current text effective …" stamps remain a lead to confirm in the session laws, not a finding.

Each ships as its own GitHub release asset (<name>.db.zip + .sha256) — see Quick start to install them locally and deploy/SETUP.md for the server-side multi-corpus delivery. Both constitutional layers are as_of_date-queryable: the modern layer by its article/§ citation (e.g. lookup_authority("N.D. Const. art. VIII, § 6", as_of_date="1990-01-01")) and the historical layer by its original 1889 citation (e.g. lookup_authority("N.D. Const. § 82", as_of_date="1945-01-01")). The two numbering schemes are cross-linked through the official 1981 disposition tables (NDCC Replacement Vol. 13): a modern cite at a pre-1981 date returns its original-section predecessor, and an original §-cite at a post-1981 date returns its modern successor — each answer carries provenance (requested_citation, returned_provision, relation, a source note), and lookups that would land past a wholesale article replacement (1982/1986/1997) say so rather than implying content continuity. get_authority_history merges the pre- and post-1981 amendment chronologies into one timeline per provision. The primary-law corpora are newer and less exhaustively validated than the opinions corpus, though the constitution layer has now been verified section-by-section against the official annotated apparatus and every usable printed compilation 1889–1989.

Tool

Purpose

lookup_authority

Text of a constitutional / rule / statute / admin-code provision (with as_of_date for the version in force)

search_authority

Full-text search across the primary-law corpora

get_authority_history

Amendment / version history of a provision

constitutional_amendments

The ND Constitution's amendment chronology

search_ag_opinions

Full-text search across ND Attorney General opinions (1942–present)

lookup_ag_opinion

An AG opinion by number (e.g. 2015-L-12) + the authorities it cites

get_ag_opinions_citing

AG opinions that cite a given statute / constitutional / rule / case authority

get_court_opinions_citing_ag

Court opinions that cite a given AG opinion (the inbound direction)

See Quick start to install the server and Connecting to Claude to wire it into an MCP client.


What a public server records

A deployment that sets NDLAW_TOOLLOG writes one line per tool call: the tool's name, timing, response size, an opaque per-connection session id, the client's IP hop and User-Agent, and — only for tools whose argument is named citation — that citation. Free-text arguments (search queries, draft text, quotations) and results are never logged. report_corpus_issue reports are written in full to NDLAW_REPORTLOG for human review and are never applied to the corpus automatically. See ndlaw_mcp/toollog.py and ndlaw_mcp/corpus_reports.py for the exact fields.

Related MCP server: South Dakota Code

What's in the database

Counts below are as of 2026-08-21; the corpus total is 20,146 opinions (of which 80 are North Dakota Court of Appeals decisions and the rest North Dakota Supreme Court) — rerun sqlite3 opinions.db "SELECT COUNT(*) FROM opinions" for the live total.

Era

Opinions

Notes

1890–1952

~6,530

includes the court-authored "Syllabus by the Court" that accompanies opinions of this era

1953–1996

~6,300

validation of a residual slice of the earliest N.W.2d years is ongoing

1997–2019

~5,650

neutral-citation era (2019 ND 54)

2020–present

~1,630

The database ships the court's text and the citation graph over it. It does not ship the development record behind that text — the correction history, the working copies collated to produce it, or the pipeline's own bookkeeping. Those are maintained separately and are not needed to read an opinion or to verify a citation. See NOTICE.md for what is and isn't redistributed in text_content, and the release notes for the corrections in each published version.


Quick start

The easy way: let Claude do it

If you're already a Claude user, the simplest install is to ask Claude to do it for you. Paste the prompt below into Claude Code (CLI), Claude Desktop (Mac/Windows), or Claude on the web (claude.ai). Claude will read this repository's README.md and NOTICE.md, detect your platform, walk you through the steps, and — if running in an environment with shell access (Claude Code, or Claude Desktop with appropriate MCP servers) — run them for you. After install it will add the server to your Claude MCP config and verify it works.

Please help me install the ndlaw server from https://github.com/jet52/ndlaw on my computer. Read the repository's README.md and NOTICE.md first so you understand what it is and what it redistributes. Then walk me through (or run for me, if you can) the install steps for my platform, download the latest opinions.db release asset, smoke-test it, and add the server to my Claude MCP config. Stop and ask me before any step that needs a decision.

If you'd rather do it by hand, the manual instructions follow.

1. Prerequisites — all platforms

  • Python 3.12 or newer

  • git

  • ~1 GB of free disk space (for the database)

  • An MCP-capable client (e.g. Claude Desktop, Claude Code) — optional, only needed if you want LLM integration

2. Install the code and database

Pick your platform. The commands install uv, clone the repo, download the latest release of the database, and install the Python dependencies.

Windows (PowerShell)

# Install uv (a fast Python package manager) — skip if already installed
irm https://astral.sh/uv/install.ps1 | iex

git clone https://github.com/jet52/ndlaw.git
cd ndlaw

# Download + extract every database release asset (opinions + primary-law corpora).
# The corpus DBs ship from v0.11.0 on; opinions.db is the only one in older releases.
foreach ($db in "opinions","constitution","statutes","rules","admincode") {
  Invoke-WebRequest `
    -Uri "https://github.com/jet52/ndlaw/releases/latest/download/$db.db.zip" `
    -OutFile "$db.db.zip"
  Expand-Archive "$db.db.zip" -DestinationPath . -Force
  Remove-Item "$db.db.zip"
}

uv sync

macOS

# Install uv — skip if already installed
curl -LsSf https://astral.sh/uv/install.sh | sh

git clone https://github.com/jet52/ndlaw.git
cd ndlaw

# Download + extract every database release asset (opinions + primary-law corpora).
# The corpus DBs ship from v0.11.0 on; opinions.db is the only one in older releases.
for db in opinions constitution statutes rules admincode; do
  curl -LO "https://github.com/jet52/ndlaw/releases/latest/download/$db.db.zip"
  unzip -o "$db.db.zip" && rm "$db.db.zip"
done

uv sync

Linux

# Install uv — skip if already installed
curl -LsSf https://astral.sh/uv/install.sh | sh

git clone https://github.com/jet52/ndlaw.git
cd ndlaw

# Download + extract every database release asset (opinions + primary-law corpora).
# The corpus DBs ship from v0.11.0 on; opinions.db is the only one in older releases.
for db in opinions constitution statutes rules admincode; do
  curl -LO "https://github.com/jet52/ndlaw/releases/latest/download/$db.db.zip"
  unzip -o "$db.db.zip" && rm "$db.db.zip"
done

uv sync

3. Smoke test

Confirm the database is wired correctly:

sqlite3 opinions.db "SELECT COUNT(*) FROM opinions"          # exact count
# Primary-law corpora (if you downloaded them):
sqlite3 constitution.db "SELECT COUNT(*) FROM provisions"    # ~496
sqlite3 statutes.db     "SELECT COUNT(*) FROM provisions"    # ~32,800

Updating to a newer database release

When a new database release is published, replace the local copy:

# macOS / Linux — refresh every database (or list just the ones you use)
for db in opinions constitution statutes rules admincode; do
  rm -f "$db.db"
  curl -LO "https://github.com/jet52/ndlaw/releases/latest/download/$db.db.zip"
  unzip -o "$db.db.zip" && rm "$db.db.zip"
done
# Windows PowerShell
foreach ($db in "opinions","constitution","statutes","rules","admincode") {
  Remove-Item "$db.db" -ErrorAction SilentlyContinue
  Invoke-WebRequest `
    -Uri "https://github.com/jet52/ndlaw/releases/latest/download/$db.db.zip" `
    -OutFile "$db.db.zip"
  Expand-Archive "$db.db.zip" -DestinationPath . -Force
  Remove-Item "$db.db.zip"
}

Then git pull to pick up any code changes since the release was cut.

4. Run

MCP server (stdio mode, for Claude Desktop / Claude Code):

uv run ndlaw-mcp

Connecting to Claude

The server can run under any MCP client. The two most common are Claude Code (CLI, all platforms) and Claude Desktop (Mac and Windows only — no Linux build is shipped today).

Throughout the snippets below, replace /absolute/path/to/ndlaw with the full path to your cloned repo. On Windows you can use forward slashes in JSON strings (C:/Users/you/ndlaw) — they work fine and avoid double-backslash escaping.

Claude Code (Windows, macOS, Linux)

One-liner from any directory:

claude mcp add ndlaw -- uv --directory /absolute/path/to/ndlaw run ndlaw-mcp

This stores the server in your user-level Claude Code config and makes it available in every project. Restart any active Claude Code session and the ndlaw server's tools will be available.

Alternative: a project-scoped .mcp.json in any project where you want ndlaw available. Create the file with:

{
  "mcpServers": {
    "ndlaw": {
      "type": "stdio",
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/ndlaw",
               "run", "ndlaw-mcp"]
    }
  }
}

Claude Desktop (macOS)

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "ndlaw": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/ndlaw",
               "run", "ndlaw-mcp"]
    }
  }
}

Then quit and restart Claude Desktop (Cmd-Q, not just close the window).

Claude Desktop (Windows)

Edit %APPDATA%\Claude\claude_desktop_config.json. Same JSON shape, but specify the absolute paths to both uv and your repo. If uv is on your PATH (it is by default after the install script), "command": "uv" works; otherwise use the full path, e.g. "C:/Users/you/.local/bin/uv.exe".

{
  "mcpServers": {
    "ndlaw": {
      "command": "uv",
      "args": ["--directory", "C:/Users/you/ndlaw",
               "run", "ndlaw-mcp"]
    }
  }
}

Then quit and restart Claude Desktop from the system tray.

Linux

Claude Desktop is not available on Linux. Use Claude Code (above).

Verifying the connection

Once connected, try a prompt like:

Use ndlaw to look up State v. Boger, 2021 ND 152.

The tool call should return the case metadata and (with include_text=true) the opinion text. For the full set of tools, see the MCP tools exposed table near the top.


Remote / team deployment

By default the server speaks stdio — each user runs their own copy and their MCP client launches it as a subprocess (the configs above). To serve a whole team from one host instead, the same server can run over Streamable HTTP. The opinion data is public (CC0), so the goal of auth here is access control, not secrecy; the recommended posture is work-network / VPN-only with a bearer token, with TLS and the token check handled by a reverse proxy in front of the app.

The only thing the app itself needs is three environment variables:

Variable

Purpose

Default

NDLAW_TRANSPORT

http (Streamable HTTP) or sse; anything else = stdio

stdio

NDLAW_HOST

bind address — keep 127.0.0.1 so only the local proxy can reach it

127.0.0.1

NDLAW_PORT

bind port

8000

NDLAW_DB

path to opinions.db on the server

bundled / app-data

NDLAW_CONST_DB

path to constitution.db (ND Constitution corpus)

bundled / app-data

NDLAW_NDCC_DB

path to statutes.db (N.D.C.C. corpus)

bundled / app-data

NDLAW_RULE_DB

path to rules.db (court-rules corpus)

bundled / app-data

NDLAW_ADMIN_DB

path to admincode.db (Admin. Code corpus)

bundled / app-data

NDLAW_AG_DB

path to ag_opinions.db (Attorney General opinions)

bundled / app-data

The MCP endpoint is /mcp (no trailing slash — /mcp/ issues a 307 redirect, which some clients mishandle on POST).

The tools are read-only (search / lookup / citation analysis); the data-editing CLIs are not exposed over MCP.

Run it as a service (systemd)

# /etc/systemd/system/ndlaw-mcp.service
[Unit]
Description=ndlaw-mcp (Streamable HTTP)
After=network.target

[Service]
User=ndcourts
WorkingDirectory=/srv/ndcourts/ndlaw-mcp
Environment=NDLAW_TRANSPORT=http
Environment=NDLAW_HOST=127.0.0.1
Environment=NDLAW_PORT=8000
Environment=NDLAW_DB=/srv/ndcourts/opinions.db
ExecStart=/srv/ndcourts/ndlaw-mcp/.venv/bin/ndlaw-mcp
Restart=on-failure

[Install]
WantedBy=multi-user.target

Terminate TLS and enforce the token (Caddy)

mcp.court.example {
    # only requests carrying the shared token reach the app
    @authorized header Authorization "Bearer REPLACE_WITH_A_LONG_RANDOM_TOKEN"
    handle @authorized {
        reverse_proxy 127.0.0.1:8000
    }
    respond "Unauthorized" 401
}

For revocable, per-person access, give each user a distinct token and add a matching @authorized line per token. Restrict the host's firewall so the proxy port is reachable only from the VPN subnet.

What each team member runs

claude mcp add --transport http ndlaw https://mcp.court.example/mcp \
  --header "Authorization: Bearer REPLACE_WITH_A_LONG_RANDOM_TOKEN"

(Claude Desktop: add an equivalent "type": "http" server with a headers block in claude_desktop_config.json.) Users connect to the VPN first, then the client reaches the server.

Updating the deployed database

The weekly pipeline regenerates opinions.db. Because it is served read-only, deploying an update is just: copy the new file to the server, then systemctl restart ndlaw-mcp.

Public VPS test (open internet)

The model above is VPN-only with a bearer token. To instead expose the server on the public internet for a quick test — with TLS + HTTP Basic Auth + rate limiting + fail2ban — use the ready-to-run Ubuntu templates in deploy/:

  • deploy/SETUP.md — step-by-step Ubuntu 22.04/24.04 walkthrough (system user, uv install, database download, systemd, Caddy with the rate-limit plugin, ufw, SSH hardening, fail2ban, client config).

  • deploy/Caddyfile — auto-HTTPS, per-IP rate_limit, basic_auth, and flush_interval -1 so MCP's SSE streaming isn't buffered.

  • deploy/ndlaw-mcp.service — hardened systemd unit bound to localhost.

  • deploy/fail2ban/ — filter + jail that ban IPs on repeated 401s.

The data is public (CC0), so this auth is access control and abuse prevention, not secrecy.


Sources, redistribution scope, and license

Code: dedicated to the public domain under CC0 1.0 Universal. Use it however you want.

Data: the opinions database redistributes only the court's own published work (opinions and court-authored syllabi) plus factual record content (parties, dates, attorneys, dispositions, citations). Judicial opinions of state courts are edicts of government and are not protected by copyright; what is published here is the North Dakota courts' own text. See NOTICE.md for the redistribution scope in full.


Building one for another jurisdiction

Nothing here is North Dakota-specific except the sources and a few tables. (This repository is the serve-only half; the ingest pipeline lives in the development repository. The method is what transfers.) The shape: raw sources kept as untouched witnesses, one SQLite database per corpus, a citation graph, a correction log, and a thin MCP layer on top. This is the order that worked.

1. Decide what the corpora are, and what the unit of each one is

Two kinds of law need two data models. Opinions are immutable dated documents: one row per opinion, parallel citations in a side table, text searched with FTS5. Codes — constitution, statutes, court rules, regulations — are versioned provisions: a stable identity (art. I, § 8, § 28-32-46, Rule 12) with dated text versions, so a query can ask for the text in force on a given date. Decide early how you will name every unit, because the citation graph resolves cross-references by exact string match on that canonical name.

2. Locate the sources

For each corpus, find the official publisher first, then the independent witnesses. What we used, and where the equivalents usually live:

Corpus

Official

Independent witnesses

Opinions, modern

The court's own site: slip PDFs plus a neutral-citation index (2019 ND 54); weekly scrape

CourtListener bulk data and API (Free Law Project); the court's legacy archive if one exists

Opinions, pre-digital

The bound official reports (public domain for state government works)

CourtListener's historical case-law collection (texts and page scans); Google Books / HathiTrust scans of the reporter volumes; the regional reporter's own volumes

Statutes

The legislature. Look for a structured export before scraping HTML — North Dakota's Legislative Council publishes the whole code as JSON

Session laws (for point-in-time history); the archived prior editions

Constitution

Legislature or Secretary of State

A compiled amendment chronology (ballot measures, session laws) is what makes the history layer possible

Court rules

The court's rules page; amending orders carry effective dates

The orders themselves

Administrative code

Whoever publishes it (here, the Legislative Council)

The register / notices of adopted rules

Attorney General, ethics advisory opinions

The issuing office's site

—

Read the terms of use and robots.txt for every source. Commercial reporter text is subscriber content: it can serve as a validation witness under your own subscription, but you cannot redistribute it, and your shipped database must contain only the government's own text plus factual record content. Write that scope down before you ingest anything (NOTICE.md is ours).

3. Acquire, and keep the raw files forever

Everything lands in a witness tree (a refs/<state>/… directory outside the repository) that the pipeline reads and never writes. A file there is authoritative about what the source said, never about what the opinion should say; corrections live only in the database and its changelog. Alongside each acquired file keep a small provenance sidecar (URL, fetch date, checksum). Scrape politely, with a fixed rate and a real user agent; some court sites sit behind Cloudflare and need TLS impersonation (curl_cffi) rather than plain requests. Automate the weekly pull (launchd/cron) from day one, because the corpus is only ever as current as the last run.

4. Extract text with two witnesses per document

  • Born-digital PDFs: pdftotext -layout, then a reflow pass that rejoins wrapped lines, keeps paragraph numbers, star pages, footnotes, and block quotes, and strips clerk stamps and page furniture.

  • Scanned pages: OCR twice with different engines (we use tesseract via ocrmypdf as the baseline and a vision-language model, Surya, as the second witness) and accept a correction only where the two agree against the stored text, then read the page image for anything digit-bearing.

  • HTML: a parser per site; the archive's <u> may be italics on one page and inserted text on another, so decide per element with the page in front of you.

Pick unambiguous in-text sigils for structure ([¶12], [*363], [n3]) that cannot collide with the court's own bracketed material, and document them where every consumer will see them. Preserve the court's misprints verbatim and record them in a print_anomalies table with the intended reading; the citation graph resolves to the intended target while the text stays faithful.

Ingest each source separately, then merge by parallel-citation matching: the same opinion appears in the regional reporter, the state reports, the court's site, and CourtListener, and the citation set is the join key. Record every source that contributed in a sources table so a later audit can diff the stored text against each witness. Extract citations with a parser that knows your jurisdiction's reporters, rules, and statute forms — we use jetcite — into an outbound table (document → authority) and derive the inbound side (cited-by, notes of decisions) from it. Provision-to-provision cross-references get the same treatment inside each code database, keyed to the version they appeared in.

6. Serve

FastMCP turns plain functions into tools; ndlaw_mcp/server.py attaches the per-corpus databases to one connection and registers about forty. Name tools by the questions a lawyer asks (lookup_opinion, get_citing_opinions, lookup_authority with as_of_date, check_draft), keep responses paginated, and give every tool an end-to-end test. Ship a get_database_stats tool that reports the corpus counts and the date of the last update, so users can tell how current an instance is.

7. Validate, log, release

Write integrity invariants and run them after every data batch; log every correction as a batch with a reason and the witness it was checked against (a data changelog, separate from the code changelog); and plan an independent text-fidelity audit against the original sources. Release the databases as versioned assets on a fixed cadence, separate from the code, with the distribution copy stripped of anything you may not redistribute.

What to fork and what to rewrite

Reuse as-is: the schemas, the server and web layers, the invariants framework, the changelog and release tooling, the two-witness OCR gate. Rewrite for your jurisdiction: the scrapers, the court-composition table (justices and terms), the reporter taxonomy and citation patterns, the text conventions of your court's print, and the redistribution scope. Budget most of the effort for step 4: acquiring sources is a week, getting the text right is the project.


Reporting errors

This repository ships a validated, read-only corpus and the minimal server that serves it; the data pipeline and its correction history are maintained separately. If you find a text or metadata discrepancy against an official source, please open an issue with the citation and the source you checked against.

Available Tools

41 tools
authoring_justice_on_issueA

Opinions a justice has authored on an issue (predictive bench-memo signal).

Full-text searches issue and filters to opinions authored by justice, newest first, with snippets. Reflects authored majority/lead opinions (the author field); separate writings are most fully attributed 1997+.

Inputs: issue (required), justice (required), limit. Returns: object

case_summaryA

One-call bench-memo front matter for a case.

Returns name, full caption, all parallel cites (Redbook-ordered; synthetic [YYYY ND nnn] separate), date, author, panel, voting record, disposition, paragraph count, syllabus points (pre-1953), and citation-graph counts. disposition and syllabus_points are DERIVED/heuristic — verify against the opinion.

Inputs: citation (required). Returns: object

check_draftA

One-call cite-check of a draft opinion, memo, or brief: verify every citation, every attributed quotation, negative treatment of cited cases, and the currency of cited authorities — a severity-ranked flag report.

Checks (all on by default, select with checks): citations — every ND case cite resolves (typo catch), case-name drift vs the canonical caption, missing neutral cite, statutory subsection pinpoints validated against the provision; quotations — every quotation attributed to a nearby cite is located in that authority's text (typography-tolerant; word-level diff on mismatch); statutes/rules/const quotes are also retried against OTHER captured versions to catch quoting since- amended text; treatment — cited cases run through the citator; possible-negative / distinguished citing sentences surface (same engine as detect_overruled_in_draft, which remains the cheap treatment-only pass); currency — repealed / superseded / not-in-force authorities, checked at as_of_date when given (offense/contract date); and a cited case that cites an N.D.C.C. section but was filed before the section's current text took effect (construed_earlier_version, S4).

Severities: S1 misquotation or quote-of-superseded-text · S2 citation doesn't resolve · S3 possible negative treatment · S4 authority currency / bad pinpoint · S5 name drift / missing neutral cite.

Heuristic and NON-authoritative throughout: extraction is regex-based (foreign/federal authority is listed as unchecked, not verified), quote attribution follows the nearest-cite convention and can misattribute, bracketed alterations and ellipses in quotes surface as differences, and treatment signals are sentence-local. Read every flag's context before acting on it. A draft spanning several operative dates needs per-authority lookup_authority calls — as_of_date anchors the whole draft.

Inputs: draft_text (required), checks, max_cases, as_of_date, +2 more. Returns: object

check_treatmentA

Citator: how later opinions have treated a case (KeyCite/Shepard's-style).

Aggregates opinions citing the target and, for each, returns the citing sentence, its paragraph, and a CONSERVATIVE, NON-AUTHORITATIVE treatment signal scanned from that sentence alone. Possible-negative and distinguished items are surfaced first so they are never truncated away.

IMPORTANT: signals are heuristic — a citing sentence may use a treatment word about a different case. This is NOT a "still good law" verdict. Always read the returned sentence and the full citing opinion before relying on it.

Inputs: citation (required), limit, scan_limit. Returns: object

constitutional_amendmentsA

List the chronology of amendments to the ND Constitution.

Returns every amendment from ndconst.org's authoritative table (1889–present, ~167 amendments) with its effective date, election date, affected section(s), subject, and a link to the enacting session law. Optionally filter by effective-date range (ISO YYYY-MM-DD). Note: pre-1996 amendments list the section numbers in effect at the time (the Constitution was renumbered in 1996), so those do not map to current article/section citations.

Inputs: limit, date_to, date_from. Returns: object

detect_overruled_in_draftA

Proofreading pass: flag cited cases that later opinions may have overruled, superseded, abrogated, or distinguished.

Extracts every ND / N.W. / N.D. case citation in the draft, resolves each to a corpus opinion, and runs it through the citator. Cases with a possible- negative or distinguished signal are flagged with the citing context for human verification; the rest are reported as clear.

IMPORTANT (same caution as the citator): signals are heuristic and sentence-local, NOT a "still good law" verdict. ALWAYS read each flagged entry — and the full citing opinion — before relying on it. Citations that don't resolve to a corpus opinion (foreign/federal cases, or typos) are listed under unresolved and were NOT checked; absence of a flag is not assurance a case is good law.

Inputs: draft_text (required), max_cases, scan_limit. Returns: object

find_opinions_construingA

Find opinions that cite/construe an N.D.C.C. section, court rule, or constitutional provision.

Accepts forms like "14-09-06.2", "N.D.C.C. § 14-09-06.2", "chapter 28-32", "N.D.R.Crim.P. 12", "Rule 56 NDRCivP", or "N.D. Const. art. I, § 8". Returns the matched authority (or authorities, if the reference is ambiguous) and the opinions citing it, newest first. When the cited provision's corpus is installed, also returns the provision's own text. For an N.D.C.C. section, each opinion carries construed_version: 'current' (filed after the current text took effect), 'earlier', or 'unknown'.

Inputs: authority (required), limit. Returns: object

get_ag_opinions_citingA

Find ND Attorney General opinions that cite a given authority.

Reverse index: give a statute, constitutional, court-rule, admin-code, or case citation and get the AG opinions that cite it. Statutory/constitutional citations are canonicalized against the installed corpora first, so "N.D.C.C. § 44-04-18" and "44-04-18" both resolve.

Inputs: citation (required), limit. Returns: object

get_authority_historyA

Show the amendment history of a ND constitutional, statutory, court-rule, or administrative provision — every version with its effective dates and the authority that enacted or amended it.

Use this to see how a provision changed over time, then call lookup_authority with a specific as_of_date to read any version in full. Version text is truncated here; full text comes from lookup_authority.

Inputs: citation (required). Returns: object

get_cited_authoritiesA

Outbound authorities a case relies on, grouped by type.

Maps the authority graph around a case: cited cases (in-corpus ND opinions resolved to name/date/oid; others with a source URL), statutes (N.D.C.C.), court rules, constitutional provisions, and regulations — each with an official-source link where available.

Inputs: citation (required). Returns: object

get_citing_opinionsA

Find opinions that cite a given opinion.

Returns opinions that reference the given citation in their text, ordered by date (newest first). Requires citation extraction to have been run (python -m ndlaw_mcp.cite_extract).

Inputs: citation (required), limit. Returns: result

get_court_opinions_citing_agA

Find ND Supreme Court / Court of Appeals opinions that cite a given AG opinion.

The inbound direction of the AG citation graph. Court opinions cite AG opinions two ways — a docket cite (N.D. Op. Att'y Gen. 2003-L-11) or, more often historically, a date reference (Attorney General's opinion of February 18, 1975); both are captured (see ag_backlink). Returns the citing court opinions, newest first.

Inputs: opinion_number (required), limit. Returns: object

get_court_opinions_citing_jeacA

Find ND Supreme Court / Court of Appeals opinions that reference a JEAC opinion (or the committee at all).

The inbound direction of the JEAC citation graph. Courts rarely cite these by number — most references are descriptive prose ("The trial court contacted the Judicial Ethics Advisory Committee..."), captured with the surrounding text. Call with no opinion_number to list ALL court references to the committee, including unresolved prose references.

Inputs: limit, opinion_number. Returns: object

get_database_statsA

Get summary statistics about the opinion database.

Returns counts, date range, and top authors.

Inputs: no named parameters. Returns: object

get_jeac_opinions_citingA

Find ND Judicial Ethics Advisory Committee opinions that cite a given authority.

Reverse index over the committee's citations — most useful for Code of Judicial Conduct provisions ("N.D. Code Jud. Conduct canon 3"), but any rule/statute/case citation works. Old-form Canon citations (pre-2007 Code) are indexed at canon granularity.

Inputs: citation (required), limit. Returns: object

get_notes_of_decisionsA

Annotated "Notes of Decisions" for a statute, court rule, constitutional provision, or admin-code section: every citing opinion with its citing sentences (verbatim, with ¶ pinpoints), the SUBSECTION each mention cites, and depth-of-treatment signals — a research view of how courts have applied the provision, grouped and ranked (vs find_opinions_construing's bare list).

Per citing opinion: mentions (in-text occurrence count), construes (interpretive vocabulary near a mention — heuristic), quotes_provision (reproduces ≥8 consecutive words of the provision's text), subsections_cited (parsed pinpoints, oracle-validated against the provision's structured subsection index where available), the opinion's own cited-by count, and the provision VERSION in force when it was filed (for an N.D.C.C. section, construed_version: 'current' / 'earlier' / 'unknown', from the date the current text took effect). The header aggregates a per-subsection citation outline and the provision's amendment timeline, so notes can be read against text changes.

Signals are heuristic and NON-authoritative — read the returned context (and the full opinion) before relying on any of them.

Inputs: authority (required), limit, order, offset, +4 more. Returns: object

get_opinion_figure_imageA

Return one figure's image from an opinion, as viewable image content.

Use get_opinion_figures(citation) first to see how many figures exist and their captions/kinds, then call this for a specific figure. One image per call keeps responses manageable.

Inputs: citation (required), fig_index.

get_opinion_figuresA

List the figures reproduced in an opinion (plat maps, survey drawings, photos, diagrams, tables-as-image).

Returns lightweight metadata for each figure — its index, kind, a descriptive caption, the PDF page, and dimensions. Fetch the actual image bytes for one figure with get_opinion_figure_image(citation, fig_index). The captions are our editorial descriptions (what the figure is), not the court's own text. Returns an empty list if the opinion has no figures (or if figures.db is not installed).

Inputs: citation (required). Returns: object

get_opinion_tablesA

Return the reconstructed data tables in an opinion, structured for reading.

Some opinions contain tables — numeric ones (apportionment counts, tax- redemption schedules, caseload statistics) and, from 2026 ND 34 on, tables whose cells are running text (a grid of case citations) — that flat opinion text renders as a scrambled run of cells. Those tables are reconstructed from a geometry-bearing source and served here structured. The opinion's own text_content carries the same table inline as a fixed-width block under a "[Table N]" anchor; this tool gives you a cleaner rendering for display or parsing.

Inputs: citation (required), format. Returns: object

get_opinion_textA

Read opinion text in chunks.

Use this to read long opinions in manageable pieces. Start with offset=0 and advance by the limit to paginate through the text.

Inputs: citation (required), limit, offset. Returns: object

get_parallel_citationsA

Return the complete parallel-cite set for a case, in Redbook order.

Feed any one citation (or a case name) and get every known parallel cite so a draft's missing neutral or N.W. parallel can be auto-filled. Synthetic back-assigned [YYYY ND nnn] identifiers for pre-1997 opinions are returned separately and never folded into the formatted citation.

Inputs: citation (required). Returns: object

get_pinpointA

Resolve a pinpoint: paragraph number → its text, or quote → its ¶.

Provide exactly one of paragraph or quote. With paragraph, returns that ¶'s text and a pinpoint cite. With quote, locates the passage and returns the ¶ it lives in (with verbatim status). Paragraph pinpoints require ¶ markers, present on most 1997+ opinions but not pre-1997 text.

Inputs: citation (required), quote, paragraph. Returns: object

get_provision_xrefsA

Cross-references between primary-law provisions: what a statute / court rule / constitutional / admin-code provision cites, and what cites it.

Outbound: every provision this one's text references ("as defined in section 44-04-17.1", "subject to chapter 54-55"), resolved with heading and status where the target corpus is installed. Inbound: every provision — across ALL installed corpora — whose in-force text references this one: the admin-code rules implementing an enabling statute, every section incorporating a definition (the blast radius of amending it), rules citing a constitutional provision.

Point-in-time: edges are asserted per text version, so as_of_date returns the references in (and to) the versions in force on that date; default is current text. Unresolved outbound targets (e.g. a chapter cite — chapters aren't provisions — or a reference to a repealed section) are listed with resolved=false rather than dropped.

Inputs: citation (required), limit, as_of_date. Returns: object

get_subsequent_historyA

Related opinions sharing the case's docket (rehearings, supplemental, etc.).

Finds other opinions on the same docket number, ordered by date, with a relation hint. Docket-linking also surfaces companion opinions and same- docket duplicates, so this is a research aid — verify the relationship.

Inputs: citation (required). Returns: object

justice_infoA

Get justice information — voting record for a specific case, or aggregate statistics across cases.

If citation is provided, returns the voting record for that opinion. Otherwise, returns aggregate stats (authorship count, dissent rate, etc.) for the justice across all cases (optionally filtered by date range). dissent counts full dissents plus dissents in part (broken out as dissent_full / dissent_in_part); concurring includes special concurrences and concurrences in the result (also broken out). plurality counts votes joining a lead opinion that commanded no majority of the panel; they are not included in majority.

Only covers opinions from 1997–present (neutral-cite era with voting data).

Inputs: justice (required), date_to, citation, date_from. Returns: object

list_opinions_by_dateA

List opinions filed within a date range.

Returns opinions in reverse chronological order.

Inputs: date_to (required), date_from (required), limit, author. Returns: result

lookup_ag_opinionA

Retrieve a ND Attorney General opinion by its number (e.g. "2015-L-12").

Returns the opinion's metadata, the ND primary-law authorities it cites (extracted cross-links), and optionally its text.

Inputs: opinion_number (required), text_limit, include_text. Returns: object

lookup_authorityA

Retrieve the text of a ND constitutional, statutory, court-rule, or administrative provision — optionally as it read on a specific date.

Resolves citations like "N.D. Const. art. I, § 8", "N.D.C.C. § 12.1-20-03", "N.D.R.Civ.P. 56", or "N.D. Admin. Code § 75-02-01". A CHAPTER of either numbered code ("N.D.C.C. ch. 28-32", "N.D.A.C. ch. 75-02-04.1") answers with unit: "chapter" — its catchline, status, and the index of its sections with their catchlines — rather than text, because a chapter has none of its own; call this tool again on the section you want. Chapters that repealed entirely are answerable too, with the repealing authority. When as_of_date is given (ISO YYYY-MM-DD), returns the version in force on that date; this is what lets you read a statute "as the court applied it" in an older opinion. Omit as_of_date for the current text.

For the Constitution, the 1889<->1981 renumbering is bridged automatically: a modern cite (art. V, § 2) at a pre-1981 date returns its original-section predecessor (§ 72), and an original §-cite (or amend. art.) at a post-1981 date returns its modern successor — each with requested_citation, returned_provision, relation, and a note explaining the link (source: NDCC Replacement Vol. 13 disposition tables).

Returns the provision text, heading, effective window, enacting/amending authority, source URL, and a count of opinions construing it. For a current N.D.C.C. section, current_since says which session law wrote the current text and when it took effect (the version's own effective_start is the code export's date, not the act's). If the relevant corpus is not installed, says so. Chapter answers carry the section index and the chapter's own construing count (opinions citing the chapter as a whole) in place of text and effective dates.

Inputs: citation (required), as_of_date. Returns: object

lookup_jeac_opinionA

Retrieve a ND Judicial Ethics Advisory Committee opinion by number (e.g. "96-1" or "2016-2").

Returns the opinion's metadata (including the committee's question digest), the authorities it cites (Code of Judicial Conduct canons/rules, cases, statutes), and optionally its text. Two-digit and four-digit year forms both resolve ("96-1" == "1996-1").

Inputs: opinion_number (required), text_limit, include_text. Returns: object

lookup_opinionA

Look up an opinion by any citation (neutral cite, N.W.2d, N.W., etc.).

Returns metadata and all known citations. Text is excluded by default to keep responses manageable — use include_text=True for the first text_limit characters, or get_opinion_text() to read in chunks.

Inputs: citation (required), text_limit, include_text. Returns: object

more_like_thisA

Find opinions doctrinally similar to a given case (hybrid ranking).

Blends two signals: co-citation (sharing the same cited authorities) and keyword overlap (shared salient terms). Each result reports both sub-scores so the ranking is explainable.

Inputs: citation (required), limit. Returns: result

report_corpus_issueA

Report an apparent defect in this corpus's text so a person can check it.

Use it when an authority you retrieved from this server looks wrong: garbled or OCR-mangled words, a paragraph or footnote missing or in the wrong place, a syllabus or caption that does not belong, a statute or rule version that cannot be the one in force on the date you asked for, a citation that resolves to the wrong document, a quotation the court made that this server's text cannot match. Do NOT use it for disagreement with what the law says, for questions, or for anything but the fidelity of the stored text to the official source.

The report is recorded with the canonical citation and the exact version this server serves today, and is read by a person; nothing changes automatically. You get a receipt with a report id.

Inputs: issue (required), citation (required), source_url, text_expected, +1 more. Returns: object

search_ag_opinionsA

Full-text search across ND Attorney General opinions (1942–present).

The AG's published opinions construe ND statutes, the Constitution, court rules, and the open-records/open-meetings law. Returns matching opinions ranked by relevance with snippets.

Inputs: query (required), year, limit, opinion_type. Returns: result

search_authorityA

Full-text search across ND primary law (Constitution, court rules, statutes, administrative code).

Searches provision text and headings. By default returns the version currently in force; pass as_of_date (ISO YYYY-MM-DD) to search the text as it read on that date. Restrict to one corpus with corpus_name ('const', 'rule', 'ndcc', or 'admin'). Each hit's excerpt is the matched passage with the matching terms marked >>>term<<< (the same convention as search_opinions); when the match falls only in the citation or heading, the excerpt is that field instead.

Inputs: query (required), limit, as_of_date, corpus_name. Returns: object

search_booleanB

Terms-and-connectors Boolean / proximity search.

Connectors: & (AND), | or OR (OR), % or NOT (BUT NOT), /N (within N words), /s (same sentence ≈ NEAR/20), /p (same paragraph ≈ NEAR/50), ! truncation (e.g. negligen! → negligen*), and "quoted phrases". Because FTS5 has no sentence/paragraph unit, /s and /p are token-distance approximations — the translated FTS query and any approximation notes are returned for transparency.

Inputs: query (required), limit, author, date_to, +1 more. Returns: object

search_by_case_typeA

Search opinions by case type classification.

Case types include values like 'Appeal - Criminal - Misc. Felony', 'Appeal - Civil - Constitutional Law', 'Original Jurisdiction', etc. Partial matches are supported.

Inputs: case_type (required), limit, date_to, date_from. Returns: result

search_facetedA

Faceted opinion search: filter by metadata, optionally with full text.

Any combination of facets may be supplied. With query, results are FTS relevance-ranked; otherwise newest first. Disposition is a partial match (e.g. "REVERSED" matches "REVERSED AND REMANDED"). Dissent/concurrence/ unanimity derive from voting data present for 1997+ opinions only.

Inputs: limit, query, author, date_to, +6 more. Returns: result

search_jeac_opinionsA

Full-text search across ND Judicial Ethics Advisory Committee opinions (1990–present).

The committee's advisory opinions construe the N.D. Code of Judicial Conduct — recusal/disqualification, campaign conduct, extra-judicial activities. NOTE (per the committee): before relying on an opinion, compare its rule/canon references with the current Code — the Code has been restructured since many were issued.

Inputs: query (required), year, limit. Returns: result

search_opinionsA

Full-text search across all opinions.

Returns matching opinions ranked by relevance with snippets. Use this to find opinions on a topic, legal issue, or factual pattern.

Inputs: query (required), limit, author, date_to, +1 more. Returns: result

verify_citationA

Verify a citation or case name and return its canonical form.

Confirms the case exists and returns the exact case name, filing date, authoring justice, and the full parallel-cite set in Redbook order, plus a ready-to-paste formatted citation. Catches wrong volume/page, wrong year, and name drift. If expected_case_name is supplied alongside a citation, the name as-written is compared to the canonical name and any drift is flagged.

Inputs: query (required), expected_case_name. Returns: object

verify_quotationA

Confirm a quoted passage appears verbatim in a case, with pinpoint ¶.

Locates the quote in the opinion text. Differences in whitespace, curly vs. straight quotes, and dash style are treated as still-verbatim; dropped, changed, or inserted words are flagged with a word-level diff and the closest actual text. Returns the pinpoint paragraph (¶) when the opinion carries paragraph markers (generally 1997+ opinions).

Inputs: quote (required), citation (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 41 tools

    Disambiguation3/5

    Most tools target genuinely distinct resources (opinions, authority, AG opinions, JEAC opinions, figures, tables), and descriptions even name their overlaps (find_opinions_construing vs get_notes_of_decisions; detect_overruled_in_draft vs check_draft). However there are six-plus entry points for opinion searching (search_opinions, search_boolean, search_faceted, search_by_case_type, more_like_this, authoring_justice_on_issue) plus lookup_opinion/get_opinion_text/case_summary/verify_citation, so an agent must reason carefully to pick the right one.

    Naming Consistency4/5

    Predominantly verb_noun snake_case (lookup_opinion, search_faceted, get_citing_opinions) with systematic prefixes for the AG/JEAC citation sub-graphs (get_ag_opinions_citing, get_court_opinions_citing_jeac). A handful of noun-only or non-standard names (case_summary, constitutional_amendments, justice_info, more_like_this, authoring_justice_on_issue) are minor deviations that stay readable.

    Tool Count2/5

    41 tools is well beyond the 25+ threshold, and the domain breadth (opinions, statutes, constitution, rules, admin code, AG opinions, JEAC opinions) justifies some but not all of it. Several tools are acknowledged subsets of others (detect_overruled_in_draft vs check_draft; verify_citation vs get_parallel_citations/case_summary), inflating the surface.

    Completeness5/5

    Coverage is unusually thorough: retrieval, chunked text, Boolean/faceted search, citator and treatment checks, pinpoint and quotation verification, statutory point-in-time lookups, cross-references, amendment history, AG and JEAC corpora with inbound/outbound citation graphs, plus figures, tables, and a corpus-defect reporting channel. No obvious research dead ends for the stated ND primary-law and caselaw domain.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables users to retrieve full current statutory section text by citation and search official section and chapter catchlines by topic or keyword. It also surfaces enactment/amendment history and repealed or transferred section dispositions when available.
      93 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables retrieval of full current District of Columbia statutory section text by citation, including headings, disposition, legislative history, prior codifications, and cross references, and supports topic/keyword or title-based search and browsing over official section headings.
      140 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables citation-based lookup of state statute sections, chapter browsing by title, and keyword search over official catchlines, with later-act overlays and clear snapshot-date limits.
      84 npm
      MIT