Labsco
damankaur-dev logo

Openlaw MCP

β˜… 4

from damankaur-dev

OpenLawMCP connects AI tools to real UK/EU legal sources for grounded, verifiable legal research answers.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup

openlaw-mcp

by LegalAI Space

A free, open-source Model Context Protocol (MCP) server that exposes UK and EU open law β€” judgments, statutes, regulations, regulator notices β€” to host LLMs such as Claude, ChatGPT, and Cursor.

Where general-purpose chatbots invent citations, openlaw-mcp fetches the real text from official open-data sources (The National Archives' Find Case Law, legislation.gov.uk, EUR-Lex, HUDOC, ICO, HMRC) and returns it with full provenance and licence attribution. Every tool result is cite-back ready.

Sample prompts

Once the server is configured, paste any of these into your host LLM. They are UK-focused and chosen to exercise the tools where MCP grounding makes the biggest difference β€” exact statute text, point-in-time status, judgment paragraph quotes, regulator deep links, and ICO / HMRC material that a plain web search cannot reliably return verbatim.

Statute lookups (lookup_statute, legislation_toc)

  • "Quote subsection (1) of section 1 of the UK Bribery Act 2010 verbatim, with a link to the legislation.gov.uk source."
  • "What is the current in-force text of section 1 of the Online Safety Act 2023 (c.50) on legislation.gov.uk? If the section has not been commenced, say so and cite the source you used."
  • "What did section 2 of the Data Protection Act 2018 say as in force on 25 May 2018? Use legislation.gov.uk's point-in-time view."
  • "Give me the table of contents for the Procurement Act 2023 β€” parts, chapters, and section numbers."
  • "Compare the wording of section 1 of the Computer Misuse Act 1990 as enacted vs as currently in force, and cite both versions on legislation.gov.uk."

Case law (search_caselaw, fetch_judgment, grep_judgment, citator_lite)

  • "Quote paragraph 1 of R (on the application of Miller) v The Prime Minister [2019] UKSC 41 verbatim, with the Find Case Law URL."
  • "Find UK Supreme Court judgments from 2024 onwards that consider Article 8 of the ECHR. Return neutral citations with Find Case Law links and a one-line summary of each."
  • "In Uber BV v Aslam [2021] UKSC 5, find every paragraph that mentions the word 'control' and quote each one in full."
  • "List judgments published on Find Case Law that cite Pepper v Hart [1992] UKHL 3. Return neutral citations and links β€” no treatment classification needed."
  • "Search Find Case Law for First-tier Tribunal (Tax Chamber) decisions on IR35 / off-payroll working handed down in 2023, and return the first 10 hits."

Regulator material (search_fca_handbook, fetch_fca_notice, search_ico_guidance, fetch_hmrc_manual)

  • "Give me the official handbook.fca.org.uk deep link for SYSC 4.1.1R."
  • "Resolve these FCA rule references into deep links: SYSC 6.1.1R, COBS 9.2.1R, CASS 7.13.3R."
  • "Find recent ICO enforcement actions (monetary penalty notices and enforcement notices) issued in 2025 β€” return the title, date, and source URL for each."
  • "From the HMRC Business Income Manual, give me the section on the badges of trade (BIM20205). Return the bodyText and the gov.uk URL."
  • "From the HMRC Employment Status Manual (ESM), summarise the contents page (just the navigation tree, not the bodies)."

EU material (fetch_eurlex)

  • "Fetch CELEX 32016R0679 (the GDPR) and return Article 5 in full, with the EUR-Lex source URL."
  • "Fetch CELEX 32024R1689 (the EU AI Act) and tell me which articles deal with prohibited AI practices."

ECHR / Strasbourg (fetch_hudoc)

  • "Pull the full English text of the ECHR judgment in BΔƒrbulescu v Romania (Application 61496/08) and quote the operative paragraphs."
  • "Search HUDOC for Grand Chamber judgments where the United Kingdom was the respondent state between 2020 and 2024."

Citation hygiene (format_oscola)

  • "Format the following bundle of UK cases in OSCOLA, one per line: Donoghue v Stevenson [1932] AC 562; Pepper v Hart [1992] UKHL 3; R (Miller) v The Prime Minister [2019] UKSC 41."
  • "Convert this sloppy reference into OSCOLA and produce a working Find Case Law URL: 'Uber BV v Aslam, 2021 Supreme Court, UKSC 5'."

When MCP shines (and when it doesn't)

  • Strongest payoff: "verbatim text of section X" prompts, point-in-time statute lookups, FCA Handbook deep-link resolution, and any request that needs current in-force wording or a recent ICO/HMRC publication. Generic web search either guesses or gets blocked by upstream JS challenges (notably legislation.gov.uk's AWS WAF); the MCP server is allow-listed and returns parsed, cite-ready XML.
  • Marginal payoff: quoting a famous paragraph from a landmark judgment, or formatting a textbook citation. The host LLM often gets these from training data alone β€” MCP still adds provenance and reduces hallucination risk, but the wording would have been correct anyway.
  • No payoff: purely conceptual questions ("explain the difference between the FCA and the PRA"). These should be answered without calling any tool; if your host LLM fires MCP tools here, treat it as an over-eager router rather than a useful grounding.

Tools

ToolWhat it doesSource / URL
search_caselawSearch The National Archives' Find Case Law (E&W courts + tribunals from 2001).https://caselaw.nationalarchives.gov.uk/atom.xml?query=...
fetch_judgmentPull a full judgment as structured Akoma Ntoso.https://caselaw.nationalarchives.gov.uk/{court}/{year}/{number}/data.xml
grep_judgmentRun a regex inside a single judgment's paragraphs.https://caselaw.nationalarchives.gov.uk/{court}/{year}/{number}/data.xml
lookup_statutePoint-in-time lookup of any UK statute section on legislation.gov.uk.https://www.legislation.gov.uk/{type}/{year}/{number}/section/{section}/data.xml (or .../{YYYY-MM-DD}/data.xml)
legislation_tocWalk the table of contents for an Act or SI.https://www.legislation.gov.uk/{type}/{year}/{number}/contents/data.xml
fetch_eurlexFetch an EU document by CELEX number.https://publications.europa.eu/resource/celex/{CELEX}
fetch_hudocFetch an ECHR judgment (English / French Court-authored text only).Search/metadata: https://hudoc.echr.coe.int/app/query/results; body: https://hudoc.echr.coe.int/app/conversion/docx/html/body?...
search_fca_handbookResolve an FCA Handbook reference (SYSC 4.1.1R) to a deterministic deep link.1Local computation only (no fetch); emits deep link under https://www.handbook.fca.org.uk/handbook/...
fetch_fca_noticeBuild metadata + deep link for a known FCA Final or Decision Notice slug.1Local computation only (no fetch); emits deep link https://www.fca.org.uk/publication/{category}/{slug}
search_ico_guidanceSearch ICO guidance and enforcement notices.POST https://ico.org.uk/api/search (mirrors listing at https://ico.org.uk/action-weve-taken/enforcement/)
fetch_hmrc_manualFetch a section of an HMRC internal manual.https://www.gov.uk/api/content/hmrc-internal-manuals/{manual}[/{section}]
format_oscolaFormat a parsed citation in OSCOLA (UK / Ireland) or Bluebook.Local computation only (no network call)
citator_liteForward citation lookup for a judgment. Treatment classification is not included.https://caselaw.nationalarchives.gov.uk/atom.xml?query=%22[citation]%22

Resources

Clients that support MCP resources can also read:

Resource templateWhat it returnsSource / URL
judgment://{slug}/{year}/{number}/headerTNA judgment header text. URL-encode slugs with /, e.g. ewca%2Fciv.https://caselaw.nationalarchives.gov.uk/{slug}/{year}/{number}/data.xml
judgment://{slug}/{year}/{number}/indexJSON paragraph index for a judgment.https://caselaw.nationalarchives.gov.uk/{slug}/{year}/{number}/data.xml
judgment://{slug}/{year}/{number}/para/{eId}A single judgment paragraph by Akoma Ntoso eId.https://caselaw.nationalarchives.gov.uk/{slug}/{year}/{number}/data.xml
statute://{type}/{year}/{number}/section/{section}Current legislation.gov.uk section document as JSON.https://www.legislation.gov.uk/{type}/{year}/{number}/section/{section}/data.xml

How tools and resources work technically

Common runtime flow (all tools)

  1. MCP client sends tool name + JSON arguments (inputSchema validated by zod).
  2. Server handler calls either:
    • a source client (src/sources/*.ts) that performs HTTP fetches via shared Fetcher, or
    • a local computation path (FCA link resolvers, citation formatter) with no network call.
  3. Handler normalizes/parses upstream data into stable data fields.
  4. Server returns an envelope: data, provenance (source, source_url, fetched_at, content_hash, cache_hit, licence metadata), and learn_more; some tools also include note.
  5. On upstream errors, tools return isError: true plus a canonical authoritative URL.

Per-tool technical behavior

  • search_caselaw: receives search filters (query, optional court/date/page), fetches TNA Atom feed, parses entries into normalized judgment refs, returns paged hits + provenance.
  • fetch_judgment: receives neutral citation or TNA URI, resolves to /data.xml, parses Akoma Ntoso into meta, header, paragraphs, returns full structured judgment + provenance.
  • grep_judgment: same fetch/parsing as fetch_judgment, then runs JS regex across parsed paragraph text, returns match list/snippets + provenance.
  • lookup_statute: receives legislation type/year/number/section (+ optional as_of), fetches CLML section XML, extracts title/text/version metadata/extent/prospective flags, returns normalized section document + provenance.
  • legislation_toc: receives legislation type/year/number, fetches CLML contents XML, flattens parts/chapters/sections into entries, returns TOC + provenance.
  • fetch_eurlex: receives CELEX, validates/normalizes it, blocks out-of-scope national sectors (7/8), fetches from Cellar with content negotiation (XHTML then HTML fallback), returns raw body + detected media type + provenance.
  • fetch_hudoc: receives either itemid or search query. Search path fetches JSON results and suppresses out-of-policy records. Item path fetches metadata then body only when language/doctype/translation guard passes. Returns records/body + provenance + suppression note when applicable.
  • search_fca_handbook: receives parsed handbook reference inputs, computes deterministic deep link locally, returns metadata + local provenance (urn:openlaw-mcp:local) without FCA content fetch.
  • fetch_fca_notice: receives known notice slug (+ category), computes deterministic FCA deep link locally, returns metadata + local provenance; listing path intentionally errors (scraping disabled).
  • search_ico_guidance: receives optional type/sector/date/page filters, posts to ICO /api/search, shapes response into enforcement list items, returns paged results + provenance.
  • fetch_hmrc_manual: receives manual slug (+ optional section slug), fetches GOV.UK Content API JSON, returns either manual navigation tree or section body (bodyHtml + bodyText) + provenance.
  • format_oscola: receives citation text + formatting options, parses and formats locally (OSCOLA/Bluebook), optionally emits derived Find Case Law URL for neutral citations, returns formatted output + local provenance.
  • citator_lite: receives neutral citation, searches TNA Atom with quoted query to find citing judgments, trims to limit, returns citing list + disclaimer + provenance.

Per-resource technical behavior

  • judgment://.../header: MCP resource vars (slug, year, number) are validated/parsed, server fetches TNA judgment XML once, extracts plain-text header, returns text/plain.
  • judgment://.../index: same fetch path, maps parsed paragraphs to { eId, num, preview }, returns application/json.
  • judgment://.../para/{eId}: same fetch path, selects one paragraph by exact Akoma Ntoso eId, returns text/plain ([num] text when num exists).
  • statute://.../section/{section}: validates resource vars, fetches legislation.gov.uk section XML via legislation client, returns parsed section document JSON.

Provenance

Every tool response carries a provenance block:

{
  "data": { },
  "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"
}

If you redistribute the content downstream, preserve the attribution.

Cache

By default, GET responses are cached in ~/.cache/openlaw-mcp/http-cache.sqlite with source-specific TTLs. Delete the cache directory to clear stored responses.

Multi-tenant deployments: The cache is shared across all callers of a given process. The TNA Find Case Law content is licensed under the Open Justice Licence v2.0, whose "computational analysis" carve-out does not permit a persistent cross-user retrieval index. If you are running the HTTP transport for more than one end-user, either set OPENLAW_CACHE_DIR=off or give each tenant its own ephemeral cache directory. Single-user stdio usage (npx @legalaispace/openlaw-mcp) is unaffected.

Takedown

If you are a rights-holder and believe content fetched by this server has been redistributed in error, please email daman@legalaispace.com. We will investigate within five working days.

Development

npm install
npm run dev:stdio          # run the stdio server locally
npm run dev:http           # run the Streamable HTTP server with watch
npm test                   # unit tests, MCP protocol tests, and the ICO fixture test
npm run lint && npm run typecheck
npm run build
npm pack --dry-run         # verify npm package contents; runs release gates

Footnotes

  1. FCA materials are link-only / metadata-only. The server does not fetch FCA Handbook or notice body text, and notice listing is disabled unless FCA grants written permission for automated access. Users are pointed to the FCA's own site for authoritative content. See ATTRIBUTIONS.md for the legal posture. ↩ ↩2