hk-criminal-law
This server supports citation-aware Hong Kong criminal-law research over indexed legislation and judgments, with live HKLII lookup and verification.
Search and retrieve Hong Kong legislation by query, Cap number, section/schedule, section range, language (English or Traditional Chinese), and list ordinances.
Retrieve point-in-time statute text and available historical section versions when historical archives are ingested.
Search Hong Kong judgments with court/year filters, fetch judgments by neutral citation, read specific numbered paragraphs, and get note-up data.
Verify a single legislation or case citation, or extract and verify all citations in a passage.
Generate research packs: doctrine leads, sentencing context/penalty text, authority ranking, and case citation graphs.
Report corpus size, coverage, and last ingest/fetch status.
It is a research aid only; verify every provision and judgment against official sources.
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., "@hk-criminal-law verify [2021] HKCFA 1 and summarise paragraph 3"
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.
HK Criminal Law MCP
A local-first, open-source research stack for Hong Kong criminal law and
defence. It indexes the official current-version Hong Kong legislation XML
(from DATA.GOV.HK) into SQLite, imports authorised judgment corpora (or fetches
an explicit permitted citation list), and exposes the corpus to Claude Code
(or any MCP client) through a small set of citation-aware tools. One process
can also serve the same tools over HTTPS to ChatGPT, Claude, Gemini, DeepSeek
and a phone browser via hk-law serve-http.
Python 3.11+ · Apache-2.0 code · CC BY 4.0 skills/docs · v0.4.0
Not legal advice. This is a research aid. Every provision and judgment must be checked against the official source before it is relied on. Hong Kong criminal law changes; check commencement, amendments and subsequent judicial treatment.
Public repository — no judgment text and no permission claim. This
repository ships no judgment corpus and no LRS/HKLII crawler. The author
does not claim permission from the Judiciary or HKLII. The default MCP
uses live HKLII query-time access for case search/read so results are
current; set HK_LAW_LOCAL_ONLY=1 for a strictly local MCP. Live access is
individual, rate-limited research and remains subject to HKLII's terms; the
bulk citation sync refuses to run without HK_LAW_CASE_PERMISSION_REF and an
explicit citation list. No judgment text is stored in or distributed by this
repository. See Fully local pipeline.
Start here: Quick start · Use it from a phone or hosted AI · Use with Claude Code · CLI · MCP tools · All documentation
Why this exists
Generic legal chatbots hallucinate citations and cannot tell you whether a provision is current. This project takes the opposite approach:
Primary sources, locally indexed. Legislation comes from the Department of Justice's official e-Legislation XML bulk data, not a scraped secondary site.
Verification is a tool, not a promise.
verify_citationchecks a Cap./ section or neutral citation against the corpus/HKLII before it is used.Judgments are local, not bundled. Import an authorised corpus or use a permission-gated citation list; the text stays in the operator's SQLite database and is never redistributed.
Paragraph-level retrieval.
get_casereturns numbered paragraphs, so a submission can cite[2021] HKCFA 1 at [3]rather than a vague page.Bilingual by design. English and Traditional Chinese legislation share the same citation structure.
Related MCP server: UK Law MCP Server
Status
This is a working MVP, not a complete citator.
Layer | Status |
English current legislation (Caps. 1–300, 301–600, 601+, instruments) | Indexed locally |
Traditional Chinese current legislation | Indexed locally |
Historical legislation (DATA.GOV.HK Past Version archives) | Indexed locally when downloaded; point-in-time |
Judgments | Locally indexed from an authorised import or permission-gated citation sync; no built-in LRS/HKLII crawler |
DOJ policy publications | Prosecution Code and domestic-violence prosecution policy indexed locally from |
Citation verification | Single citation + batch passage verification ( |
Research packs | Doctrine leads, sentencing context, authority ranking, case citation graph |
Semantic atlas | Static HTML/WebGL map of all current legislation sections (EN + ZH) |
Remote access | Streamable HTTP MCP ( |
Defence workflows | 12 skills under |
The current corpus is always available. Point-in-time text requires the
official Past Version archives; if they have not been ingested,
statute_history returns the current text with an explicit warning rather than
pretending it is historical. The reference snapshot also includes 15,438
English historical versions / 851,431 sections (1997–2026); see
docs/coverage.md.
Architecture
Layer | What it does |
Source | DATA.GOV.HK e-Legislation XML (current and Past Version archives); DOJ Prosecution Code and prosecution policies |
Local corpus | SQLite at |
Local sync |
|
Interfaces |
|
Live retrieval | Default for case queries: HKLII JSON endpoints; opt out with |
The legislation corpus is local. Case search/read uses live HKLII by default so
results are current; set HK_LAW_LOCAL_ONLY=1 for a strictly local MCP. No
judgment text is stored in or distributed by the repository.
For module-level detail, see docs/architecture.md.
Semantic atlas
semantic_map/ turns the current legislation corpus into a low-dimensional
semantic map: multilingual embeddings, PCA/UMAP, clustered topics, and a
responsive static HTML/WebGL explorer. It is a separate, optional build because
it requires the embedding pipeline. See
semantic_map/README.md for the build and deployment
steps.
Agentic use
The MCP is designed for automatic agent calls: the server instructions require
citation verification, and .claude/agents/hk-law-researcher.md provides a ready
research subagent. Agents also get semantic-atlas tools (semantic_search,
semantic_locate, semantic_neighbors, semantic_clusters,
semantic_cluster) alongside the legislation and judgment tools. See
docs/agentic-use.md for Claude Code and external
framework setup.
Quick start
Requires Python 3.11+ and network access to DATA.GOV.HK for the initial download.
Install
python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'After installing, choose one corpus path.
Prebuilt corpus (release assets)
The v0.1.0 data release contains a cleaned SQLite corpus (legislation only, no judgment text) and the eight official DATA.GOV.HK archives:
curl -LO https://github.com/helloWorld20484096/hk-criminal-law-mcp/releases/download/v0.1.0/hk_law_public.db.gz
curl -LO https://github.com/helloWorld20484096/hk-criminal-law-mcp/releases/download/v0.1.0/SHA256SUMS
sha256sum -c SHA256SUMS --ignore-missing
gunzip hk_law_public.db.gz
export HK_LAW_DB="$PWD/hk_law_public.db"
.venv/bin/hk-law statsThe HK_LAW_DB export applies to the current shell. Launch Claude Code from
this shell, or set the same variable in your environment, so the project-scoped
server reads this database.
The release database is built from the current-version e-Legislation XML as at 2026-11-15. It contains no judgments, consistent with the source-data terms described in docs/data-sources-and-licensing.md. It is current-version only; for point-in-time text, see Optional: historical versions.
Build from official archives
Use this path if you need to build the corpus yourself or ingest a different range or language. The download is roughly 1.3 GB of ZIPs and indexes about 120,000 sections.
# Keep the CLI and the project launcher on the same database.
export HK_LAW_DB="$PWD/data/hk_law.db"
# Official current-version legislation (English + Traditional Chinese).
.venv/bin/hk-law download --data-dir data/raw --dataset current
.venv/bin/hk-law ingest --data-dir data/raw --dataset current --language en
.venv/bin/hk-law ingest --data-dir data/raw --dataset current --language zh-HantIf you already have archives, point ingest at them:
.venv/bin/hk-law ingest --zip data/raw/hkel_c_leg_cap_1_cap_300_en.zip --language enFor point-in-time text, see Optional: historical versions.
Check it worked
Make sure HK_LAW_DB points to the corpus you built. The commands above set it
for the current shell; set it again if you open a new one.
.venv/bin/hk-law statsstats reports document and section counts, the database path, and the last
ingest/fetch times. Check that the language(s) you ingested report non-zero
counts (legislation_sections_en and/or legislation_sections_zh). Exact
counts depend on the archives you ingested; the reference snapshot is in
docs/coverage.md.
Optional: historical versions
Point-in-time statute_history needs the official Past Version archives.
English past archives are roughly 2.1 GB.
.venv/bin/hk-law download --data-dir data/raw --dataset past --languages en
.venv/bin/hk-law ingest --data-dir data/raw --dataset past --language enThese commands ingest into the database named by HK_LAW_DB. Coverage and
selection rules are in
docs/coverage.md#historical-legislation.
Corpus sync and live case access
Legislation is local and auto-updated from DATA.GOV.HK. Case search/read
defaults to live HKLII query-time access so results are current; set
HK_LAW_LOCAL_ONLY=1 for a strictly local MCP.
export HK_LAW_DB="$PWD/data/hk_law.db"
# Check DATA.GOV.HK, download only changed archives, ingest only changed documents.
.venv/bin/hk-law sync --dataset current
.venv/bin/hk-law sync-status
# Update the DOJ Prosecution Code and domestic-violence policy.
.venv/bin/hk-law sync-doj
.venv/bin/hk-law search-doj "alternatives to prosecution"
.venv/bin/hk-law get-doj prosecution_ch5 --paragraphs 5.9
.venv/bin/hk-law verify-doj "Prosecution Code §5.9"
# Import a judgment corpus you are authorised to use (JSONL/CSV/SQLite/HTML dir).
.venv/bin/hk-law import-cases \
--path /path/to/authorised-corpus.jsonl \
--source "licensed-provider" \
--license "Private research; no redistribution"
# Install a daily systemd user timer.
bash scripts/install_sync_timer.shThe MCP launcher defaults to live HKLII for search_cases, get_case,
verify_citation, note_up, and case_graph (HK_LAW_LOCAL_ONLY=0), so
results reflect HKLII's current database. Set HK_LAW_LOCAL_ONLY=1 before
launching for a strictly local MCP; local results and the coverage report still
work. Bulk sync still requires a permission reference and an explicit citation
list. There is no built-in LRS/HKLII crawler — both sources prohibit
automated harvesting without permission, and their robots.txt files disallow
the relevant paths.
Full setup, import schemas, state tables, and the permission boundary: docs/full-local-pipeline.md and docs/permission-request-template.md.
With the corpus in place, connect the server: Use with Claude Code.
Use it from a phone or a hosted AI
The same process can serve the corpus over HTTPS to web assistants and phones:
.venv/bin/hk-law serve-http
# Connect http://127.0.0.1:8765/connect
# Web app http://127.0.0.1:8765/
# MCP http://127.0.0.1:8765/mcp
# REST/OpenAPI http://127.0.0.1:8765/api/ · /openapi.json/connect is the plug-and-play page: it detects the deployment mode and gives
one button per client, copies the MCP URL where a platform cannot prefill it,
and serves an MCP Registry manifest plus a one-command DeepSeek Harness
installer.
One endpoint set covers:
Where you are | What to connect |
Claude web / desktop / mobile | Custom connector → |
ChatGPT web / mobile | Developer-mode connector → |
Gemini app / API | Custom MCP connector via OAuth, or |
DeepSeek Harness | HTTP MCP server via |
Any phone browser |
|
Scripts / custom GPTs |
|
Hosted assistants connect from the provider's cloud, so they need a public HTTPS URL. For a public deployment:
cp .env.example .env # set the access key and public URL
docker compose up -d --build # app on 127.0.0.1:8765
# put Caddy in front; see deploy/CaddyfileHK_LAW_HTTP_ACCESS_KEY is both the bearer token and the OAuth consent
password. The server refuses a non-loopback bind without a key unless you
explicitly opt into anonymous access. For a public one-click deployment,
set HK_LAW_HTTP_PUBLIC_URL and HK_LAW_HTTP_ALLOW_ANONYMOUS=1 with no key:
OAuth is auto-approved and /connect works for everyone. Full per-client
steps, OAuth details, security notes and troubleshooting are in
Remote access: ChatGPT, Claude, Gemini, DeepSeek and phones.
Use with Claude Code
The repository ships a project-scoped .mcp.json and a user-scope installer.
Use the project-scoped server while working in this repo; use the user-scope
server to make the tools available in every project.
Scope | Server name | Setup |
Project |
| Approve |
User |
|
|
Project-scoped server
{
"mcpServers": {
"hk-criminal-law-local": {
"command": "bash",
"args": ["scripts/run_mcp.sh"]
}
}
}Open the project in Claude Code and approve hk-criminal-law-local. The 12
skills under skills/ are written for this server; scripts/link_skills.sh
links them into .claude/skills/ for project-scoped discovery.
bash scripts/link_skills.shUser-scoped server
bash scripts/install_global.shThis creates a dedicated venv under ~/.local/share/hk-criminal-law-mcp,
installs the package there, links the local corpus, copies all 12 skills to
~/.claude/skills/hk-criminal-law as one skills-dir plugin, and adds the MCP
server at user scope under the name hk-criminal-law.
The repository's project-scoped server is named hk-criminal-law-local so it
does not collide with the global hk-criminal-law registration. Both expose
the same tools.
Manual equivalent:
claude mcp add --scope user hk-criminal-law \
-e HK_LAW_DB="$PWD/data/hk_law.db" \
-- "$PWD/.venv/bin/python" -m hk_criminal_law_mcp.serverIf you use the manual command instead of the installer, the MCP server is
global but the skills remain project-scoped unless you copy or link them into
~/.claude/skills/.
Use from the CLI
Run these from the repository root. The CLI reads the database named by
HK_LAW_DB; if you built the corpus in a new shell, set it first:
export HK_LAW_DB="$PWD/data/hk_law.db"Alternatively, pass --db <path> before the subcommand, for example
hk-law --db data/hk_law.db stats.
Legislation
.venv/bin/hk-law get-section 221 9J
.venv/bin/hk-law get-section-range 221 9A 9J
.venv/bin/hk-law search-legislation "bail conditions" --cap 221
.venv/bin/hk-law statute-history 221 9J --as-of 2020-01-01
.venv/bin/hk-law section-versions 221 9J
.venv/bin/hk-law list-ordinancesJudgments
.venv/bin/hk-law search-cases "bail conditions" --court HKCFA
.venv/bin/hk-law get-case "[2021] HKCFA 1" --paragraphs 1 3Verification
.venv/bin/hk-law verify "Cap. 221 s.9J"
.venv/bin/hk-law verify-text "Cap. 221 s.9J; [2021] HKCFA 1"Research packs
.venv/bin/hk-law doctrine "bail conditions"
.venv/bin/hk-law sentencing 210 9
.venv/bin/hk-law authority "bail conditions" --live
.venv/bin/hk-law case-graph "[2021] HKCFA 1"Corpus health
.venv/bin/hk-law statsMCP tools
Every response carries provenance (source_url, version_date, language) and
a disclaimer. Search responses say explicitly that a snippet is not the
provision.
If you are not sure where to start:
Find a provision:
search_legislation→get_section.Check a citation:
verify_citationorverify_citations.Check prosecution policy:
doj_status→search_doj→get_doj_document.Read a judgment:
search_cases→get_case_paragraphs.Check later treatment:
note_uporcase_graph.Explore an issue:
doctrine_research,sentencing_research, orauthority_ranking.
Legislation tools
Tool | Purpose |
| Full-text search over the indexed HKeL corpus (EN/ZH) |
| One section/schedule, with heading, part, version date, URL |
| All sections in a range, e.g. Cap. 221 ss. 9A–9J |
| Point-in-time provision text from the Past Version archives |
| Every historical version date available for a section |
| Browse indexed ordinances/regulations |
DOJ policy tools
Tool | Purpose |
| Search the local Prosecution Code and domestic-violence policy corpus |
| Read a DOJ page by slug, optionally filtered to paragraph numbers |
| Browse indexed DOJ publications and paragraph counts |
| Verify a DOJ policy citation such as |
| DOJ coverage, freshness and provenance |
| Politeness-limited incremental DOJ update (also |
Judgment tools
Tool | Purpose |
| Local judgment FTS only by default; |
| Read a local judgment by neutral citation; |
| Return specific numbered paragraphs from the local corpus |
| Cached note-up data; live retrieval only with permission (research aid, not a citator) |
Verification tools
Tool | Purpose |
| Verify a legislation or case citation |
| Extract and verify every citation in a passage |
Research-pack tools
Tool | Purpose |
| Legislation + ranked case leads for an issue |
| Penalty text + sentencing case leads (not a tariff) |
| Rank case results by court level and cached note-up |
| Outgoing and incoming citations for a case |
Corpus status
Tool | Purpose |
| Counts, coverage, live/local mode, and last ingest/fetch times |
| Coverage by court, recent sync runs, source provenance, and whether a permission reference is configured |
Neither tool returns the permission value itself.
Defence skills
The 12 skills under skills/ are practice scaffolds. They tell the model what
to retrieve and verify, not what the law is.
Common paths:
New arrest, summons, or police contact:
hk-criminal-intake→hk-bail-application.Charge sheet or indictment:
hk-charge-analysis→hk-case-file-review→hk-defense-strategy.Trial or sentence:
hk-trial-defense→hk-sentencing-mitigation.Appeal:
hk-appeal.Research question:
hk-legal-research.Special issues:
hk-juvenile-defenseorhk-mental-health-criminal.Conduct and ethics:
hk-professional-ethics.
Skill | Use |
| First response, arrest/police station, deadlines |
| Bail, review, sureties, conditions |
| Elements grid, defences, venue/penalty |
| Evidence matrix, disclosure, inconsistencies |
| Plea vs trial, charge negotiation, decision memo |
| Guideline authorities, mitigation, totality |
| Trial plan, cross-examination, closing |
| Routes, leave, grounds, fresh evidence, bail pending appeal |
| Verification-first research protocol |
| Conflicts, confidentiality, candour, media |
| Age, safeguards, forum, sentencing |
| Fitness, psychiatric evidence, hospital orders |
Each skill instructs the model to retrieve the current provision and the paragraph it relies on. None of them authorises citation from memory.
See skills/README.md for installation and editing notes.
Data sources and licensing
Legislation: Hong Kong e-Legislation current-version XML, published by the Department of Justice on DATA.GOV.HK. Free reuse with attribution under the DATA.GOV.HK terms.
DOJ policy publications: the Prosecution Code and the domestic-violence prosecution policy are fetched from https://www.doj.gov.hk/ at the operator's direction, cached locally in the SQLite corpus, and not redistributed. They are policy material, not legislation or judgments. Verify every paragraph against the DOJ source.
Judgments: the default MCP uses live HKLII query-time access for case search/read; it stores no judgment text in the repository. Judgment text is imported only from an authorised corpus, or fetched through a permission-gated citation list. The Judiciary LRS permits downloading for private study and research; commercial reuse requires written permission. The LRS
robots.txtisDisallow: /and HKLII's isDisallow: /api; this project does not crawl either source. It does not redistribute judgment text or a prebuilt judgment database.No warranty: the HKLII JSON endpoints are undocumented and may change.
Code is Apache-2.0. Skills and documentation are CC BY 4.0. Downloaded data is not covered by those licenses.
Full terms, attribution rules, and a compliance checklist: docs/data-sources-and-licensing.md.
Reliability model
Local corpus is authoritative for retrieval, not for legal conclusions.
Every citation is verified with
verify_citationor retrieved in full;verify_citationschecks a whole passage at once.Judgments are cited by paragraph, not by page or summary.
Currency is explicit: current or historical legislation version date; judgment fetch date; note-up warning.
Point-in-time text is never inferred. If the Past Version archive is not ingested,
statute_historyreturns the current text with an explicit warning.Unverified material is labelled
[UNVERIFIED]and cannot be presented as authority.
See docs/reliability.md for the failure modes this model is designed to catch, the verification controls, and the audit procedure.
Limitations
Current-version legislation is always available. Point-in-time text requires the official Past Version archives to be downloaded and ingested; coverage depends on which ranges/languages were ingested. Commencement timelines are not reconstructed.
Case law coverage is live HKLII query-time by default; local judgment coverage depends on the authorised corpus or citation list you import. There is no built-in LRS/HKLII crawler; both sources prohibit automated harvesting without permission, and their
robots.txtfiles disallow the relevant paths.HKLII endpoints are unofficial; a change or block is possible. A live search failure falls back to local results with a
live_error; setHK_LAW_LOCAL_ONLY=1for a strictly local MCP.Note-up and authority ranking are not a citator of record. Check the Judiciary's LRS and the judgment itself.
sentencing_researchextracts penalty language and case leads; it is not a sentencing tariff or a structured sentencing database.Chinese search uses a trigram index; very short queries fall back to LIKE.
The skills are practice scaffolds, not a substitute for supervised legal work.
See docs/coverage.md for the full coverage picture.
Roadmap
Authorised judgment import and incremental refresh (implemented; see Fully local pipeline).
Judiciary LRS adapter, once a permitted endpoint and scope are confirmed.
Citator-style treatment graph (cited/citing, positive/negative).
Historical Chinese point-in-time coverage and commencement timelines.
PDF/DOCX export with citation tables.
Offence-specific sentencing datasets.
Evaluation suite with gold-standard questions and citation checks.
Documentation map
If you want to... | Read |
Understand how the corpus is built | |
Run a fully local, auto-updating corpus | |
Request permission for automated judgment access | |
Audit before a public push or release | |
Know what is covered | |
Check the verification model | |
Check data terms and attribution | |
Explore the corpus as a semantic map | |
Use the MCP from an agent | |
Use it in ChatGPT, Claude, Gemini, DeepSeek or on a phone | |
Use or edit a defence workflow | |
See every document |
Contributing
Good contributions: parser fixes, additional official data sources, offence/ procedure skills with verified citations, tests for known hard cases, and reliability improvements. Please do not add unverified legal assertions or copied judgment text. Documentation changes should follow the conventions in docs/README.md.
License
Apache-2.0 for code; CC BY 4.0 for skills and docs. See LICENSE and
LICENSE-SKILLS.
Available Tools
30 toolsauthority_rankingARead-onlyIdempotent
Rank case results by court level and note-up data.
live follows HK_LAW_LOCAL_ONLY. Not a citator of record; check
later treatment before relying on a case.
Inputs: query (required), lang, live, court, +1 more.
case_graphCRead-onlyIdempotent
Return outgoing cited cases and incoming note-up citations.
live_note_up follows HK_LAW_LOCAL_ONLY; the public default uses the
local cache.
Inputs: citation (required), lang, live_note_up.
corpus_statusARead-onlyIdempotent
Report database size, coverage, sync freshness, and local-only mode.
Inputs: no named parameters.
doctrine_researchBRead-onlyIdempotent
Return legislation hits and ranked case leads for a doctrine or issue.
live_cases follows HK_LAW_LOCAL_ONLY; the public release can opt
into local-only. This is a discovery pack, not a legal answer. Fetch and
read the judgments you intend to cite.
Inputs: query (required), lang, case_limit, live_cases, +1 more.
doj_statusARead-onlyIdempotent
Report DOJ corpus coverage, freshness and provenance.
Inputs: no named parameters.
get_caseARead-onlyIdempotent
Read a Hong Kong judgment, local by default.
Args:
citation: e.g. "[2021] HKCFA 1".
lang: "en" or "zh-Hant".
paragraphs: Optional paragraph numbers/ranges, e.g. ["12", "15-17"].
max_chars: Truncate the returned full text to this many characters.
allow_live: Defaults to HK_LAW_LOCAL_ONLY=0 (live when local-only is
off); otherwise a missing case is a coverage gap, not an error to
paper over.
Inputs: citation (required), lang, max_chars, allow_live, +1 more.
get_case_paragraphsCRead-onlyIdempotent
Return specific paragraphs, local by default.
allow_live follows HK_LAW_LOCAL_ONLY just like :func:get_case.
Inputs: citation (required), paragraphs (required), lang, allow_live.
get_doj_documentBRead-onlyIdempotent
Read a DOJ publication by slug, e.g. prosecution_ch5.
Args:
slug: e.g. prosecution_ch5 or domesticviolence_11.
lang: en or zh-Hant.
paragraphs: Optional paragraph numbers/ranges, e.g. ["5.9"] or
["14-17"].
max_chars: Truncate the full text to this many characters.
Inputs: slug (required), lang, max_chars, paragraphs.
get_sectionBRead-onlyIdempotent
Return a Hong Kong ordinance section or schedule with provenance.
Args: cap: Cap number, e.g. "221" or "Cap. 221". section: Section number, e.g. "9J", "s9J", or "sch3". lang: "en" (default) or "zh-Hant". max_chars: Truncate very long sections/schedules to this many characters.
Inputs: cap (required), section (required), lang, max_chars.
get_section_rangeBRead-onlyIdempotent
Return all sections between two section numbers (inclusive).
Example: Cap. 221 sections 9A to 9J. Section ordering handles numeric and letter suffixes. Parts/Orders may restart numbering; read the part context.
Inputs: cap (required), end (required), start (required), lang, +2 more.
list_doj_documentsCRead-onlyIdempotent
List indexed DOJ publications and their paragraph counts.
Inputs: lang, limit, category.
list_ordinancesCRead-onlyIdempotent
List indexed ordinances/regulations, optionally filtered by title or Cap.
Inputs: lang, limit, query.
list_section_versionsBRead-onlyIdempotent
List all historical version dates available for a section.
Inputs: cap (required), section (required), lang.
note_upBRead-onlyIdempotent
Return note-up data (research aid, not a citator).
allow_live follows HK_LAW_LOCAL_ONLY; the public default uses the
cache only.
Inputs: citation (required), force, allow_live.
search_casesBRead-onlyIdempotent
Search Hong Kong judgments.
The default follows HK_LAW_LOCAL_ONLY: local-only when set to 1 (the
public launcher default), live HKLII search when set to 0. Live search is
for query-time coverage and remains subject to HKLII's terms.
court accepts a neutral-citation code such as HKCFA/HKCA/HKCFI/HKDC.
Inputs: query (required), lang, live, court, +3 more.
search_dojBRead-onlyIdempotent
Search the DOJ Prosecution Code and prosecution policies.
The local DOJ corpus covers the Prosecution Code and the domestic-violence
prosecution policy. category is prosecution_code or
domestic_violence. This is policy material, not legislation; read the
full page before relying on a paragraph.
Inputs: query (required), lang, limit, category, +2 more.
search_legislationARead-onlyIdempotent
Search the locally indexed Hong Kong e-Legislation corpus.
Args: query: Words or a phrase, e.g. "bail conditions" or "合理懷疑". cap: Optional Cap number filter, e.g. "221" or "Cap. 221". lang: "en" (default) or "zh-Hant". limit: Maximum results (1-50). include_text: Include the full section text, not just a snippet.
Inputs: query (required), cap, lang, limit, +2 more.
semantic_clusterCRead-onlyIdempotent
Show one semantic topic and representative member provisions.
Inputs: cluster_id (required), limit.
semantic_clustersCRead-onlyIdempotent
List semantic-atlas topics, optionally filtered by label or Cap. title.
Inputs: limit, query.
semantic_locateCRead-onlyIdempotent
Find a legislation citation's point(s) and cluster in the semantic atlas.
Inputs: citation (required), language.
semantic_neighborsBRead-onlyIdempotent
Return provisions nearest to a point or citation in the semantic atlas.
Similarity is semantic, not authority or treatment. Verify every result with
get_section and verify_citation.
Inputs: limit, citation, language, point_id.
semantic_searchARead-onlyIdempotent
Search the semantic atlas's citation/heading index for provisions.
This is a metadata/keyword lookup over the generated atlas; use
semantic_neighbors for nearest-neighbour discovery. cluster accepts a
cluster id or a label fragment; language is en or zh-Hant. Read the
provision with get_section and verify it with verify_citation before
relying on it.
Inputs: query (required), limit, cluster, language.
semantic_statusARead-onlyIdempotent
Report whether the semantic atlas is available and what it covers.
Inputs: no named parameters.
sentencing_researchBRead-onlyIdempotent
Return penalty text and sentencing case leads for an offence.
live_cases follows HK_LAW_LOCAL_ONLY. Not a sentencing tariff.
Extracts penalty language from the provision and searches for sentencing
material in the case corpus.
Inputs: cap (required), section (required), lang, case_limit, +1 more.
statute_historyBRead-onlyIdempotent
Return the provision text in force on a date (YYYY-MM-DD).
Uses the official DATA.GOV.HK Past Version archives if ingested. If the
historical corpus is unavailable, returns the current text with
historical: false and an explicit warning.
Inputs: cap (required), section (required), lang, as_of, +1 more.
sync_dojAIdempotent
Incrementally update the local DOJ corpus.
Fetches the curated Prosecution Code and domestic-violence policy pages
(plus bounded discovery from their index pages), using conditional GETs and
checksums. It is polite and may take 20–60 seconds. The full daily update is
also available as hk-law sync-doj.
Inputs: lang, force.
sync_statusARead-onlyIdempotent
Report local coverage, last sync runs, and permission configuration.
Inputs: no named parameters.
verify_citationBRead-onlyIdempotent
Verify a citation against the corpus.
live follows HK_LAW_LOCAL_ONLY; the public default is local.
Examples: "Cap. 221 s.9J", "section 9J of Cap. 221", "[2021] HKCFA 1".
Inputs: citation (required), lang, live.
verify_citationsCRead-onlyIdempotent
Extract and verify every citation in a passage.
live follows HK_LAW_LOCAL_ONLY; the public default is local.
Inputs: text (required), lang, live.
verify_dojARead-onlyIdempotent
Verify a DOJ policy citation, e.g. Prosecution Code §5.9.
This checks the local DOJ corpus only. It is not a citator and does not verify that the paragraph supports a proposition.
Inputs: citation (required), lang, category.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 30 tools
Core families are distinguishable (legislation fetch, case fetch, DOJ, semantic atlas), but several tools sit close together: verify_citation vs verify_citations, get_section vs get_section_range vs statute_history vs list_section_versions, and four separate *_status tools. The five semantic_* tools and the three research pack tools (doctrine_research, sentencing_research, authority_ranking) also overlap in 'find leads' territory, relying on descriptions rather than distinct names to separate them.
The dominant pattern is snake_case verb_noun (search_cases, get_case, verify_citation, sync_doj), which is readable and predictable. However, a sizeable minority are noun phrases with no verb (note_up, statute_history, case_graph, authority_ranking, corpus_status, sync_status, doj_status, semantic_status), and the semantic_* prefix namespace breaks the verb-first convention.
At 30 tools the surface is heavy, and much of the weight is infrastructure/plumbing rather than capability: four *_status tools plus sync_doj/sync_status and five semantic_* tools. A research agent must pick among many near-equivalent entry points, which is more than the domain's core workflows justify.
Coverage is strong for the stated domain: search and retrieval of legislation and judgments, historical versions, range reads, citation extraction/verification, note-up/graph traversal, DOJ policy corpus, and corpus freshness reporting. Gaps are acknowledged rather than hidden (no citator of record, sentence-tariff tables), and agents can work around them by reading full judgments and sections.
Maintenance
Related MCP Connectors
Taiwan legal research MCP by Dr.Legal (法律偵探): 22.7M court judgments, current statutes, administrative rulings and Constitutional Court decisions. Retrieval-only, per-item citations, appeal-chain history, bundle-level citation audit. Free, no API key; OAuth 2.0 dynamic registration completes automatically. 台灣法律 MCP:2,272 萬筆裁判書、法規、函釋、憲法法庭裁判,逐筆附出處並提供引用查核。免費、免金鑰。Docs: https://dr-legal.com.tw/mcp
Resolve, search and verify legal citations against the official sources, with provenance.
Law firm management MCP: manage cases, clients, tasks, calendar and documents via Claude AI.
JusPronto is case-management software for Brazilian law firms. Its remote MCP server (OAuth 2.1 with PKCE, per-permission scopes, audit log) lets Claude and ChatGPT read the firm's own cases, deadlines, agenda, recent court movements and case files with the page cited. Write actions require the lawyer's approval. Requires a JusPronto account.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceRemote MCP server exposing the CounselStack citation engine as nine legal research tools, enabling read-only citation lookup, statute search, and case text retrieval through Claude.-
- AlicenseNot gradedqualityFmaintenanceQuery 3,241 UK statutes directly from Claude, Cursor, or any MCP-compatible client.58 npm5Apache 2.0
- FlicenseNot gradedqualityDmaintenanceA stateless MCP server for Hong Kong legal research, offering tools to analyze legal intent, search official HKeL statutes, fetch current law metadata, and check source status.-
- AlicenseNot gradedqualityBmaintenanceEnables law knowledge Q&A with traceable, citation-verified answers from a shared 38-law article-level index, plus single and batch police incident risk assessment grounded in retrieved statutes. Exposed as stdio MCP tools (law_qa, risk_assess, risk_assess_batch) for dsh, Claude Desktop, Cline, and other MCP clients.1MIT