42 APIs compressed into 9 tools. Search, retrieve, and analyze Korean law — statutes, precedents, ordinances, treaties + LLM hallucination guard for legal citations (existence + content) + precedent citator (cite_check) + point-in-time law resolution (applicable_law).
MCP server + CLI for Korea's official legal database (법제처 Open API). Works with Claude Desktop, Cursor, Windsurf, Zed, and any MCP-compatible client.

verify_citations content check: Beyond confirming an article exists, it now catches content hallucinations like 민법 제750조(계약해제) — a real article (§750) tagged with the wrong title. It compares the cited article title against the actual one ([CONTENT_MISMATCH]) using LexDiff's citation-content-matcher (normalized common substring + character bigram Jaccard). Same for legal_analysis(mode=verify_citations).location.assign JS redirect instead of API data to cloud IPs (GCP/AWS/Fly), the client parses the obfuscated URL and follows the tokenized redirect (up to 3 hops, retrying the original URL on a 404). No-op on local/registered IPs — a defense layer for cloud deployments where Referer injection (v4.0.9) isn't enough.search_law runs a supplementary target=eflaw (enforcement-date) search and annotates results.
zod to ^4 — fixes a crash where a fresh install resolving zod 3.x threw z.toJSONSchema is not a function on the first listTools call.get_annexes for administrative-rule tables/forms — parse the admrulbyl key first, auto-detect "...시행세칙", and split table/form collisions that share a bylSeq (#50/#49/#51).required bug — .default() fields (legal_research.task, search_law.display) were exposed as required inputs (fixed via io:"input"); pass through legal_analysis cost options; warn on incompatible scenarios.Shrinks the ListTools payload every MCP client reads per session from ~15.1KB to ~7.2KB.
chain_* tools → one legal_research (task param: full_research·law_system·action_basis·dispute_prep·amendment_track·ordinance_compare·procedure_detail·document_review)verify_citations·cite_check·applicable_law·impact_map) → one legal_analysis (mode param)execute_tool routing both still work; only the advertised list changes.cite_check — "Is this precedent still good law?" (Korean Shepard's)Give it a case number (e.g. 2007다27670). It back-traces every later decision citing that case via full-text search, deep-scans en banc decisions for overruling language ("…변경하기로 한다"), and tracks alias references like "(이하 '2008년 전원합의체 판결'이라 한다)". Verdict: ✅ still cited / ⚠️ en banc successor exists / ❌ overruling detected — with the exact holding context.
applicable_law — "Which version of the law applies to my case date?"Give it a statute + a date. It pins the version in force on that date (MST), fetches the article as it read then, diffs against the current text, and extracts transitional provisions (적용례·경과조치) from every later amendment's addenda — plus lex temporis guidance (Criminal Act §1, General Act on Public Administration §14).
Catches fake article citations in AI-generated legal answers in real time. Cross-verifies every citation against Korea's official law database.
"Under Civil Act Article 750, damages may be claimed for tort;
Labor Standards Act Article 60 Paragraph 1 provides annual leave;
Commercial Act Article 401-2 Paragraph 7 imposes director liability;
Criminal Act Article 9999 imposes aggravated punishment."
→ Run verify_citations (actual verification result against 법제처 API):
Don't blindly trust ChatGPT/Claude legal answers. Essential reliability check for legal AI services, law firms, students, contract review.
Same 14 tools, 7 new analysis scenarios. Just ask in natural language — the AI detects what you need and runs extra analysis automatically.
| Ask this | Get this |
|---|---|
| "Food Sanitation Act penalty reduction possible?" | Penalty schedule + violation clauses + appeal cases where penalties were reduced |
| "Import customs FTA check" | Customs Act + customs interpretations + FTA treaties + tariff tables + tax tribunal rulings |
| "Building Act permit procedure" | Legal basis (Act→Decree→Rule) + fees/forms + admin rules + local ordinance exceptions |
| "National Health Insurance Act delegation" | Finds delegated provisions where implementing decrees haven't been created yet |
| "Building Act impact analysis" | Subordinate laws + nationwide ordinances affected + related admin rules |
| "Labor Standards Act amendment timeline" | Old/new comparison + article history + precedents/interpretations mapped chronologically |
| "Parking ordinance compliance check" | Constitutional Court decisions + admin appeal cancellations + parent law basis |
No changes to how you use it. Ask naturally, get deeper analysis automatically.
v3.3.0~v3.3.1 changes
v3.3.1 — Law alias dictionary expansion (11 → 52 entries, +41)
Triggered by a lexdiff hallucination case where "산안기준규칙" (산업안전보건기준에 관한 규칙) got keyword-matched to "국가표준기본법" by Korea Law Open API's aiSearch. Expanded LAW_ALIAS_ENTRIES in lib/search-normalizer.ts with high-frequency abbreviations across labor/safety (산안법, 중처법, 근기법), privacy/telecom (개보법, 정보통신망법), anti-corruption (청탁금지법, 이해충돌방지법), public contracting (국가계약법, 지방계약법), real estate (주임법, 상임법, 부거법), antitrust (공정거래법, 하도급법, 약관법, 표시광고법, 가맹사업법), finance (자본시장법, 특금법, 전금법), urban planning (국토계획법, 도정법), environment/health (감염병예방법, 대기환경법), transport (여객운수법, 화물운수법), procedure (민소법, 형소법, 민집법), social insurance (국건법, 산재보험법, 고보법), and telecom (전기통신사업법). Since api-client.ts and law-parser.ts already consume resolveLawAlias(), the existing search pipeline gets the benefit automatically. 45/45 tests passing (41 new + 4 regression).
v3.3.0 — HTTP stateless mode + kordoc 2.3.0
Root-cause fix for the remote server (korean-law-mcp.fly.dev) periodically losing sessions due to OOM-driven restarts. Switched to MCP's official stateless pattern (sessionIdGenerator: undefined): fresh Server + Transport per request, released on response close. Removed in-memory session Map, InMemoryEventStore, and idle cleanup — eliminating leak sources entirely. Survives restarts, scale-out, and rolling deploys with zero client disruption. GET /mcp and DELETE /mcp return 405 (matching the SDK example). API keys are isolated per-request via AsyncLocalStorage.
@modelcontextprotocol/sdk/examples/server/simpleStatelessStreamableHttp.js)sessions Map, MAX_SESSIONS, 10-min idle setInterval, InMemoryEventStore, POST/GET/DELETE branching (~50 LOC net reduction)v3.2.2 — get_annexes direct exposure. Auto-fetch annexes on refund/fee keywords.
v3.2.1 — kordoc 2.2.5 update.
v3.1.0~v3.1.5 changes
v3.1.5 — kordoc 2.2.4 + README modernization.
v3.1.4 — kordoc 2.2.4 update. HTML <table> for merged cells, markdownToHwpx improvements.
v3.1.3 — Empty search result hints for 18 tools. Session cleanup interval reduced.
v3.1.2 — kordoc 2.2.1 update. GFM table escaping.
v3.1.1 — kordoc 2.1→2.2 update.
v3.1.0 — Production hardening: 20 file fixes.
v3.1.3 — Empty search result hints for 18 tools. Session cleanup interval reduced (30min→10min).
v3.1.2 — kordoc 2.2.1 update. GFM table special character escaping and pipe collision prevention.
v3.1.1 — kordoc 2.1→2.2 update.
v3.1.0 — Production hardening: 20 file fixes. truncateResponse 50KB limit applied to 17 tools, HTTP session limit (MAX_SESSIONS=100), CORS wildcard warning, parameter pollution defense, chain tool auth error propagation, SSE server dead code removal.
v3.0.x changes
v2 structured 41 legal APIs into 89 MCP tools. v3 re-compresses them into 14 tools.
| Raw APIs | v2 | v3 | |
|---|---|---|---|
| Tool count | 41 | 89 | 14 |
| AI context cost | - | ~110 KB | ~20 KB |
| Coverage | - | 100% | 100% |
| Profile management | - | lite/full split | Single (none needed) |
What changed: 34 individual search/get tools for precedents, constitutional court, tax tribunal, FTC, etc. are now unified into 2 tools: search_decisions(domain) + get_decision_text(domain), covering 17 domains with a single domain parameter.
v2.2.0
v1.8.0 – v1.9.0 features
chain_full_research (AI search → statutes → precedents → interpretations), chain_law_system, chain_action_basis, chain_dispute_prep, chain_amendment_track, chain_ordinance_compare, chain_procedure_detail.get_batch_articles accepts a laws array for multi-law queries in one call.search_ai_law now supports lawTypes filter.[ErrorCode] + tool name + suggestion across all 64 tools.paragraph.controls[].content path.South Korea has 1,600+ active laws, 10,000+ administrative rules, and a precedent system spanning Supreme Court, Constitutional Court, tax tribunals, and customs rulings. All of this lives behind a clunky government API with zero developer experience.
This project wraps that entire legal system into 14 structured tools that any AI assistant or script can call. Built by a Korean civil servant who got tired of manually searching 법제처 for the hundredth time.
Auto setup (recommended):
npx korean-law-mcp setup
Interactive wizard handles API key input, client selection, and config file registration. Supports Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, and Gemini CLI.
Manual setup:
npm install -g korean-law-mcp
Add to your MCP client config:
{
"mcpServers": {
"korean-law": {
"command": "korean-law-mcp",
"env": {
"LAW_OC": "your-api-key"
}
}
}
}
Get your free API key at 법제처 Open API.
| Client | Config File |
|---|---|
| Claude Desktop | %APPDATA%\Claude\claude_desktop_config.json (Win) / ~/Library/Application Support/Claude/claude_desktop_config.json (Mac) |
| Cursor | .cursor/mcp.json |
| Windsurf | .windsurf/mcp.json |
| Continue | ~/.continue/config.json |
| Zed | ~/.config/zed/settings.json |
Claude Desktop does not support remote HTTP MCP servers directly. Use the mcp-remote adapter (requires [Node.js](h
$ claude mcp add korean-law-mcp \
-- python -m otcore.mcp_server <graph>