Content
# CaseLaw MCP
> The Ministry of Government Legislation's OpenAPI (191 types) is standardized to the **MCP(Model Context Protocol) server**, allowing lawyers and law firms to search, cite, and summarize Korean case law, statutes, and decisions in natural language environments such as **Claude Desktop, Gemini CLI, and ChatGPT**.
[](https://pypi.org/project/caselaw-mcp/) [](https://github.com/lapiogga/caseLaw/actions/workflows/ci.yml) []() []() []() []() []() []() []()
**Status**: v0.11.0 — Outcome Prediction. Active MCP Tools **52**, Unit Tests **352 PASS**, Auto-generated Documentation 4 types + Outcome Prediction 4 types.
## Supported Client Matrix
| Client | Transport | Guide | Additional Infrastructure |
|---|---|---|---|
| **Claude Desktop** | stdio | [docs/INSTALL.md §1](docs/INSTALL.md) · One-click `scripts/install-caselaw-mcp.ps1` | None |
| **Gemini CLI** (Official Google) | stdio | [docs/INSTALL_GEMINI.md](docs/INSTALL_GEMINI.md) · One-click `scripts/install-caselaw-gemini.ps1` | None |
| **Cursor / VS Code** (Cline·Continue) | stdio | [docs/INSTALL.md §2~§3](docs/INSTALL.md) | None |
| **ChatGPT** (Apps SDK / Developer Mode) | streamable-http | [docs/INSTALL_CHATGPT.md](docs/INSTALL_CHATGPT.md) | Cloudflare Tunnel (recommended) or ngrok + Bearer Token |
📄 **One-page Introduction for General Users**: [docs/소개자료_일반인.md](docs/소개자료_일반인.md)
🛠️ **Technical Notes for Developers (Architecture, Security, Scalability)**: [docs/기술노트_MCP아키텍처.md](docs/기술노트_MCP아키텍처.md)
---
## One-liner Summary
> **Lawyers (Search → Prediction → Drafting Workflow)**: *"Show me the distribution of sentencing for drunk driving cases and create a draft of the defense counsel's opinion based on the results."* Automatically chain `predict_sentencing` → `draft_criminal_defense` with 100% real case citations.
> **General Users**: *"I lent 50 million KRW to a friend 3 years ago, but they haven't paid me back. What should I do?"* Automatically generate dispute classification, statute of limitations check, litigation costs, free resources, and lawyer consultation kit.
> **Foreign Users**: 5-language (ko/en/zh/vi/ja) disclaimer, label, and foreign resource (1345·1577-1366·1577-5432) automatic mapping.
---
## Quick Start — For Non-Tech Users (Easiest)
> No prior knowledge of Python, JSON, or terminal required. Just click and follow.
**📷 Visual Guide with Screenshots**: [docs/설치_시각가이드.md](docs/설치_시각가이드.md)
Summary:
1. **Download Installation Package** (8KB):
<https://github.com/lapiogga/caseLaw/releases/download/v0.11.0/CaseLaw-installer-v0.11.0.zip>
2. Unzip and **double-click `설치하기.bat`**
3. Follow on-screen instructions (OC key issuance site will open automatically if needed)
4. After 3-7 minutes of automatic installation, open Claude Desktop and chat:
```
caselaw 로 ping 해줘
```
Installation script handles:
- Automatic installation of Python, uv, and Claude Desktop (using winget)
- Downloading caselaw-mcp package from PyPI
- Automatic configuration of Claude Desktop settings file (preserving existing settings and backing up)
Reference Documents:
- [docs/설치_시각가이드.md](docs/설치_시각가이드.md) — Complete guide with screenshots (most friendly)
- [docs/OC발급_가이드.md](docs/OC발급_가이드.md) — OC key issuance guide (9 steps)
---
## Quick Start — For Developers / Technicians
### Prerequisites
1. **OC Key Issuance** (free, 5 minutes): <https://open.law.go.kr/LSO/openApi/cuAskList.do>
- Sign up → Apply for usage → My page → API authentication key management to confirm ID
2. **Required Tools**:
- Python 3.11+ (<https://python.org>)
- uv (`winget install astral-sh.uv`)
- Claude Desktop (<https://claude.ai/download>)
### Option A — PyPI One-liner Installation (Recommended, no git clone needed)
Claude Desktop config (`%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json`):
```json
{
"mcpServers": {
"caselaw": {
"command": "uvx",
"args": ["caselaw-mcp"],
"env": { "CASELAW_OC": "issued_ID" }
}
}
}
```
Save and restart Claude Desktop completely → Chat window "caselaw 로 ping 해줘" → Success.
### Option B — Source Clone (for Developers and Contributors)
```powershell
git clone https://github.com/lapiogga/caseLaw.git
cd caseLaw
uv sync --extra dev
"CASELAW_OC=issued_ID" | Out-File -Encoding ASCII .env
.\scripts\install-caselaw-mcp.ps1
# Restart Claude Desktop completely → "caselaw 로 ping 해줘"
```
Details: [docs/INSTALL.md](docs/INSTALL.md) (including Cursor / VS Code)
---
## For Developers (Source Modification and Contributions)
```powershell
# 1. Install uv (skip if already done)
irm https://astral.sh/uv/install.ps1 | iex
# 2. Clone repository + synchronize dependencies
git clone https://github.com/lapiogga/caselaw-mcp.git
cd caselaw-mcp
uv sync --extra dev
# 3. Set environment variables
copy .env.example .env
# Open .env and input CASELAW_OC=<your_ID>
# - Issuance: https://open.law.go.kr/LSO/openApi/cuAskList.do
# - My page → API authentication key management to confirm
# 4. Test
uv run pytest -v # 352 passed
# 5. MCP Inspector (debugging UI)
uv run mcp dev src\caselaw_mcp\server.py
# 6. Register with Claude Desktop — see docs\INSTALL.md
```
---
## MCP Tools at a Glance (52 types)
### Lawyer Track (35 types)
| Category | Tools | Notes |
|---|---|---|
| Health | `ping` | Server, OC key status, phase, user mode, user locale |
| **Precedents** | `search_precedent` / `get_precedent` / `find_related_precedents` / `find_precedent_by_citation` | Supreme Court, High Court, District Court. Cited cases, reverse search |
| **Current Statutes** | `search_statute` / `get_statute` | Based on enforcement date |
| Constitutional Court | `search_constitutional_decision` / `get_constitutional_decision` | |
| Judicial Interpretations | `search_law_interpretation` / `get_law_interpretation` | Ministry of Government Legislation interpretations |
| Administrative Judgment Precedents | `search_admin_judgment` / `get_admin_judgment` | National Anti-Corruption and Civil Rights Commission, various administrative appeals |
| Committee Decisions | `search_committee_decision` / `get_committee_decision` | **12-type enum** |
| Special Administrative Judgment | `search_special_admin_judgment` / `get_special_admin_judgment` | **4-type enum** |
| Central Ministry Interpretations | `search_central_dept_interpretation` / `get_central_dept_interpretation` | **39 ministry enum** |
| Legal Terms | `search_legal_term` / `get_legal_term` | Dictionary |
| **Analysis Helpers** | `analyze_precedent_trend` / `format_citation` / `compare_precedents` | Trends, citations, comparisons |
| Attachments | `download_attachment` / `extract_attachment_links` | Path traversal prevention |
| **Document Drafting** (v0.10.0) | `draft_civil_complaint` / `draft_legal_opinion` / `draft_preparatory_brief` / `draft_criminal_defense` | Korean standard format Markdown + automatic disclaimer |
| **Outcome Prediction** (v0.11.0) | `predict_sentencing` / `predict_civil_outcome` / `estimate_case_duration` / `dispute_resolution_options` | Sample N + 95% CI + disclaimer |
### General User Track (12 types)
| Category | Tools | Notes |
|---|---|---|
| Mode, Disclaimer | `set_user_mode` / `get_user_mode` / `get_disclaimer` | Lawyer, general user mode branching |
| **Dispute Classification** | `triage_dispute` | **50-type category** (civil 19 + criminal 8 + family 8 + labor 5 + administrative 5 + consumer 5) |
| **Statute of Limitations** | `list_limitation_categories` / `check_statute_of_limitations` | **30-type statute of limitations** + interruption reasons |
| **Costs** | `estimate_litigation_cost` | Filing fee 4 sections + lawyer fees 9 types + free resources 7 types |
| **Interview** | `get_interview_flow` / `interview_facts` | 6-turn fact interview (stateless) |
| **Case Strength** | `evaluate_case_strength` | Label 9 types |
| **Free Consultation** | `recommend_pro_bono` | Nationwide 14 + regional 14 + KLAC 6 + domain-specific |
| **Consultation Kit** | `prepare_consultation_kit` | 13-section Markdown + 10 lawyer questions |
### Foreign User Track (5 types)
| Tools | Notes |
|---|---|
| `set_user_locale` / `get_user_locale` / `get_disclaimer_localized` / `list_disclaimers_localized` / `get_foreigner_resources` | 5 languages (ko/en/zh/vi/ja) + foreign comprehensive guide 1345, etc. |
Detailed input/output schema: [`docs/API_REFERENCE.md`](./docs/API_REFERENCE.md)
Complete code, alias dictionary: [`docs/CODES.md`](./docs/CODES.md)
General user mode guide: [`docs/CITIZEN_MODE.md`](./docs/CITIZEN_MODE.md)
---
## Natural Language Usage Examples (Claude Desktop, Gemini CLI, ChatGPT)
### Search and Citation (Basic Lawyer Workflow)
```
Find 5 recent Supreme Court precedents related to drunk driving and list only the case names.
Summarize the holdings, judgment summaries, and referenced provisions of the first searched precedent in a table.
Extract relevant provisions (around Article 44) from the Road Traffic Act currently in effect.
5 Committee decisions related to cartel.
Search for the legal term "pledge".
```
### Outcome Prediction (New in v0.11.0)
```
Show me the sentencing distribution for drunk driving cases based on 30 Supreme Court precedents.
→ predict_sentencing: Fine 53% / probation 32% / imprisonment 11% (virtual distribution)
What is the average citation rate and recognized amount distribution for a 50 million KRW loan case?
→ predict_civil_outcome: Cited 60% / partial 25% / dismissed 15%, average recognized 42 million KRW
What is the average duration of a civil first-instance trial? Based on simple cases.
→ estimate_case_duration: Average 4 months, 95% CI [2, 7] months
50 million KRW loan. Prioritize maintaining relationship within 6 months.
→ dispute_resolution_options: Settlement recommendation + 4-option matrix
```
### Automatic Document Drafting (New in v0.10.0)
```
Lent 50 million KRW, plaintiff Park Won-go (Seoul Gangnam-gu), defendant Kim Pi-go (Seoul Songpa-gu).
2022. 3. 15. loan, repayment deadline 2023. 3. 14., not repaid. Attached: borrower's note and bank statement.
→ draft_civil_complaint: Korean standard complaint Markdown + disclaimer
Drunk driving sentencing consultation opinion. Blood alcohol level 0.08, no accident, no prior convictions.
→ draft_legal_opinion: Key points, legal reasoning, conclusion skeleton + similar precedent citations
```
### General User Track (Pre-diagnosis before meeting a lawyer)
```
I lent 50 million KRW to a friend 3 years ago, but they haven't paid me back. What should I do?
→ triage_dispute → check_statute_of_limitations → estimate_litigation_cost
→ recommend_pro_bono → prepare_consultation_kit (13-section Markdown)
```
30 scenarios: [`docs/EXAMPLES.md`](./docs/EXAMPLES.md)
## Directory Structure
```
CaseLaw/
├── README.md
├── CHANGELOG.md # Version History (v0.1.0 ~ v0.11.0)
├── VERSION-STAMP.md # Milestone Certification + Frozen Code Area
├── pyproject.toml # uv Project (52 tool, hatchling sdist exclude)
├── .env.example # OC Key + Bearer Token Template
├── src/caselaw_mcp/
│ ├── server.py # FastMCP Entry (52 tool registration, --transport stdio|http)
│ ├── auth.py # Bearer Token ASGI Middleware (CASELAW_AUTH_TOKEN)
│ ├── client.py # Asynchronous HTTP + Retry + URL Masking
│ ├── parsers.py # XML/JSON → English Key Normalization
│ ├── cache.py # SQLite TTL Cache
│ ├── codes.py # Case Type · Court · Committee · Agency Codes (200+ aliases)
│ ├── config.py # pydantic-settings (.env automatic loading)
│ ├── citizen_data/ # Seed (categories 50 + limitations 30 + court_fees, etc.)
│ ├── prediction_data/ # Judicial Yearbook Seed (duration_baselines.json)
│ └── tools/
│ ├── precedent.py # Precedent + find_related + find_by_citation
│ ├── statute.py # Current Statutes
│ ├── constitution.py # Constitutional Court Decisions
│ ├── interpretation.py # Statutory Interpretation
│ ├── admin_judg.py # Administrative Judgment
│ ├── committee.py # 12 Committee Types enum
│ ├── special_judg.py # 4 Special Administrative Judgment Types enum
│ ├── dept_interpretation.py # 39 Central Agency Types enum
│ ├── terminology.py # Statutory Terms
│ ├── analytics.py # analyze_trend / format_citation / compare
│ ├── attachments.py # Annex · HWP/PDF Download
│ ├── citation_lookup.py # Citation Text → prec_id Reverse Search
│ ├── citizen/ # Citizen Track (mode/locale/disclaimer/triage, etc. 12 tools)
│ ├── drafting/ # Practitioner Documents (4 types: complaint, opinion, preparatory document, lawyer's opinion) v0.10.0
│ └── prediction/ # Outcome Prediction (4 types: sentencing, civil outcome, period, solution option) v0.11.0
├── tests/
│ ├── unit/ # 352 Unit Tests
│ └── integration/ # 19 Smoke Scenario Tests
├── docs/
│ ├── INSTALL.md # 5-Client Matrix
│ ├── INSTALL_GEMINI.md # Gemini CLI Registration
│ ├── INSTALL_CHATGPT.md # ChatGPT (HTTP + Cloudflare Tunnel)
│ ├── API_REFERENCE.md # Tool Input/Output Schema
│ ├── CODES.md # Code · Alias Dictionary
│ ├── CITIZEN_MODE.md # Citizen Track Guide
│ ├── OC_PERMISSIONS.md # OC Permission Extension
│ ├── OC 발급 가이드.md # OC Key 9-Step Issuance
│ ├── EXAMPLES.md # 30 Lawyer Natural Language Examples
│ ├── 설치 시각 가이드.md # Non-Technical User Screenshot Guide (11 chapters)
│ ├── 소개자료 일반인.md # 1-Page Introduction
│ ├── 기술노트 MCP 아키텍처.md # 14-Section Technical Note
│ └── promo/ # Video · Screenshot Materials (mp4 git ignore)
├── scripts/
│ ├── 설치하기.bat # Non-Technical User Double-Click Entry Point
│ ├── setup-for-novice.ps1 # Automatic Installation (Python · uv · Claude Desktop)
│ ├── install-caselaw-mcp.ps1 # Claude Desktop config Registration
│ └── install-caselaw-gemini.ps1 # Gemini CLI settings.json Registration
├── .github/workflows/
│ ├── ci.yml # Python 3.11/12/13 Matrix + ruff + pytest
│ └── publish.yml # Release published → PyPI Trusted OIDC Automatic
├── reference/ # Ministry of Government Legislation OpenAPI Guide Original
└── .planning/ # GSD Planning (.gitignore — local memo)
```
---
## Roadmap Progress
| Phase | Content | Version | Status |
|---|---|---|---|
| 0 | Bootstrap (uv, ping tool, CI) | — | ✅ |
| 1 | Precedent + Statute MVP (5 tools) | — | ✅ |
| 2 | Constitutional Court Decisions · Interpretations · Administrative Judgments + Related Precedent Recommendations | — | ✅ |
| 3 | 12 Committees + 4 Special Administrative Judgments + 39 Central Agencies + Statutory Terms | — | ✅ |
| 4 | Quality · Deployment (API_REFERENCE / CODES / CHANGELOG / Release) | v0.1.0 | ✅ |
| 5 | Practitioner Helpers (analyze_trend / format_citation / compare) | v0.2.0 | ✅ |
| 6 | Citation Lookup + Attachment Download | v0.3.0 | ✅ |
| 7 | Citizen Mode MVP (mode / disclaimer / triage 30 types) | v0.4.0 | ✅ |
| 8 | Statute & Cost (limitation 30 + court fees) | v0.5.0 | ✅ |
| 9 | Interview & Strength (6-turn interview + case strength) | v0.6.0 | ✅ |
| 10 | Pro Bono & Consultation Kit (50 category types) | v0.7.0 | ✅ |
| 11 | i18n MVP (5 languages + foreign resources) | v0.8.0 | ✅ |
| 12 | **Multi-Client Edition** (Claude · Gemini · ChatGPT) | **v0.9.0** | ✅ |
| 13 | **Practitioner Document Drafting** (complaint · opinion · preparatory document · lawyer's opinion) | **v0.10.0** | ✅ |
| 14 | **Outcome Prediction** (sentencing · civil outcome · period · solution option) | **v0.11.0** | ✅ |
| 15+ | Backlog: ChatGPT OAuth 2.1 / Vector DB / Foreign Precedents / ML Labeling | — | ⏭ |
Details: [`.planning/ROADMAP.md`](./.planning/ROADMAP.md) · [`CHANGELOG.md`](./CHANGELOG.md) · [`VERSION-STAMP.md`](./VERSION-STAMP.md)
---
## Security
- `.env` (OC Key) **absolutely no commit** — registered on `.gitignore` line 4
- OC Key log · error message plain text exposure prohibited — `client.py` automatically masks (`***OC***`)
- httpx library INFO log silenced (URL plain text exposure prevention)
- All external inputs (`prec_id`, `law_id`, `term_id`) are validated with `^[0-9]+$` whitelist
Detailed Checklist: [`docs/INSTALL.md#5-security-checklist`](./docs/INSTALL.md)
---
## Performance
- Response **0.008 seconds** when cache hits (goal <1 second 125x)
- Permanent cache for body (precedents · decisions immutable), list 1-hour TTL, statutory terms 24-hour TTL
- httpx asynchronous + tenacity retry (5 attempts exponential backoff)
- Rate limit: default 5 req/sec (asyncio.Semaphore)
---
## Contribution
Issues · PR welcome. Korean OK.
---
## License
MIT (`LICENSE` file included, free + commercial use allowed)
---
## Inquiry
Jaewoo Park · lapiogga@gmail.com
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
No recommendations available