Tw Legal Rag logo

Tw Legal Rag

Search 22M+ Taiwan legal records with semantic retrieval, court links, current statutes, administrative interpretations, and citation checks.

Install Tw Legal Rag

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "tw-legal-rag": {
      "command": "uvx",
      "args": [
        "twlegalrag"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Install not yet sandbox-tested— we haven't run this command through our automated sandbox yet. Not a red flag; we're working through the catalog.

Overview

tw-legal-rag connects AI clients to Dr.Legal's Taiwan legal retrieval service through a Streamable HTTP MCP endpoint or its companion CLI. It searches more than 22 million court judgments, administrative interpretations, constitutional decisions, and related legal data using semantic, lexical, and case-number queries. Results include citation metadata, excerpts, and appellate-history information, while bundles provide an allowed-citation list and verification instructions. Reach for it when an agent needs Taiwan-law research with safeguards against citing judgments outside the retrieved evidence.

Use cases

  • Search Taiwan judgments by legal concept, court, date, or case type
  • Retrieve current statutory text before quoting an article
  • Package research results for use with an external AI assistant
  • Check whether an AI answer cites judgments contained in its evidence bundle

Key features

  • Semantic and lexical retrieval across 22M+ Taiwan judgments
  • Exact case-number and administrative-interpretation lookup
  • Court, date, and case-type filtering
  • Appellate case-history metadata with disposition flags
  • Citation allowlists and bundle verification instructions
  • CLI commands for search, packaging, law lookup, and citation checks

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

33/37 checks healthy over the last 112d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 12d ago via OSV.dev · twlegalrag (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars359Stargazers on the source repository.
Last commit8d agoMost recent push to the default branch.
Directory activity1 viewsConfig copies, upvotes, and views on AllMCPs.

How Tw Legal Rag works

What tw-legal-rag does

tw-legal-rag provides MCP access to Dr.Legal's Taiwan legal retrieval backend and also ships as the twlegalrag command-line client. The service covers 22,846,886 Taiwan court judgments, administrative interpretations, constitutional court decisions, labor-board rulings, legal provisions, and supporting case-history data, with statistics dated 2026-11-21.

Its six MCP tools cover judgment search, judgment full text and appellate relationships, citation-guarded bundles, current article lookup, administrative-interpretation number lookup, and semantic administrative-interpretation search. Judgment retrieval supports natural-language semantic search, lexical matching, exact case-number lookup, court filters, case-type filters, and date ranges. Queries can also name a court such as the Supreme Court or Supreme Administrative Court.

How it works

The hosted endpoint is available at https://tlr.dr-legal.com.tw/mcp using Streamable HTTP and OAuth authorization. On first connection, users sign in to a Dr.Legal account with Google or email; an API key is not required.

The CLI calls the public TLR retrieval endpoint rather than embedding a local judgment database, model, vector index, or retrieval pipeline. search returns structured results and can include readable material. pack creates a bundle containing query data, citation identifiers, URLs, document identifiers, excerpts, case history, an allowed_citations list, and instructions for a downstream AI system. The bundle is designed for use with an AI tool selected by the user; the CLI itself neither calls an LLM nor generates legal advice.

Case-history data can show related appellate decisions and flags indicating whether a judgment was vacated or dismissed. Administrative interpretations remain separate from court judgments and include effect-status information such as verified validity, repeal, suspension, or replacement. Current statutory articles are retrieved by law name and article number, with common abbreviations resolved to official names.

The CLI's check command performs a bundle-level, best-effort string check. It can identify cited case numbers outside the bundle and check whether a quoted sentence appears somewhere in the bundled text. A passing result confirms only that the citation or text matches the bundle; it does not establish that the quotation belongs to the cited judgment, that a court's reasoning was understood correctly, or that a paraphrase is accurate.

Setup and configuration

Install the CLI with:

Terminal
pip install twlegalrag

Its listed dependencies are httpx, typer, and rich; no LLM package or LLM key is needed. Configure the TLR connection key before using the CLI. For MCP clients, add the hosted endpoint as a custom connector or remote MCP server and complete the Dr.Legal login flow.

Typical CLI commands include:

bash
twlegalrag search "勞資 加班費" -n 5 --read
twlegalrag pack "車禍對方全責,我可以求償什麼?" -o bundle.json
twlegalrag check bundle.json answer.txt
twlegalrag law 民法 184
twlegalrag ref-search "扣繳義務人未依限申報之處罰" -n 5
twlegalrag health

Tools and capabilities

  • Search court judgments with semantic, lexical, or exact-number retrieval.
  • Retrieve judgment text, citation links, and appellate-chain metadata.
  • Build bundles with citation allowlists and downstream verification instructions.
  • Look up current statutory text by law name and article number.
  • Find administrative interpretations by reference number or semantic query.
  • Check AI answers against the contents of a retrieved bundle.

Limitations and notes

Judgments are synchronized incrementally from public Judicial Yuan data, so very recent decisions may lag the official website. Current-law lookup provides present consolidated provisions; historical wording from before an amendment requires an official legislative-history source.

Citation checking operates only on the saved bundle, not the complete Dr.Legal database. It cannot determine whether a passage expresses the court's holding, was merely a party's argument, or was assigned to the correct judgment. The retrieval service and its private indexes remain server-side, and the tool does not provide legal advice or validate downstream model conclusions.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Tw Legal Rag

tw-legal-rag is an MCP server that connects AI clients to Dr.Legal’s Taiwan legal retrieval service. Its main tools search court judgments and administrative interpretations, retrieve judgment text and case history, create citation-guarded bundles, look up current law articles, and check citations against retrieved bundle content.

Add `https://tlr.dr-legal.com.tw/mcp` as a Streamable HTTP MCP connection, then complete the Dr.Legal login flow. The companion CLI installs with `pip install twlegalrag`; CLI users configure a TLR connection key before running commands.

No, the hosted MCP connection does not require an API key. Users sign in to a free Dr.Legal account with Google or email when connecting. The CLI instead requires a configured TLR connection key.

Yes, Cursor is listed as a supported connection method for the hosted MCP endpoint. Add `https://tlr.dr-legal.com.tw/mcp` as a custom MCP connector and complete the authorization process.

No, its citation check only performs a best-effort bundle-level check. It can detect case numbers outside the bundle and find quoted text somewhere in bundled content, but it cannot confirm the correct judgment, legal reasoning, attribution, or paraphrase.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewTw Legal Rag AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/tw-legal-rag?style=directory)](https://allmcps.com/mcp/tw-legal-rag)
HTML Embed
<a href="https://allmcps.com/mcp/tw-legal-rag"><img src="https://allmcps.com/api/badge/tw-legal-rag?style=directory" alt="Tw Legal Rag on AllMCPs" /></a>