gb-eli-mcp
An MCP server for read-only, keyless access to UK legislation, UK case law, and GOV.UK documents, with verifiable citations on every response.
gb_search — search UK legislation by text, doc type (e.g. ukpga, uksi, asp), and year.
gb_get_act — fetch act/instrument metadata by reference (e.g.
ukpga/2018/12, with optional point-in-time date).gb_get_text — retrieve full legislation text as xml, html, akn, rdf, pdf, or csv.
gb_recent_legislation — list legislation published since a date, newest-first, optionally by doc type.
gb_search_case_law — search UK judgments via Find Case Law by text, court, and date range.
gb_get_case — fetch a judgment by neutral citation, URI/path, or opaque id (Akoma Ntoso XML, or PDF link fallback).
gb_search_govuk — search GOV.UK documents (employment/tax tribunal decisions, HMRC manuals, CMA cases, etc.) with server-side date filters and real totals.
gb_get_govuk_content — fetch one GOV.UK document; tribunal decisions return the judgment PDF link, HMRC manual sections the full text.
gb_coverage — report what the connector covers, when each family was captured, and its known gaps with fallbacks.
Every response carries
eli_uri,human_readable_citation, andsource_url; all tools are read-only and idempotent, and calls are audit-logged locally.
Fetches a small runtime configuration file from the project's GitHub Releases on first use; can be disabled via GB_ELI_RUNTIME_URL.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gb-eli-mcp Show me the Data Protection Act 2018"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gb-eli-mcp
An MCP server for legislation.gov.uk, The National Archives' official portal for United Kingdom legislation. It searches and retrieves Acts of Parliament, UK Statutory Instruments, and the equivalent instruments of the Scottish Parliament, Senedd Cymru/Welsh Parliament and Northern Ireland Assembly, with persistent identifiers and verifiable citations.
Part of the MateMatic eu-legal-mcp production line: the UK counterpart of the Polish
sejm-eli-mcp and the German de-eli-mcp, built on the same architecture and citation
contract against the UK's own source.
No native ELI. legislation.gov.uk does not publish a native
/eli/namespace (confirmed live:GET /eli/ukpga/2018/12returns 404), even though its own persistent-identifier scheme predates and is closely related to ELI - the UK is widely credited with pioneering the URI-based legislation-identifier concept that ELI later formalised EU-wide.eli_uritherefore carries the UK's own stable id URI (https://www.legislation.gov.uk/id/{type}/{year}/{number}) instead of a fabricated ELI path - the same disclosure pattern used by this factory'snl-eli-mcpandse-eli-mcp. SeeCONSTITUTION.mdArt. 4.Licence. Content is published under the Open Government Licence v3.0 (confirmed live from the site's own
/helppage), which permits copying, publishing and adapting with attribution. This connector only relays that public content, with asource_urlon every response.
The nine tools
Tool | What it does |
| Search legislation by text, doc type and year ( |
| Fetch act/instrument metadata by reference (e.g. |
| Fetch the full text ( |
| Legislation published since a date, newest-first, optionally by doc type. |
| Search UK judgments via The National Archives' Find Case Law Atom feed, by text, court, and date range. |
| Fetch a judgment by neutral citation, Find Case Law URI/path, or opaque id - returns Akoma Ntoso XML, or a PDF link fallback. |
| Search GOV.UK documents via the keyless Search API - employment/tax/property tribunal decisions, HMRC internal manuals, CMA cases - with server-side date filters and real totals. |
| Fetch one GOV.UK document via the Content API - tribunal decisions return the judgment PDF link, HMRC manual sections return the full text. |
| Declare what this connector covers, when each family was captured, and - explicitly - what it does NOT cover. Every gap carries a fallback. |
GOV.UK coverage (added v0.3.0, feature-003)
One upstream, many institutions: gb_search_govuk filters by document_type.
Live-verified totals (2026-07-07, from the Search API's own total/facet fields -
probe: https://www.gov.uk/api/search.json?count=0&facet_content_store_document_type=1000):
| Documents |
| 132,162 |
| 85,315 |
| 17,088 |
| 2,571 |
| 2,565 |
| 2,031 |
| 1,414 |
| 101 |
See SOURCES.md for the full per-source ledger, including what was scouted and
deliberately rejected (ICO, FCA, IAC) and why.
Every response carries the contract: eli_uri
(e.g. https://www.legislation.gov.uk/id/ukpga/2018/12), human_readable_citation
(e.g. Data Protection Act 2018 c. 12), and source_url. Case-law responses carry the
same-spirit contract (human_readable_citation, source_url, dataset_note) - see
CONSTITUTION.md Art. 5.
Related MCP server: uk-caselaw
Install
As a Claude plugin (Claude Code or the desktop app, needs uv); see plugin/README.md for what it sends and stores:
/plugin marketplace add matematicsolutions/gb-eli-mcp
/plugin install gb-eli-mcp@gb-eli-mcpAs a standalone server, from PyPI (uvx gb-eli-mcp), or from source:
cd gb-eli-mcp
pip install -e .Configure (Claude Code / any MCP client)
Copy .mcp.json.example and adjust if needed:
{
"mcpServers": {
"gb-eli-mcp": { "command": "gb-eli-mcp" }
}
}Windows 11 with Smart App Control
Smart App Control blocks unsigned executables, which covers uvx.exe, pip.exe
and the gb-eli-mcp.exe launcher that pip writes at install time. The python.exe and
py.exe from the python.org installer are signed by the Python Software
Foundation, so running the module through the interpreter works:
python -m pip install gb-eli-mcp
python -m gb_eli_mcppip.exe is blocked for the same reason, so install with python -m pip, not
pip install. If python is not on PATH, use the Windows launcher: py -3 -m gb_eli_mcp.
{ "mcpServers": { "gb-eli-mcp": { "command": "python", "args": ["-m", "gb_eli_mcp"] } } }Do not turn Smart App Control off to work around this - it cannot be re-enabled without reinstalling Windows.
Environment:
GB_ELI_BASE_URL- defaulthttps://www.legislation.gov.ukGB_ELI_CASELAW_BASE_URL- defaulthttps://caselaw.nationalarchives.gov.ukGB_ELI_GOVUK_BASE_URL- defaulthttps://www.gov.ukGB_ELI_CACHE_DIR- default~/.matematic/cache/gb-eliGB_ELI_AUDIT_DIR- default~/.matematic/audit
No API key. legislation.gov.uk is keyless.
Governance
Public data only - read-only against legislation.gov.uk, Find Case Law and GOV.UK; no client data leaves the machine beyond search parameters.
Audit log - every tool call appends one JSON line to
~/.matematic/audit/gb-eli-mcp.jsonl.Network - the server talks to legislation.gov.uk, caselaw.nationalarchives.gov.uk, www.gov.uk and the local filesystem. Once, on first use, it also fetches a small configuration file (
gb-runtime.json.gz, updated source addresses) from this repository's GitHub Releases. That request carries no query content; GitHub's download counter for the file is the only usage signal we see.GB_ELI_RUNTIME_URL=""turns it off; the Claude plugin ships with it off. No LLM provider, no other telemetry.Verifiable citations - every response is independently checkable via
source_url.
See CONSTITUTION.md (the binding rules) and DISCOVERY.md (the live API probe).
Tests
pip install -e ".[dev]"
pytest tests/test_instructions_drift.py -v # offline
pytest tests/test_citations_case_law.py -v # offline
pytest tests/test_citations_govuk.py -v # offline
pytest tests/test_smoke.py -v # hits live legislation.gov.uk
pytest tests/test_smoke_case_law.py -v # hits live caselaw.nationalarchives.gov.uk
pytest tests/test_smoke_govuk.py -v # hits live www.gov.ukLicence
Apache-2.0. (c) Matematic Solutions / Wieslaw Mazur.
Note: the code in this repository is Apache-2.0. The legislation content fetched at runtime from legislation.gov.uk remains Crown copyright, published under the Open Government Licence v3.0 - not relicensed by this project.
Available Tools
9 toolsgb_coverageARead-onlyIdempotent
Declare what this connector covers, how it is sourced, and what it does NOT cover.
Call this before telling a user that the law "does not contain" something, and whenever a search comes back empty: the absence may be a gap in this connector rather than in the law. Every gap carries a fallback saying where to look instead.
Returns:
Coverage with families, an as-of note, and a non-empty list of known gaps.
Inputs: no named parameters. Returns: What this connector covers, how it is sourced, and what it does not cover.
gb_get_actBRead-onlyIdempotent
Fetch UK legislation metadata from legislation.gov.uk by reference.
Inputs: reference (required). Returns: Full legislation metadata record - GET .../data.xml.
gb_get_caseARead-onlyIdempotent
Fetch a UK judgment from The National Archives' Find Case Law service.
Inputs: reference (required). Returns: Result of ``gb_get_case``.
gb_get_govuk_contentARead-onlyIdempotent
Fetch one GOV.UK document (tribunal decision, HMRC manual section, CMA case).
Maps to the GOV.UK Content API (www.gov.uk/api/content/{path} - confirmed live
2026-07-07). Tribunal decisions carry the judgment as a PDF in attachments with
only a short HTML body; HMRC manual sections carry the full text in body_html.
Inputs: path (required). Returns: Result of ``gb_get_govuk_content``.
gb_get_textARead-onlyIdempotent
Fetch the full text of UK legislation.
Uses legislation.gov.uk's content-negotiation path suffix (/data.{format}) -
xml (the site's own legislation.xsd schema), html, akn (Akoma Ntoso),
rdf, pdf, or csv.
Inputs: reference (required), format. Returns: Result of ``gb_get_text``.
gb_recent_legislationARead-onlyIdempotent
UK legislation published since since_iso (ISO 8601 date), newest-first.
Maps to the Atom search feed sorted/filtered by publication year, optionally scoped
to one doc_type. legislation.gov.uk's public search feed does not support a
generic dateFrom filter across all types, so this tool filters the requested
year's feed by the published date client-side.
Inputs: since_iso (required), limit, doc_type. Returns: result
gb_searchARead-onlyIdempotent
Search UK legislation on legislation.gov.uk.
Maps to the official Atom search feed (/all/data.feed or /{doc_type}/data.feed,
optionally with ?text=...&year=...&page=...). Each item gets eli_uri,
human_readable_citation, source_url (per Art. 4 CONSTITUTION).
Inputs: query (required). Returns: Result of ``gb_search``.
gb_search_case_lawARead-onlyIdempotent
Search UK case law on The National Archives' Find Case Law service.
Maps to the public Atom feed at caselaw.nationalarchives.gov.uk/atom.xml
(confirmed live 2026-07-06 - keyless, Open Justice Licence). A separate service from
legislation.gov.uk: different host, different Atom dialect (tna: namespace).
Inputs: court, limit, query, to_date, +1 more. Returns: Result of ``gb_search_case_law``.
gb_search_govukARead-onlyIdempotent
Search GOV.UK documents - tribunal decisions, HMRC manuals, CMA cases and more.
Maps to the GOV.UK Search API (www.gov.uk/api/search.json - confirmed live
2026-07-07: keyless, Open Government Licence v3.0). One upstream aggregating many
institutions; filter with document_type. Legally weighty types with live-verified
totals (2026-07-07): employment_tribunal_decision (132,162),
hmrc_manual_section (85,315), residential_property_tribunal_decision
(17,088), employment_appeal_tribunal_decision (2,571), cma_case (2,565),
utaac_decision (2,031), tax_tribunal_decision (1,414),
asylum_support_decision (101).
Inputs: limit, query, start, to_date, +3 more. Returns: Result of ``gb_search_govuk``.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Tools are mostly separated by source and action: legislation search/retrieval vs case law search/retrieval vs GOV.UK content search/retrieval. Minor ambiguity exists between gb_search and the domain-qualified search tools, and between gb_get_act vs gb_get_text for obtaining full legislation text.
Names use lowercase snake_case with an gb_ prefix and mostly follow get_/object or search_domain. Deviations are minor: gb_search lacks a resource qualifier, and gb_recent_legislation/gb_coverage are noun-only rather than verb-first.
Nine tools is well-scoped for a read-only legal research connector spanning legislation, case law, GOV.UK documents, and coverage. Each tool has a clear role and none feel redundant.
Core workflows are covered: search and retrieve for each major source, plus recent legislation and a coverage mechanism. Minor gaps exist, such as no direct PDF attachment extraction for some GOV.UK tribunal decisions, but gb_coverage explicitly notes known gaps and fallbacks.
Maintenance
Related MCP Connectors
Search and read UK legislation at any date, resolve citations, list amendments, track changes.
Search UK Acts, Statutory Instruments, and legislation with full text retrieval
Search and read all UK legislation (130k Acts and regulations), updated daily, with official links.
Resolve, search and verify legal citations against the official sources, with provenance.
Related MCP Servers
- AlicenseAqualityBmaintenanceProvides comprehensive tools for searching UK case law, legislation, parliamentary Hansard debates, and HMRC tax guidance. It features a specialized OSCOLA citation parser to extract and resolve legal references directly from text.36485 PyPI21MIT
- AlicenseNot gradedqualityCmaintenanceEnables searching and retrieving full-text UK court judgments and tribunal decisions from The National Archives' Find Case Law service by subject, party, judge, or neutral citation.89 npmMIT
- AlicenseAqualityCmaintenanceEnables MCP clients to search New Zealand legislation, browse point-in-time versions of Acts, Bills, and secondary legislation, and read the text of sections or schedules via the official legislation.govt.nz developer API.81MIT
- AlicenseNot gradedqualityCmaintenanceEnables querying point-in-time amendment history for UK law, including searching provisions, viewing provision histories, listing recent amendments, and identifying most-amended provisions.1MIT