# tw-legal-rag

Connects an AI assistant to semantic search over Taiwan court judgments and administrative interpretations, with citation checks on every bundle.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed · ★ 333
- Author: aa0101181514
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/aa0101181514/tw-legal-rag
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/mcp/tw-legal-rag

## What it does

The server searches a structured corpus of Taiwan court decisions by meaning, so a query does not have to match the wording used in the judgment. You can also pull a case by its full citation, see the appeal chain with flags for reversed or dismissed rulings, and look up administrative interpretations together with their validity status. Statutory text comes back by law name and article number.

Citation discipline is the core idea. Each result bundle carries an `allowed_citations` whitelist of judgments whose reasoning was actually read, plus verification instructions for the downstream model. The CLI `check` compares a model answer against that bundle as strings: it flags case numbers that are not in the bundle and quoted sentences that do not appear anywhere in it. That catches one of the nastiest failure modes in legal AI, a real citation attached to an invented holding.

What `check` cannot do is tell whether the model read the holding correctly, whether a quote comes from the specific judgment the answer names, or whether a party's argument was mistaken for the court's reasoning. Those need a human reading the full text. Setup in Claude is one command pointing at `https://tlr.dr-legal.com.tw/mcp`, no signup or API key, and the server itself calls no LLM. The separate CLI installs with `pip install twlegalrag` and needs `httpx`, `typer` and `rich`. Very fresh rulings reach the corpus after a delay, so the official court site stays ahead of it.

## Requirements
- Remote server: `https://tlr.dr-legal.com.tw/mcp`

## Install

### Claude Code (native platform)

**Platform CLI: remote server**
```bash
claude mcp add --transport http tw-legal-rag https://tlr.dr-legal.com.tw/mcp
```

### Codex

**Platform CLI: remote server**
```bash
codex mcp add tw-legal-rag --url https://tlr.dr-legal.com.tw/mcp
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "tw-legal-rag": {
            "url": "https://tlr.dr-legal.com.tw/mcp"
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "tw-legal-rag": {
            "type": "http",
            "url": "https://tlr.dr-legal.com.tw/mcp"
        }
    }
}
```

### Gemini CLI

**Platform CLI: remote server**
```bash
gemini mcp add -t http tw-legal-rag https://tlr.dr-legal.com.tw/mcp
```

## When to use it
- Find judgments by concept when you do not know the exact phrasing
- Pull a case by citation and check whether a higher court reversed it
- Verify that an article exists and read its current wording
- Catch fabricated case numbers in a model's draft answer
- Check the validity status of an administrative interpretation before citing it

## Example prompts
- Find judgments on overtime pay disputes and show which ones were reversed on appeal
- Pull the case by its citation and summarise what each instance decided
- Look up article 184 of the Civil Code and quote the text

## Similar
- [langchain-rag](https://affpapa.org/en/nevibecode/skills/langchain-rag.md) — skill · 17500 installs
- [rag](https://affpapa.org/en/nevibecode/skills/rag.md) — skill · 3700 installs
- [rag-retrieval](https://affpapa.org/en/nevibecode/skills/rag-retrieval.md) — skill · 1500 installs
- [rag-engineer](https://affpapa.org/en/nevibecode/skills/sickn33-rag-engineer.md) — skill · 1000 installs
- [rag-implementation](https://affpapa.org/en/nevibecode/skills/rag-implementation.md) — skill · 13906 installs
- [agent-platform-rag-engine-management](https://affpapa.org/en/nevibecode/skills/agent-platform-rag-engine-management.md) — skill · 8626 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
