by aa0101181514
台灣法律 MCP 伺服器 + CLI(免費、免註冊、免 API key):2,250 萬筆裁判書、行政函釋、憲法法庭裁判,附引用查核。Free Taiwan legal MCP server for Claude/ChatGPT/Codex — bring your own LLM, retrieval-only.
# Add to your Claude Code skills
git clone https://github.com/aa0101181514/tw-legal-ragGuides for using mcp servers skills like tw-legal-rag.
Last scanned: 8/24/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-08-24T04:42:32.389Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}tw-legal-rag is an open-source mcp servers skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by aa0101181514. 台灣法律 MCP 伺服器 + CLI(免費、免註冊、免 API key):2,250 萬筆裁判書、行政函釋、憲法法庭裁判,附引用查核。Free Taiwan legal MCP server for Claude/ChatGPT/Codex — bring your own LLM, retrieval-only. It has 298 GitHub stars.
Yes. tw-legal-rag passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/aa0101181514/tw-legal-rag" and add it to your Claude Code skills directory (see the Installation section above).
tw-legal-rag is primarily written in Python. It is open-source under aa0101181514 on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other MCP Servers skills you can browse and compare side by side. Open the MCP Servers category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh tw-legal-rag against similar tools.
No comments yet. Be the first to share your thoughts!
Top skills in this category by stars
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
twlegalrag)免費、免註冊、免 API key 的台灣法律 MCP 伺服器:在 Claude、ChatGPT、Codex、Cursor 加入
https://tlr.dr-legal.com.tw/mcp一個網址,AI 助理就能直接語義檢索 2,250 萬筆台灣裁判書、 行政函釋與憲法法庭裁判,逐筆附引用查核。另提供同一後端的公開原始碼 CLI(twlegalrag)。Free, no-signup, no-API-key Taiwan legal MCP server + source-available CLI, backed by Legal Detective's 22M-judgment semantic retrieval infrastructure.
Taiwan Legal RAG CLI retrieves Taiwan court judgments from Legal Detective's public TLR endpoint and packages them for use with your own AI tools. It does not generate legal advice, does not call any LLM, and does not guarantee semantic faithfulness of third-party model outputs. Its built-in citation check only verifies whether cited judgments belong to the retrieved bundle.
作者:黃思齊(Aaron Huang)律師,法律偵探/Dr.Legal 創辦人(個人介紹)。
繁中:Taiwan Legal RAG CLI 是一個公開原始碼命令列工具,連接法律偵探建置的 2,250 萬筆 台灣裁判語義檢索服務(22,527,498 筆,截至 2026-08-22),讓你能用自然語言搜尋判決,並將檢索結果帶入自己的 AI 工具使用。
一、法規範(依法位階)
| 位階 | 資料類型 | 數量 | 說明 |
|---|---|---|---|
| 憲法 | 憲法 | 1 部/197 條 | 中華民國憲法,含增修條文 12 條 |
| 憲法 | 釋字與憲判字 | 870 筆 | 大法官解釋 813 筆、憲法法庭判決 57 筆,有拘束全國各機關及人民之效力 |
| 法律 | 法律 | 1,083 部/45,620 條 | 定名為法、律、條例或通則者(中央法規標準法 §2) |
| 命令 | 命令 | 7,474 部/132,760 條 | 定名為規程、規則、細則、辦法、綱要、標準或準則者(同法 §3) |
| 命令 | 行政規則 | 83,778 筆 | 78 個機關發布之解釋性規定與裁量基準(行政程序法 §159),對外不生法規範效力 |
| 沿革 | 已廢止法規 | 3,230 部 | 法律 254 部、命令 2,974 部,及動員戡亂時期臨時條款等憲法位階規範,標示廢止狀態供查考 |
二、裁判與裁決
| 資料類型 | 數量 | 說明 |
|---|---|---|
| 裁判書(司法院各級法院) | 22,527,498 筆 | 語義檢索+詞彙檢索+案號精確調卷;每日增量同步司法院公開資料 |
| 不當勞動行為裁決(勞動部裁決委員會) | 400 筆 | 勞動議題查詢自動並列,明確標示為裁決、非法院判決 |
三、輔助資料
| 資料類型 | 數量 | 說明 |
|---|---|---|
| 審級關聯(上訴鏈) | 4,510,000+ 筆 | 隨判決附 case_history,含主文「廢棄/駁回」旗標 |
| 函釋效力履歷 | 50,800+ 筆 | 廢止/停止適用/被取代狀態追蹤,引用前驗效力 |
法規範與裁判之取用方式:裁判書、行政規則走 hosted MCP 的語義檢索與字號精確查詢; 憲法、法律、命令於 dr-legal.com.tw 站上檢索。
裁判書為每日增量同步(司法院公開資料釋出有數日時差,極新宣判的裁判請以官網為準)。 以上數字直接取自 production 資料庫並標註統計日,非估計值。
| 法院層級 | 筆數 |
|---|---|
| 地方法院 | 16,686,158 |
| 地方法院簡易庭 | 3,268,495 |
| 高等法院及分院 | 1,328,661 |
| 最高法院 | 399,290 |
| 高等行政法院 | 200,600 |
| 最高行政法院 | 122,964 |
| 地方行政訴訟庭 | 78,891 |
| 智慧財產及商業法院 | 23,678 |
| 高雄少年及家事法院 | 22,113 |
| 其他專業法庭・委員會 | 32,250 |
| 未帶法院代碼欄位(計入總數,不列層級) | 356,515 |
| 合計 | 22,527,498 |
| 案件類別 | 筆數 |
|---|---|
| 民事 | 14,232,712 |
| 刑事 | 7,332,321 |
| 行政 | 573,417 |
| 其他 | 24,650 |
| 機關 | 筆數 |
|---|---|
| 財政部 | 10,602 |
| 內政部國土管理署 | 8,769 |
| 經濟部智慧財產局 | 7,161 |
| 法務部 | 7,064 |
| 勞動部 | 6,257 |
| 行政院環境保護署 | 4,463 |
| 行政院公共工程委員會 | 4,104 |
| 銓敘部 | 3,988 |
| 經濟部 | 3,118 |
| 農業部 | 3,057 |
| 金管會 | 2,815 |
| 內政部 | 2,648 |
| 前司法行政部 | 1,432 |
| 法務部行政執行署 | 1,410 |
| 內政部戶政司 | 1,391 |
| 公務人員保障暨培訓委員會 | 684 |
| 主計總處 | 669 |
| 國科會 | 567 |
| 文化部文化資產局 | 561 |
| 農業部水保署 | 543 |
| 司法行政部 | 433 |
| 考選部 | 429 |
| 人事行政總處 | 322 |
| 核能安全委員會 | 227 |
| 原住民族委員會 | 224 |
| 海洋委員會 | 213 |
| 公平交易委員會 | 204 |
| 文化部 | 203 |
| 法務部矯正署 | 167 |
| 中央選舉委員會 | 112 |
| 農業部林業及自然保育署 | 103 |
| 客家委員會 | 97 |
| 國家發展委員會 | 86 |
| 考試院 | 85 |
| 個人資料保護委員會籌備處 | 73 |
| 故宮博物院 | 55 |
| 環境部 | 46 |
| 臺灣高等法院檢察署 | 41 |
| 法務部政風司 | 37 |
| 法務部廉政署 | 32 |
| 司法院 | 28 |
| 經濟部能源署 | 28 |
| 法務部調查局 | 20 |
| 其他 35 個機關(各未滿 20 筆) | 88 |
| 合計 | 74,685 |
(機關名稱依函釋原始發文機關記載,含已改制機關之歷史名稱,如「行政院環境保護署」 「前司法行政部」;改制前後分列、不合併,以保留原始發文脈絡。)
這不是一般關鍵字判決搜尋工具。背後連到的是法律偵探長期建置的 TLR 檢索服務:
case_history——隨判決附上資料庫記錄的上下審級與主文
「廢棄/駁回」旗標,引用前就能看到判決是否已被上級審廢棄。docs/mcp-anchor.zh.md。allowed_citations 白名單(只含實際讀入理由全文的
判決)、unread_candidates 標記、寫進每個 bundle 的驗證指示,加上 CLI 端的
citation check。整套設計針對法律 AI 最痛的幻覺型態:字號真實、見解捏造。另一類常見做法是即時轉打司法院/法規官網的站內搜尋。兩者定位不同,可以互補:
| 官網 wrapper | Taiwan Legal RAG | |
|---|---|---|
| 搜尋方式 | 官方站內關鍵字搜尋 | 自建 2,250 萬筆語料的語義檢索,概念相近、用詞不同也找得到 |
| 引用防護 | 通常無 | read-whitelist + 驗證指示 + citation check |
| 案號調卷 | 依官網功能 | 精確調卷,查無時明確告知不得臆測 |
| 審級關聯 | 需自行逐案追 | case_history 直接附上,含廢棄標記 |
| 可用性 | 受官網 WAF / 改版影響,常需本地跑瀏覽器繞驗證 | hosted endpoint,零本地環境需求 |
| 資料即時性 | 官網即時 | 極新公告的裁判請以官網為準 |
官網 wrapper 的強項是即時性與官方來源直連;本工具的強項是語義檢索品質與引用 紀律。
Unlike keyword-only legal search tools, Taiwan Legal RAG CLI connects to a production semantic retrieval backend built on 22M+ Taiwan court judgments, enabling fuzzy concept-level search while keeping model weights, infrastructure, and private indexes server-side.
(措辭說明:公開原始碼的是 CLI,不是模型或向量庫;後端的檢索服務、模型權重、私有 索引都留在伺服器端,不隨本工具公開。)
做:用自然語言檢索判決 → 取得結構化清單、判決全文片段(excerpt)、引用連結 → 打包成 bundle 交給你自己的 AI;並可對 AI 產生的答案做 bundle 層級的引用檢查。
不做:本工具不呼叫任何 LLM、不生成法律意見、不背書任何模型輸出。答案要由 你自己選的 AI(ChatGPT / Claude / Gemini / 本地模型)生成。
check 是 bundle 層級、盡力而為的字串檢查,只驗:
這些都需要閱讀判決全文才能判斷——這也是為什麼 bundle 內附上判決全文片段與
verification instructions,要求下游模型自行核對。pass 只代表「引用的字號身份對得上
bundle」,不代表「法律推論正確」或「引文確實出自那篇」。 另外,check 只比對
bundle 內的內容,不是整個法律偵探資料庫——若你事後自己開判決全文再改寫答案,
check 仍只看 bundle 當初打包的片段。
pip install twlegalrag
只依賴 httpx / typer / rich。不需要任何 LLM 套件或金鑰——本工具不呼叫 LLM。
# 1) 純檢索 — 列出符合的判決
twlegalrag search "勞資 加班費" -n 5 --read
# 2) 打包 — 產生可交給任何 AI 的 bundle ★主流程
twlegalrag pack "車禍對方全責,我可以求償什麼?" -o bundle.json
# → 把 bundle.json 貼給 ChatGPT / Claude / Gemini,要求它只引用 bundle 內的判決
# 3) 引用檢查 — 對任何 AI 產生的答案做 bundle 層級檢查
twlegalrag check bundle.json answer.txt
# 服務是否正常
twlegalrag health
pack 產生的 bundle 包含 query、每筆判決的 citation_id(J1, J2, ...)、
citation_text、citation_url、doc_id、Layer-1 listing、fulltext_excerpt
(判決理由的擷取片段,有長度上限)、case_history(資料庫記錄的審級關聯,v1.1)、
allowed_citations,以及一段 verification_instructions,明確要求下游模型只引用
bundle 內判決、把不支持的命題標為 unverified。stderr 也會印一段 AI USE NOTICE。
v1.1 起 verification_instructions 額外包含見解層自查規則(OPINION-LAYER
SELF-CHECK),要求下游模型在作答後逐一回頭核對:(a) 歸給某判決的見解確實出現在
該判決的 excerpt(不是別篇的、不是推論的);(b) 裁判結果方向(勝訴/敗訴/廢棄/駁回/
發回)沒有顛倒;(c) case_history 顯示已被廢棄的判決,不得當成現行有效見解引用。
這與 check 的 bundle 層級字號檢查互補——字號真實不代表見解真實,見解層的核對
只能由讀了全文的模型自己做,這些規則就是把該動作寫進每個 bundle 的硬性指示。
allowed_citations 是「可引用判決」白名單,只含實際讀入理由全文的判決。CLI 的
pack 會讀入每一筆判決,所以兩者一致。Hosted Remote MCP 的 search_bundle
(/v1/pack)若 read_top < max_results,只讀入前 read_top 筆;其餘判決仍列在
judgments 供瀏覽,但會移到 unread_candidates(非 authority,不可引為法院論理)。
詳見 docs/mcp-anchor.zh.md。
預設打公開端點 https://tlr.dr-legal.com.tw,免金鑰即可使用。若服務方發給你 API key,
可放環境變數或 ~/.twlegalrag/config.toml(已 git-ignore,切勿 commit):
export TWLEGALRAG_TLR_BASE_URL=https://tlr.dr-legal.com.tw # 預設
export TWLEGALRAG_TLR_API_KEY=... # 選用;公開端點不需要,僅限服務方另行核發的企業金鑰
[tlr]
# base_url = "https://tlr.dr-legal.com.tw"
# api_key = "..."
先講清楚哪些東西永遠不會經過 TLR 伺服器:
其餘請務必理解的網路傳輸:
https://tlr.dr-legal.com.tw)以取得判決。twlegalrag/faithful/ 是一組零依賴純函式(只用標準庫 re + unicodedata)。
給定答案文字與 bundle 內判決片段,回 pass / needs_review / fail。設計上保守:
不確定時回 needs_review 而非 fail,以壓低誤報。它不呼叫 LLM、不碰資料庫,是
確定性的字串分析。
⚠️ 這個目錄是內部程式的快照,裡面有些函式(如 check_party_as_court /
run_all_checks)CLI 並沒有用到。它們存在不代表 CLI 能做見解層 / 語義驗證——
CLI 只用其中兩個 bundle 層級檢查。請勿把檔案清單當功能清單。詳見
twlegalrag/faithful/VENDORED.md。
result_token,可對 bundle 內任一判決直接調閱全文。hit_excerpt(命中段落預覽);引用仍以理由全文為準。get_judgment_fulltext 支援 excerpt_offset 分頁,長判決可完整讀畢。search_type: keyword / phrase)強化,適合專有名詞
與技術用語;概念性問題建議預設的 hybrid。以上為伺服器端能力,REST 與 Remote MCP 介面即日可用。CLI v2.1.0 已跟進:
pack 自動分頁讀完長判決(bundle 每篇全文預算加倍),並將命中段落
hit_excerpt 帶入 bundle。
這個 CLI 是接 TLR 檢索服務的方式之一。同一個後端 tlr.dr-legal.com.tw 也支援把判決
搜尋透過 Remote MCP 直接接進你的 AI 工具。兩者填同一個 MCP 端點
https://tlr.dr-legal.com.tw/mcp,連線時會自動完成 OAuth(動態註冊,無需自行申請或
設定 API key):
https://tlr.dr-legal.com.tw/mcp。https://tlr.dr-legal.com.tw/mcp。skills/tw-legal-rag/,把整個資料夾放到你專案的
.claude/skills/ 即可。它包裝本 CLI 的 pack 子指令,讓 Claude 在你問到
台灣判決/法律論據時自動檢索、並要求只引用 bundle 內的 citation_id。
skill 內附的 scripts/search_judgments.py 會自動定位執行檔,並處理 Windows
上