Content
# Korean Law MCP
**Korean Law MCP with 10 tools based on 42 APIs from the Ministry of Government Legislation.**
[](https://www.npmjs.com/package/korean-law-mcp)
[](https://modelcontextprotocol.io)
[](LICENSE)
<a href="https://jocohunt.com/p/5lkkxp3x" target="_blank" rel="noopener" title="Top 1 Winner">
<img
src="https://jocohunt.com/images/badges/weekly-light.svg"
alt="Top 1 Winner"
style="width: 250px; height: auto;"
/>
</a>
> MCP Server + CLI based on Open API from the Ministry of Government Legislation. Available for use with Claude Desktop, Cursor, Windsurf, Zed, Claude.ai, etc.
[English](./README-EN.md)
[](https://youtu.be/gmkuOqIV3dc)
<sub>▶ Click to play on YouTube.</sub>
### Connecting to AI
| Connecting to Claude | Connecting to ChatGPT |
|:---:|:---:|
| [](https://youtu.be/KaUKLOH7290) | [](https://youtu.be/KCFIzervxtE) |
---
## v4.7.0 — Ordinance Radar (`ordinance_radar`)
**"Has the superior law changed, but our ordinance hasn't?"** — Automatically track changes to superior laws with a single call.
```
korean-law "Gwangjin-gu Parking Ordinance" → ordinance_radar(ordinanceName="...")
📡 Ordinance Radar
Ordinance: Seoul Metropolitan City Gwangjin-gu Parking Installation and Management Ordinance (effective 20260227)
Referenced superior laws: 3 laws contrasted:
⚠️ Parking Lot Act — currently in effect as of 20260603 (ordinance is about 4 months behind → review target)
✅ Enforcement Decree of Parking Lot Act — currently in effect as of 20250817 (ordinance reflects at the time of enforcement)
⚠️ Enforcement Rule of Parking Lot Act — currently in effect as of 20260331 (ordinance is about 1 month behind → review target)
```
- **Automatic extraction of referenced laws**: Extract laws, enforcement decrees, and enforcement rules cited in the ordinance's Article 1 (Purpose).
- **Revision contrast**: Compare the current effective date of each superior law with the ordinance's effective date to automatically flag review targets.
### + v4.7.1~4.7.4 — Search accuracy and citation verification patches (current 4.7.4)
- **v4.7.4**: Prevent incorrect law returns in `search_law` — Resolved an issue where the law "Basic Law on Artificial Intelligence Development and Trust" was not found, but 50 unrelated laws were returned.
- **v4.7.2**: Fixed an issue where `verify_citations` incorrectly reduced to `PARTIAL_VERIFIED` for law names with modifiers.
- **v4.7.1**: Improved `legal_research` to handle incorrect `task` values and added an alias for `ordinance_radar`.
### + v4.6.1~4.6.6 — Operational stability bundle
- **v4.6.6**: Excluded handshake (initialize/tools/list) from rate limit — Resolved an issue where Claude.ai shared egress IP encountered a 429 error.
- **v4.6.5/4.6.4**: MCP registration review response — Added `destructiveHint` to ToolAnnotations and removed Korean titles.
- **v4.6.3**: Automatic fallback for `search_law` in autonomous ordinances — Attempt to use `search_ordinance` when query returns 0 results.
- **v4.6.2**: Removed rate limit for tools/call — Unblocked handshake 429 errors.
## v4.6.0 — Enhanced citation verification (including content) + Cloud anti-bot bypass
- **`verify_citations` content verification**: In addition to verifying the existence of articles, detect hallucinations with incorrect titles.
- **law.go.kr JS anti-bot bypass**: Bypassed the redirection page with obfuscated URLs and token URLs.
## v4.5.0 — Detection of impending laws (preventing misjudgment of law titles)
`search_law` performs auxiliary searches for impending laws and displays them in the results.
- **Scheduled law title changes**: Display new and old titles during the transition period.
- **Revised laws**: Provide information on impending revisions and effective dates.
## v4.4.1–4.4.3 — Stability patches
- **v4.4.3**: Fixed an issue with `zod` versioning — Resolved a crash issue with `listTools`.
- **v4.4.2**: Recovered `get_annexes` for administrative rule annexes and forms.
- **v4.4.1**: Fixed an issue with advertising schema requirements.
## v4.4.0 — Tool integration (19 → 9 tools, 52% context reduction)
MCP client reduces the number of tools listed in ListTools from ~15.1KB to ~7.2KB.
- Integrated `chain_*` tools into `legal_research` with a `task` parameter.
- Integrated killer features into `legal_analysis` with a `mode` parameter.
## v4.3 — Case law verification + Applicable law judgment
**"Is this case law still valid?" + "Which law applies at the time of the incident?"**
### 1. `cite_check` — Case law verification (Korean-style Shepard's Citator)
```
"2007다27670 still valid?"
```
→ Track subsequent case laws citing the case and detect changes or abolitions.
### 2. `applicable_law` — Applicable law judgment + Special provisions
```
"Road Traffic Act Article 44 on May 10, 2023"
```
→ Identify the applicable law version at the specified date and provide relevant information.
## v4.0 — Three killer features added
**Impact map + Time travel + Step-by-step guide.**
### 1. `impact_map` — Impact graph of articles
```
"Cited cases for Civil Code Article 103"
```
→ Visualize the impact of an article on subsequent case laws and laws.
### 2. `time_travel` — Automatic diff between two time points
```
"Personal Information Protection Act on 2020-01-01 vs 2025-11-01"
```
→ Compare the law text at two different time points and highlight changes.
### 3. `action_plan` — Step-by-step guide
```
"What to do when I didn't receive the deposit?"
```
→ Provide a 5-step guide with relevant laws and regulations.
### + v4.2.0 — Law effectiveness guard (preventing outdated law responses)
`search_law` results are labeled with `[Current]` or `[Historical]` and display effective dates.
### + v4.1.0 — Structured case law search + Automatic evidence connection
Integrated case law search core and connected to detailed evidence.
### + v4.0.9 — law.go.kr API `Referer` header injection
Injected `Referer` header for law.go.kr API calls.
### + v4.0.8 — law.go.kr empty/HTML response retry
Retry law.go.kr API calls with empty or HTML responses.
### + v4.0.7 — National Tax Service case law fallback
Fallback to National Tax Service case law server for cases with missing or empty responses.
### + v4.0.6 — law.go.kr API protocol setting + Case law re-search improvement
Added HTTP protocol option and improved case law re-search.
### + v4.0.5 — Dependency vulnerability patch (Security)
Patched high vulnerabilities with `npm audit`.
v3.5 — Catching Hallucinations in AI Legal Answers
**Detect articles fabricated by LLMs in.** Cross-verifies all citations with official databases from the Ministry of Government Leg```
"According to Article 750 of the Civil Code, I can claim compensation for damages from tort,
Article 60, Paragraph 1 of the Labor Standards Act stipulates annual paid leave,
Article 401-2, Paragraph 7 of the Commercial Act can hold directors liable,
and Article 9999 of the Criminal Act stipulates aggravated punishment"
```
→ With a single `verify_citations` (actual cross-verification results from the Ministry of Government Legislation API):
- ✓ Article 750 of the Civil Code (Contents of tort) exists
- ✓ Article 60 (Annual paid leave), Paragraph 1 of the Labor Standards Act exists
- ✗ **Article 401-2 of the Commercial Act — No Paragraph 7 (maximum Paragraph 2)**
- ✗ **Article 9999 of the Criminal Act — No such article exists (existing range: Articles 1 to 372)**
**Don't blindly trust legal answers from ChatGPT or Claude.** Trust verification is essential for legal AI services, law firms, students, and contract reviews.
## v3.2.0+ — Complex Analysis in Natural Language
Usage remains the same. **Just ask in natural language.** AI understands the question and automatically adds necessary analysis.
### I received a fine, can I get a reduction?
```
"Is it possible to reduce a fine for violating the Food Act?"
```
→ **Disciplinary standards table** by violation type (1st, 2nd, 3rd offense amounts) + **penalty clauses** + actual **administrative appeal cases** where fines were reduced + **amendment history** of relevant clauses.
### I'm importing goods, what legal checks should I do?
```
"FTA application confirmation for import customs clearance"
```
→ **Customs Act** + **customs authority's interpretations** + ** text** + ** schedules** + **tax tribunal judgments** in case of disputes. Previously, you had through four separate sources: Ministry Leg Customs Authority, Tax and Ministry of Foreign Affairs.
### Where do I start with building permit processing?
```
"Building permit procedures under Act"
```
→ **Legal basis** (laws → enforcement decre enforcement rules) + **fees and forms** + relevant **administrative rules, regulations, and notifications** + **local ordinances and special provisions** + **authoritative interpretations** all in one stop.
### If I change one law, what else needs to change?
```
"Impact analysis of changes to the Building Act"
```
→ **Subordinate legislation** (enforcement decrees, enforcement rules) + **local regulations** nationwide that are affected + relevant **administrative rules** are listed.
### Have all delegated matters under this law been```
"Delegated legislation under Health Insurance Act"
```
→unimplemented provisions** that are be regulated by enforcement decrees Does this ordinance conflict with superior```
"Compliance of parking ordin superior laws"
```
→ **al Court decisions on unconstitution **administrative appeal cases** that canceled similar ordinances are searched, and **superior law basis** is compared.
### What has changed and how have precedents evolved?
```
"Legislative History Timeline"
```
→ **Comparison Table** + **Amendment History** for each article + **Precedents/Interpretations** in chronological order.
---
> **No usage changes.** You can ask as you normally would, and the AI will analyze and provide additional information as needed.
>
> After each query, **"Possible next queries"** will be suggested. You can copy and continue your search.
<details>
<summary>v3.2.1~v3.5.5 Change History</summary>
**v3.5.5** — Law Ministry API bot blocking workaround (emergency hotfix)
The Law Ministry's OPEN API started classifying Node.js's default User-Agent (`undici/...`) as a bot and blocking it → fly.dev/Vercel and other cloud hosting services experienced `[EXTERNAL_API_ERROR] fetch failed` or "User information verification failed" XML errors.
- **`fetch-with-retry.ts` now injects a general browser UA header** — no code changes required, one-line patch to fix all tools. Can be overridden with the `LAW_USER_AGENT` environment variable.
- Error messages were misleading, suggesting IP whitelist blocking — actual cause was UA verification.
- Users of claude.ai custom connector who used `https://korean-law-mcp.fly.dev/mcp?oc=...` were immediately affected. v3.5.5 deployment automatically fixed the issue.
**v3.5.4** — Reflecting real-world feedback: introducing explicit NOT_FOUND signals
User feedback: "In real-world usage, I often can't find answers, and the AI provides arbitrary responses. If it can't find something, it should return a clear message."
**Root cause**: some tools didn't set the `isError` flag when a query failed or only returned "없습니다" (which translates to "no") → LLM couldn't detect failures and generated creative responses.
- **`[NOT_FOUND]` / `[HALLUCINATION_DETECTED]` machine-parsing markers introduced** — all failed responses now have a detectable prefix + "⚠️ LLM is prohibited from guessing/generating" warning message standardized
- **`verify_citations`** — if `failCount > 0`, set `isError: true`. Fixed a serious bug where hallucinations were mistakenly considered successful verifications.
- **`annex.ts` / `law-text.ts` / `article-detail.ts` and 10+ other files** — fixed missing `isError: true` settings.
- **Chain tool partial failure transparency** — `chains.ts` silent-drop pattern removed. Failed sections now display `[NOT_FOUND / FAILED]` markers with reasons (expanded from 80 to 200 characters).
- New helper `notFoundResponse(message, suggestions?)` introduced for consistency.
**v3.5.3** — 3 critical bugs fixed after verifying `verify_citations`
Tested with 5 actual Law Ministry API queries → 3 false negatives found → root causes fixed:
- **"민법" (Civil Law) → "난민법" (Refugee Law) partial matching issue** — existing `chains.ts` `findLaws`/`scoreLawRelevance` logic already solved, but `verify_citations` reused its own logic, causing duplication. Extracted into a common module `lib/law-search.ts` for reuse.
- **Failure to parse ordinal numbers (①②③…)** — Law Ministry API returns `항번호` in the form of `"① "`, but existing `parseInt(raw.replace(/[^\d]/g, ""))` removed Unicode ordinal numbers, resulting in NaN. Added `parseHangNumber()` utility to `lib/article-parser.ts`.
- **Short law name search omission** — Law Ministry's lawSearch API returned "상법" (Commercial Law) as the 34th result with `display=20`. Added `display` parameter to `apiClient.searchLaw`, and `verify_citations` now uses `searchDisplay=100`.
Verified with 5/5 accurate judgments (using the example results).
**v3.5.2** — kordoc 2.3.0 → 2.4.0 update (starred/format parsing engine)
**v3.5.1** — lite/full profile system removal (switched to 16 fixed exposed tools). Removed `tool-profiles.ts`, `LITE_TOOLS`, `parseProfile`, and `filterToolsByProfile`. Health endpoint now accurately reports `tools: { exposed: 16, total: 92 }`.
**v3.5.0** — Major feature: `verify_citations` citation verification + Critical hotfixes + security enhancements
- **`verify_citations` introduced** — prevents LLM hallucinations. Extracts regular expressions from user text, looks back 30 characters to infer law names, and cross-verifies with Law Ministry DB. Results: ✓ (exists) / ✗ (does not exist, with scope) / ⚠ (law name unclear)
- **Critical hotfixes** — v3.4.0's `full` parameter was silently ignored in 12 domains (e.g., tax_tribunal, customs). Fixed in `unified-decisions.ts`.
- **Security enhancements** — 2 high-severity issues fixed. `fetch-with-retry.ts` now masks API keys in URLs and logs. `trust proxy true` → `TRUST_PROXY` environment variable (default `1`).
- **Quality improvements** — date regex boundary guards, TAIL boundary detection, and `stripRepeatedSummary` accuracy enhancements.
- **UX improvements** — 8 chain descriptions detailed, search result hints, and query router pattern additions.
**v3.4.0** — Average token reduction of 74% in precedent responses + `get_decision_text` with `full` parameter
Reinterpreted precedent response structure from a RAG perspective: essential parts (rationale, judgment, and orders) are kept in full, while "reasoning" sections are condensed.
- **`compactBody`** — condenses expert opinions and reasoning sections into 800 + 400 characters.
- **`densifyLawRefs`** — removes parentheses from referenced articles (e.g., "Article 390" instead of "Article 390 (Compensation for Non-Performance)").
- **`densifyPrecedentRefs`** — removes "sentenced" and "judgment" from precedent citations and compresses dates.
`get_decision_text` now takes an optional `full?: boolean` parameter. Default (not specified) = condensed; `true` = full text.
**Actual measurements (using fixed IDs, 8 cases)**:
| Domain | Before avg | After avg | Reduction |
|---|---:|---:|---:|
| Precedents | 5,230 chars | 3,049 chars | **-42%** |
| Constitutional Court | 8,368 chars | 1,703 chars | **-80%** |
| Administrative appeals | 8,429 chars | 1,491 chars | **-82%** |
| **Overall** | **7,606 chars (1,901 tok)** | **1,960 chars (490 tok)** | **-74%** |
Significant reductions (80-89%) observed in longer decisions (>15,000 characters). Shorter texts are preserved with `minSave` guard.
**v3.3.1** — Significant expansion of law abbreviations (11 → 52, +41)
Expanded `resolveLawAlias` with `LAW_ALIAS_ENTRIES` to cover more law areas.
**v3.3.0** — Switch to HTTP stateless mode + kordoc 2.3.0
Switched to MCP's official stateless pattern.
- **HTTP stateless transition** — [src/server/http-server.ts](src/server/http-server.ts)
- **kordoc 2.2.5 → 2.3.0** — updated starred/format parsing engine
- **Complete removal of session management code** — including `sessions` Map, `MAX_SESSIONS`, idle cleanup, and more.
**v3.2.3** — Intermediate HTTP session stability improvements. Replaced by **v3.3.0's stateless transition**.
**v3.2.2** — Addition of starred/format query tools (`get_annexes`) to default exposed tools. **Exposed tools increased from 14 to 15**.
**v3.2.1** — kordoc 2.2.5 update.
</details>
<details>
<summary>Developer: Scenario Technical Details</summary>
Added `scenario` parameter to 8 existing chain tools.
| scenario | Host chain | Additional queries |
|---------|-----------|----------|
| `penalty` | chain_action_basis | Starred standards + penalty provisions + administrative appeals + amendment history |
| `customs` | chain_full_research | Customs interpretation precedents + tax tribunal precedents + FTA treaties + tariff tables + 3-stage comparisons |
| `manual` | chain_procedure_detail | Legal system (administrative regulations) + interpretation precedents + related autonomous regulations |
| `delegation` | chain_law_system | Delegation status + legal system (administrative regulations) + article history |
| `impact` | chain_law_system | Legal system tree + related ordinances + article connections + administrative regulations |
| `timeline` | chain_amendment_track | Precedent + interpretation precedent timeline mapping |
| `compliance` | chain_ordinance_compare | Constitutional Court unconstitutional decisions + administrative appeals for illegality + superior law basis |
Scenarios can be **automatically detected** from query keywords or **explicitly specified** with the `scenario` parameter.
**Other improvements:**
- Addition of administrative regulations to the legal system tree (`get_law_system_tree`)
- 3rd fallback for law searches — automatic extraction of law name patterns from complex queries
- Improved search accuracy for `chain_action_basis` precedents and interpretations
</details>
<details>
<summary>v3.1.0~v3.1.5 Change History</summary>
**v3.1.5** — kordoc 2.2.4 + document parsing engine enhancements. README updated.
**v3.1.4** — kordoc 2.2.4 update. Merged cell HTML `<table>` output, markdownToHwpx formatting enhancements.
**v3.1.3** — Integrated search result absence hints (18 tools). Shortened session cleanup period (30 minutes → 10 minutes).
**v3.1.2** — kordoc 2.2.1 update. GFM table special character escape and pipe conflict prevention.
**v3.1.1** — kordoc 2.1 → 2.2 update.
## v3.1.0 — Production Hardening
20 files modified based on real-world checks. Potential bugs, security, and stability improvements.
- **Batch fixes for truncateResponse omissions** — applied to 17 tools with 50KB response limits
- **HTTP server session limits** — MAX_SESSIONS=100 added, 503 responses (DoS defense)
- **CORS wildcard warnings** — added stderr warning logs if not set
- **Parameter pollution defense** — blocked key field overwrites in `search_decisions`/`get_decision_text` options
- **Chain tool stability** — authentication errors (401/403/429) propagated immediately, findLaws safety wrapping
- **API client** — throwIfError now consumes response bodies (preventing stream leaks)
- **CLI improvements** — REPL mode Ctrl+C forced termination implementation
- **SSE server removal** — unused dead code removed (HTTP server supports SSE streaming)
- **Dead code/dependency cleanup** — `zod-to-json-schema`, ordinance hints, `start:sse` script
</details>
<details>
<summary>v3.0.x Change History</summary>
**v3.0.2** — Unified Architecture + Setup Wizard
v2 had 89 tools for 41 Law Ministry APIs.
v3 re-compressed them into **14 tools**.
| | Law Ministry original | v2 | v3 |
|---|:---:|:---:|:---:|
| API/Tool count | 41 | 89 | **14** |
| AI context cost | - | ~110 KB | **~20 KB** |
| Feature coverage | - | 100% | **100%** |
| Profile management | - | lite/full separation | **Single (unnecessary)** |
### Why 89 Tools Became 14
v2's mistake: One tool per API. Intuitive but for AI, it meant reading 89 schemas, **consuming half of the context for tool listing**.
v3's approach change: Integrating tools with similar patterns into one using the `domain` parameter.
Cases, Constitutional Court, Tax Tribunal, Fair Trade Commission, etc., **18 domains** were merged into
`search_decisions(domain)` + `get_decision_text(domain)` **2 tools**.
The rest of the specialized tools (terms, stars, history, etc.) work as before, but accessed only when needed with
`discover_tools` → `execute_tool`.
### What Changes for Users
- **AI is more accurate** — From choosing among 89 tools to 14, AI can judge immediately.
- **Perceived response speed improvement** — 82% reduction in context.
- **Simplified settings** — No need to choose lite/full profiles. Same 14 tools for all clients.
- **Immediate access to 17 decision domains** — No need for discovery.
### Other Changes
- **kordoc 1.6 → 2.2.5** — Document parsing engine upgrade (XLSX/DOCX support, security enhancements, form filling).
- **Bug fix for administrative appeal specialized search** — Added API response key fallback.
- **Bug fix for English legislation specialized search** — Support for new API response structure.
### For Developers
In MCP tool design, **number of tools ≠ number of functions**.
The process of expanding 41 APIs into 89 and then folding them back into 14 was a journey to find the
"right level of abstraction".
Key pattern: **Dispatch Table + Domain Enum**.
Existing handler functions remained unchanged.
</details>
<details>
<summary>v2.x Changelog</summary>
**v2.3.2** — Operational code quality improvement (47 files, -179 lines). Reduced emojis/decorations, chain cache, unified error handling.
**v2.3.0** — Tool profiles (lite/full), URL query API key, kordoc integrated parser.
**v2.2.0** — 23 new tools (64→87). Treaties, legislation-ordinance linkage, document analysis engine.
**v1.8~1.9** — Chain tools 8, batch text search, AI search filter, structured error format.
</details>
---
## Why We Created This
In South Korea, there are **over 1,600 current laws**, **more than 10,000 administrative rules**, and an extensive
case law system involving the Supreme Court, Constitutional Court, Tax Tribunal, Customs Service, and more.
All of this is available on a single site, [the Ministry of Government Legislation](https://www.law.go.kr),
but the developer experience is poor.
This project aims to wrap the entire legal system into **10 tools** that can be directly called by AI assistants or scripts.
It was created by a public servant tired of manually searching through the Ministry of Government Legislation hundreds of times.
---
## Installation and Usage
### Step 0: API Key Issuance (Free, 1 minute)
First, obtain the **Ministry of Government Legislation Open API authentication key (OC)**, which is required for all methods.
1. Visit the [Ministry of Government Legislation Open API application page](https://open.law.go.kr/LSO/openApi/guideList.do).
2. Register and log in.
3. Click the **"Apply for Open API use"** button.
4. Complete the application form to receive your **authentication key (OC)** (e.g., `honggildong`).
5. Use this authentication key in the settings below.
---
### Method 1: Claude Code Plugin (One-line installation, easiest)
If you use [Claude Code](https://claude.com/claude-code), it's done in two lines. The API key will be prompted automatically during installation.
```
/plugin marketplace add chrisryugj/korean-law-mcp
/plugin install korean-law@korean-law-marketplace
```
During installation, you'll be prompted to enter the **Ministry of Government Legislation API key**.
Sensitive information is stored securely.
**Usage:** Ask Claude Code in natural language, and the `korean-law` MCP tool will be called automatically.
```
"What is Article 74 of the Labor Standards Act?"
"Verify the precedent of Article 750 of the Civil Act"
```
**Update:** When a new version is released, update with one line:
```
/plugin marketplace update korean-law-marketplace
```
> Internally, it runs `npx korean-law-mcp@latest`, so the latest version distributed on npm is always used.
#### Troubleshooting: `Permission denied (publickey)` Error
If you encounter this error during installation, it means the Claude Code installer tried to access GitHub via SSH but your SSH key is not registered.
```
Failed to install: Failed to clone repository: Cloning into
'/Users/<user>/.claude/plugins/cache/temp_github_<id>'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
```
**Solution (choose one):**
1. **Force HTTPS (simplest, recommended):** Run one line in the terminal and try `/plugin install` again.
```bash
git config --global url."https://github.com/".insteadOf "git@github.com:"
```
2. **Generate SSH key and register on GitHub:** If you plan to use SSH for other repositories frequently,
```bash
ssh-keygen -t ed25519 -C "your-email@example.com" # Press Enter three times
cat ~/.ssh/id_ed25519.pub # Copy output
```
Paste the public key into [GitHub → Settings → SSH and GPG keys → New SSH key](https://github.com/settings/keys).
Leave the rewrite setting as is (HTTPS clone will always work).
---
### Method 2: Use Directly on Claude.ai Web (No installation)
Enter the URL without installing anything. Requires Claude Pro/Max/Team/Enterprise plans (Free plan allows only one connector).
**Add connector:**
1. Log in to [claude.ai](https://claude.ai).
2. Click your name at the bottom left of the sidebar.
3. Select **"Settings"** (or Settings).
4. Go to the **"Connectors"** (or Connectors) menu.
5. In the **"Custom connectors"** section, click **"Add custom connector"**.
6. Enter the following:
- **Name**: `korean-law` (any name works)
- **URL**: Paste the address below, replacing `honggildong` with **your authentication key from Step 0**:
```
https://mcp.gomdori.app/law?oc=honggildong
```
7. Click **Add** to complete the registration.
**Activate the tool (important!):**
8. Click **"Configure"** (or Configure) for the added connector.
9. In the tool list, set all tools to **"Always allow"**.
10. This allows the AI to search legal regulations directly without needing approval each time.
**Usage:**
11. Return to the chat screen and type "What is Article 74 of the Labor Standards Act?" to use it.
> **Note**: To modify the connector URL, delete and re-add it.
> Since v3, profile selection is not needed. 10 tools cover all 42 APIs.
> If you previously used an address like `?profile=lite&oc=...`, you can keep using it — it works the same.
---
### Method 3: Use in AI Desktop Apps (No installation)
If you use desktop apps like Claude Desktop, Cursor, or Windsurf, add the following to your settings file.
**Find the settings file location:**
| App Name | Windows | Mac |
|---------|---------|-----|
| Claude Desktop | `%APPDATA%\Claude\claude_desktop_config.json` | `~/Library/Application Support/Claude/claude_desktop_config.json` |
| Cursor | `.cursor/mcp.json` in project folder | `.cursor/mcp.json` in project folder |
| Windsurf | `.windsurf/mcp.json` in project folder | `.windsurf/mcp.json` in project folder |
#### Claude Desktop
Claude Desktop cannot directly connect to the remote HTTP MCP server, so use the `mcp-remote` adapter.
Requires [Node.js](https://nodejs.org) 18 or higher (`npx` usage).
```json
{
"mcpServers": {
"korean-law": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mcp.gomdori.app/law?oc=honggildong"
]
}
}
}
```
> Replace `honggildong` with your authentication key. If you don't want to install Node.js, use [Method 4: Local Installation](#method-4-install-on-your-computer-offline-capable).
#### Cursor, Windsurf, etc. (Remote HTTP supported clients)
```json
{
"mcpServers": {
"korean-law": {
"url": "https://mcp.gomdori.app/law?oc=honggildong"
}
}
}
```
> If another MCP server is already set up, add only the `"korean-law": { ... }` part.
Restart the app after saving.
---
### Method 4: Install on Your Computer (Offline Capable)
If you want to use it without the internet or bypass the remote server, install it locally.
**Prerequisites:** Install [Node.js](https://nodejs.org) 18 or higher.
**Automatic Installation (recommended):**
```bash
npx korean-law-mcp setup
```
The setup wizard handles API key input, AI client selection, and automatic configuration file registration.
Supports Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, Gemini CLI, Zed, and Antigravity.
**Manual Installation:**
```bash
npm install -g korean-law-mcp
```
Add the following to your AI app settings file (replace `honggildong` with your authentication key):
```json
{
"mcpServers": {
"korean-law": {
"command": "korean-law-mcp",
"env": {
"LAW_OC": "honggildong"
}
}
}
}
```
Restart the app to complete.
---
### Method 5: Direct Usage in Terminal (CLI)
For developers, search legal regulations directly in the terminal.
```bash
# Installation
npm install -g korean-law-mcp
# Set authentication key (replace honggildong with your key)
export LAW_OC=honggildong # Mac/Linux
set LAW_OC=honggildong # Windows CMD
$env:LAW_OC="honggildong" # Windows PowerShell
# Usage examples
korean-law "Article 1 of the Civil Act" # Natural language query
korean-law search_law --query "Customs Act" # Direct tool invocation
korean-law list # List all tools
korean-law list --category precedents # Category filter
korean-law help search_law # Tool-specific help
```
---
### API Key Delivery Methods
You can deliver the authentication key in several ways. The methods are prioritized as listed:
| Method | Usage | When to use |
|------|--------|-----------|
| Include in URL | Add `?oc=your_key` at the end of the address | Easiest for web clients |
| HTTP Header | `apikey: your_key` | When integrating programmatically |
| Environment variable | `LAW_OC=your_key` | Local installation (Methods 3, 4) |
| Tool parameter | `apiKey: "your_key"` | When using a different key for a specific request |
### Ministry of Government Legislation API Protocol Settings
Ministry of Government Legislation API calls use HTTPS by default.
In environments with difficult certificate verification, such as intranet or closed networks,
set `LAW_API_PROTOCOL=http` to use HTTP.
Add it to the `env` block in the MCP client settings for clarity:
```json
{
"mcpServers": {
"korean-law": {
"command": "korean-law-mcp",
"env": {
"LAW_OC": "honggildong",
"LAW_API_PROTOCOL": "http"
}
}
}
}
```
You can also use the terminal or `.env` file:
```bash
export LAW_API_PROTOCOL=http # Mac/Linux
set LAW_API_PROTOCOL=http # Windows CMD
$env:LAW_API_PROTOCOL="http" # Windows PowerShell
```
```env
LAW_OC=honggildong
LAW_API_PROTOCOL=http
```
Allowed values are `http` and `https`. If not set or an invalid value is used, `https` is used.
### National Tax Service Case Server TLS/Proxy Settings
The National Tax Service case server is occasionally not provided with a JSON response from the Ministry of Government Legislation. Therefore, we internally query the National Tax Service case server at `taxlaw.nts.go.kr`. This server redirects HTTP requests to HTTPS, so the Node.js runtime must trust the certificate of `https://taxlaw.nts.go.kr`, regardless of the `LAW_API_PROTOCOL=http` setting.
Behind a company network, a closed network, a firewall, or an SSL inspection proxy, the National Tax Service case page may open in a browser, but Node.js `fetch()` may fail with `[EXTERNAL_API_ERROR] fetch failed`. This is because the certificate storage and proxy settings used by browsers and Node.js may differ.
First, check the HTTPS connection based on Node.js in the operational environment:
```bash
node -e "fetch('https://taxlaw.nts.go.kr/qt/USEQTA002P.do?ntstDcmId=200000000000019303').then(r=>console.log(r.status,r.url)).catch(e=>console.error(e.name,e.message,e.cause))"
```
If the direct connection is broken in the operational network and a separate web proxy is required, set the actual proxy server address. Currently, this setting applies to the external HTTPS connection of the National Tax Service case text fallback:
```env
LAW_EXTERNAL_HTTPS_PROXY=http://proxy-host:8080
```
If you need to register this as a system environment variable on Windows, set it in an administrator-privileged terminal:
```cmd
setx LAW_EXTERNAL_HTTPS_PROXY http://proxy-host:8080 /M
```
After applying, restart the Windows or Node.js process.
If there are still certificate verification issues with the proxy path, you can temporarily disable TLS certificate verification for only the external HTTPS proxy path of this project for diagnostic purposes. Do not use this as a permanent operational setting:
```cmd
setx LAW_EXTERNAL_TLS_REJECT_UNAUTHORIZED 0 /M
```
After diagnosis, remove it:
```cmd
reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v LAW_EXTERNAL_TLS_REJECT_UNAUTHORIZED /f
```
## Usage Examples
```
"Tell me about Article 38 of the Customs Act"
→ search_law("Customs Act") → Get MST → get_law_text(mst, jo="003800")
"Recent amendments to the Chemicals Management Act"
→ Automatically convert "Chemicals Management Act" → compare_old_new(mst)
"Interpretation of Article 74 of the Labor Standards Act"
→ search_interpretations("Labor Standards Act Article 74") → get_interpretation_text(id)
"Tell me about the content of the annex to the Occupational Safety and Health Act"
→ get_annexes(lawName="Occupational Safety and Health Act Annex") → HWPX file download → Table/text Markdown conversion
```
## Tool Structure (10)
In v4.4.0, we integrated the exposed tools (reducing context by 52%). The existing 8 `chain_*` tools were merged into `task` in `legal_research`, and the 4 killer features were integrated into `mode` in `legal_analysis`. The remaining specialized tools can be accessed via `discover_tools` → `execute_tool`, and direct calls to existing tool names are still compatible as sub-compatibility. In v4.7.0, `ordinance_radar` was added, making it 10 tools.
| Category | Tool | Description |
|------|------|------|
| **Research** (1) | `legal_research` | Multi-level legislation research — Select from 8 `task` types (see table below) |
| **In-depth Analysis** (1) | `legal_analysis` | Verification and analysis — Select from 4 `mode` types (see table below) |
| **Legislation** (3) | `search_law` | Legislation search → lawId, MST acquisition |
| | `get_law_text` | Full text inquiry of articles |
| | `get_annexes` | Annex and form inquiry (amount table, rate table, and form) |
| **Local Regulations** (1) | `ordinance_radar` | Ordinance radar - Automatic comparison of upper laws (v4.7.0) |
| **Integration** (2) | `search_decisions` | **18 domain** integrated search (case law, constitutional law, tax tribunal, fair trade commission, labor commission, customs, interpretation, administrative tribunal, personal information commission, rights and interests commission, small and medium enterprise tribunal, school regulations, public works, public institutions, treaties, and English legislation) |
| | `get_decision_text` | **18 domain** full-text inquiry |
| **Meta** (2) | `discover_tools` | Specialized tool search (terms, annex, history, comparison, etc.) |
| | `execute_tool` | Specialized tool proxy execution |
### `legal_research` task 8 types (formerly chain_*)
| task | Description | Scenario expansion |
|------|------|-------------|
| `full_research` (default) | Comprehensive research (AI search → legislation → case law → interpretation) | `customs`: customs and customs clearance / `action_plan`: 5-step guidance |
| `law_system` | Legal system analysis (3-stage comparison, delegation structure) | `delegation`: delegated legislation monitoring / `impact`: impact analysis |
| `action_basis` | Confirmation of disposition grounds (permit, authorization, disposition) | `penalty`: disposition and penalty standards comprehensive |
| `dispute_prep` | Dispute preparation (appeal, lawsuit, tribunal) | `domain`: tax/labor/privacy/competition |
| `amendment_track` | Amendment tracking (new and old comparison, history) | `timeline`: timeline / `time_travel`: two-point automatic diff |
| `ordinance_compare` | Ordinance comparison (upper law → nationwide ordinance) | `compliance`: upper law compliance verification |
| `procedure_detail` | Procedure, cost, and form guidance | `manual`: public servant processing manual |
| `document_review` | Contract and regulation risk analysis (`text` required) | — |
### `legal_analysis` mode 4 types (formerly killer features)
| mode | Description | Required parameters |
|------|------|-------------|
| `verify_citations` | LLM hallucination prevention — Citation article existence verification (v3.5) | `text` |
| `cite_check` | Case law verification — Follow-up citation tracking + change and abolition detection, Korean Citator (v4.3) | `caseNumber` |
| `applicable_law` | Act-time law judgment — Time-point application version + supplementary regulations (v4.3) | `lawName`, `date` |
| `impact_map` | Article impact graph — Citation case law, interpretation, and local regulations reverse search + mermaid (v4.0) | `lawName`, `jo` |
For detailed tool information, refer to [docs/API.md](docs/API.md).
## Key Features
- **42 APIs → 10 tools** — Legislation, case law, administrative regulations, local regulations, constitutional law, tax tribunal, customs interpretation, National Tax Service interpretation, treaties, school regulations, and public institutions
- **MCP + CLI** — Use the same tools on Claude Desktop and terminal
- **Specialized in legal domain** — Automatic recognition of abbreviations (`화관법` → `화학물질관리법`), article number conversion (`제38조` ↔ `003800`), and 3-stage delegation structure visualization
- **Annex and form text extraction** — HWPX, HWP, PDF, XLSX, and DOCX automatic conversion ([kordoc](https://github.com/chrisryugj/kordoc) engine)
- **8 chain + 9 scenario** — Basic chain with situation-based extended analysis automatic addition (overdue reduction, customs clearance, delegated legislation monitoring, etc.)
- **18 domain integrated search** — `search_decisions` provides instant access to case law, constitutional law, tax tribunal, fair trade commission, labor commission, etc.
- **Cache** — Search 1-hour, article 24-hour TTL
- **Remote endpoint** — Use directly at `https://mcp.gomdori.app/law` without installation (compatible with old `korean-law-mcp.fly.dev/mcp`)
## Documentation
- [docs/API.md](docs/API.md) — Tool reference
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) — System design
- [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) — Development guide
## Star History
<a href="https://www.star-history.com/?repos=chrisryugj%2Fkorean-law-mcp&type=timeline&legend=bottom-right">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=chrisryugj/korean-law-mcp&type=timeline&theme=dark&legend=top-left" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=chrisryugj/korean-law-mcp&type=timeline&legend=top-left" />
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=chrisryugj/korean-law-mcp&type=timeline&legend=top-left" />
</picture>
</a>
## License
[MIT](./LICENSE)
<sub>Made by 류주임 @ 광진구청 AI동호회 AI.Do</sub>
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
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Fetch
Retrieve and process content from web pages by converting HTML into markdown format.
Agent-Reach
Give your AI agent eyes to see the entire internet. Read & search Twitter,...
Context 7
Context7 MCP provides up-to-date code documentation for any prompt.
context7-mcp
Context7 MCP Server provides natural language access to documentation for...
mempalace
The highest-scoring AI memory system ever benchmarked. And it's free.