How openlaw-mcp works.

The short version of what's under the hood — the provenance envelope your LLM sees, the transports the server speaks, where the data comes from, and what's deliberately out of scope. The full reference lives in the README on GitHub.

Provenance envelope

Every successful tool response is wrapped in an envelope. data holds the tool-specific payload; provenance carries source, source_url, fetched_at, content_hash, cache_hit, licence, licence_url and attribution; learn_more points to a stable explainer.

{
  "data": { /* tool-specific */ },
  "provenance": {
    "source": "Find Case Law",
    "source_url": "https://caselaw.nationalarchives.gov.uk/uksc/2024/12/data.xml",
    "fetched_at": "2026-05-12T12:00:00Z",
    "content_hash": "sha256-...",
    "cache_hit": false,
    "licence": "Open Justice Licence v2.0",
    "licence_url": "https://caselaw.nationalarchives.gov.uk/open-justice-licence",
    "attribution": "Contains information licensed under the Open Justice Licence v2.0"
  },
  "learn_more": "https://legalaispace.com/sources/caselaw"
}

On upstream errors, the server returns an explicit failure with the canonical authoritative URL and a directive to the host LLM not to substitute training-data text. This is the anti-hallucination contract.

Where the data comes from

Every tool reads from an authoritative open-data source. Each response carries the upstream URL so you can verify in a browser tab.

Full per-tool source map

Transports

Streamable HTTP (preferred)Hosted

Point your client at https://openlawmcp.legalaispace.com/v1/mcp. Stateless, no API key, free. Each POST handles one request and tears down. Best for most users.

Local stdio (npx)Local

npx -y @legalaispace/openlaw-mcp. Runs inside your MCP client. No network dependency. Best for air-gapped or compliance-sensitive setups.

Self-hosted HTTPDIY

Clone the repo, build, and run dist/http.js — or use the included Dockerfile. Mounts /v1/mcp on PORT 3000. Same code as the hosted endpoint.

MCP protocol notes

  • Stateless mode. The hosted HTTP transport runs without session bookkeeping — each POST creates a fresh server instance. Resumable streams aren't needed for the tool-call workload here.
  • Resources. Clients that support MCP resources can read judgment://… and statute://… URIs in addition to calling tools.
  • Caching. GET responses are cached in a SQLite store with source-specific TTLs. In multi-tenant HTTP deployments, set OPENLAW_CACHE_DIR=off to comply with TNA's no-persistent-index requirement.

Boundaries & limits

  • No BAILII. BAILII's terms prohibit programmatic re-use; the client blocks outbound requests.
  • FCA link-only. Handbook and Notice bodies are not fetched. The server resolves known slugs/references into deterministic deep links.
  • HUDOC scope. Only English/French Court-authored judgments. Third-party translations are excluded; suppression returns a clear note.
  • Find Case Law scope. E&W courts and tribunals, 2001 onward. Older judgments are out of scope.
  • legislation.gov.uk WAF. AWS WAF challenges datacenter egress IPs. Use the hosted endpoint (allow-listed) or a residential network.

Licence & attribution

Source code is Apache-2.0. Data attributions are returned per-response in the provenance envelope; preserve them when redistributing content. Upstream licences in play: Open Justice Licence v2.0 (TNA), Open Government Licence v3.0 (legislation.gov.uk, HMRC, ICO), Commission Decision 2011/833/EU (EUR-Lex), ECHR copyright notice (HUDOC).

Full ATTRIBUTIONS.md

Disclaimer — not legal advice

openlaw-mcp surfaces text from official UK and EU open-law sources. The information returned is for research and information only and does not constitute legal advice, regulatory advice or a legal opinion.

Always verify against the authoritative source URL returned in each provenance envelope before relying on it. AI clients can still misquote or summarise inaccurately even when grounded in real sources — treat the source URL as canonical, not the model's prose around it. If you need legal advice, instruct a qualified lawyer in your jurisdiction.

Contributing

Issues, PRs and discussion are welcome on GitHub. New data sources should follow the existing pattern in src/sources/ — a thin fetch client plus a tool handler that emits an envelope. See CONTRIBUTING.md for the gates and conventions.