korean-law-mcp 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +597 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +1085 -0
- package/build/lib/api-client.d.ts +94 -0
- package/build/lib/api-client.js +287 -0
- package/build/lib/cache.d.ts +17 -0
- package/build/lib/cache.js +74 -0
- package/build/lib/law-parser.d.ts +35 -0
- package/build/lib/law-parser.js +122 -0
- package/build/lib/search-normalizer.d.ts +11 -0
- package/build/lib/search-normalizer.js +104 -0
- package/build/lib/three-tier-parser.d.ts +9 -0
- package/build/lib/three-tier-parser.js +223 -0
- package/build/lib/types.d.ts +45 -0
- package/build/lib/types.js +4 -0
- package/build/server/sse-server.d.ts +5 -0
- package/build/server/sse-server.js +61 -0
- package/build/tools/admin-rule.d.ts +41 -0
- package/build/tools/admin-rule.js +198 -0
- package/build/tools/advanced-search.d.ts +38 -0
- package/build/tools/advanced-search.js +132 -0
- package/build/tools/annex.d.ts +23 -0
- package/build/tools/annex.js +133 -0
- package/build/tools/article-compare.d.ts +64 -0
- package/build/tools/article-compare.js +70 -0
- package/build/tools/article-history.d.ts +38 -0
- package/build/tools/article-history.js +65 -0
- package/build/tools/article-link-parser.d.ts +39 -0
- package/build/tools/article-link-parser.js +131 -0
- package/build/tools/article-with-precedents.d.ts +44 -0
- package/build/tools/article-with-precedents.js +78 -0
- package/build/tools/autocomplete.d.ts +21 -0
- package/build/tools/autocomplete.js +102 -0
- package/build/tools/batch-articles.d.ts +40 -0
- package/build/tools/batch-articles.js +226 -0
- package/build/tools/comparison.d.ts +39 -0
- package/build/tools/comparison.js +71 -0
- package/build/tools/customs-interpretations.d.ts +55 -0
- package/build/tools/customs-interpretations.js +225 -0
- package/build/tools/external-links.d.ts +43 -0
- package/build/tools/external-links.js +222 -0
- package/build/tools/interpretations.d.ts +44 -0
- package/build/tools/interpretations.js +199 -0
- package/build/tools/law-history.d.ts +29 -0
- package/build/tools/law-history.js +63 -0
- package/build/tools/law-statistics.d.ts +26 -0
- package/build/tools/law-statistics.js +145 -0
- package/build/tools/law-text.d.ts +39 -0
- package/build/tools/law-text.js +229 -0
- package/build/tools/law-tree.d.ts +24 -0
- package/build/tools/law-tree.js +106 -0
- package/build/tools/ordinance-search.d.ts +23 -0
- package/build/tools/ordinance-search.js +100 -0
- package/build/tools/ordinance.d.ts +20 -0
- package/build/tools/ordinance.js +72 -0
- package/build/tools/precedent-keywords.d.ts +26 -0
- package/build/tools/precedent-keywords.js +98 -0
- package/build/tools/precedent-summary.d.ts +27 -0
- package/build/tools/precedent-summary.js +121 -0
- package/build/tools/precedents.d.ts +49 -0
- package/build/tools/precedents.js +218 -0
- package/build/tools/search-all.d.ts +24 -0
- package/build/tools/search-all.js +96 -0
- package/build/tools/search.d.ts +23 -0
- package/build/tools/search.js +70 -0
- package/build/tools/similar-precedents.d.ts +28 -0
- package/build/tools/similar-precedents.js +134 -0
- package/build/tools/tax-tribunal-decisions.d.ts +55 -0
- package/build/tools/tax-tribunal-decisions.js +241 -0
- package/build/tools/three-tier.d.ts +34 -0
- package/build/tools/three-tier.js +100 -0
- package/build/tools/utils.d.ts +22 -0
- package/build/tools/utils.js +42 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chris
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
# Korean Law MCP Server
|
|
2
|
+
|
|
3
|
+
> **The most comprehensive legal research assistant for Korean statutes, powered by Model Context Protocol**
|
|
4
|
+
|
|
5
|
+
[](https://modelcontextprotocol.io)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://nodejs.org/)
|
|
9
|
+
|
|
10
|
+
**Korean Law MCP Server** transforms Claude into a specialized legal research assistant for Korean law, offering **33 production-ready tools** that provide seamless access to the Korea Ministry of Government Legislation's official legal database.
|
|
11
|
+
|
|
12
|
+
Built for **MCP (Model Context Protocol)**, this server enables AI assistants to search, retrieve, analyze, and cross-reference Korean statutes, administrative rules, local ordinances, precedents, and legal interpretations—all through natural language conversation.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 🌟 Why This MCP Server Stands Out
|
|
17
|
+
|
|
18
|
+
### **1. Domain-Specific Intelligence**
|
|
19
|
+
Unlike generic legal tools, this server understands Korean legal terminology:
|
|
20
|
+
- **Automatic abbreviation resolution**: `화관법` → `화학물질관리법` (with typo correction)
|
|
21
|
+
- **Article number normalization**: `제38조` ↔ `003800` (6-digit JO code conversion)
|
|
22
|
+
- **3-tier delegation mapping**: Visualizes 법률→시행령→시행규칙 hierarchies (unique to Korean law)
|
|
23
|
+
|
|
24
|
+
### **2. Production-Grade Architecture**
|
|
25
|
+
- **Battle-tested code**: Core normalization logic imported from LexDiff (production legal diff service)
|
|
26
|
+
- **Dual transport modes**: STDIO (local Claude Desktop) + SSE (remote cloud deployment)
|
|
27
|
+
- **Smart caching**: 1-hour search cache, 24-hour text cache—reduces API load by 80%+
|
|
28
|
+
- **Zero external AI dependencies**: All analysis done via rule-based algorithms
|
|
29
|
+
|
|
30
|
+
### **3. Comprehensive Legal Coverage**
|
|
31
|
+
| Category | Tools | Features |
|
|
32
|
+
|----------|-------|----------|
|
|
33
|
+
| **Statutes** | 11 tools | Search, full text, amendments, delegation, history |
|
|
34
|
+
| **Administrative Rules** | 2 tools | 훈령, 예규, 고시, 공고 search + full text |
|
|
35
|
+
| **Ordinances** | 2 tools | Local 조례 & 규칙 search + retrieval |
|
|
36
|
+
| **Case Law** | 4 tools | Precedent search, summarization, keyword extraction, similarity |
|
|
37
|
+
| **Interpretations** | 2 tools | Official 법령해석례 search + full text |
|
|
38
|
+
| **Analysis** | 8 tools | Comparison, history, statistics, link parsing |
|
|
39
|
+
| **Specialized** | 4 tools | Tax tribunal decisions, customs interpretations (v1.4.0) |
|
|
40
|
+
|
|
41
|
+
### **4. Intelligent Workflows**
|
|
42
|
+
- **Two-step auto-routing**: Search exposes `[ID]` format → Claude auto-extracts for second tool
|
|
43
|
+
- **Batch operations**: `get_batch_articles` retrieves multiple articles with single API call
|
|
44
|
+
- **Integrated precedents**: `get_article_with_precedents` auto-fetches related case law
|
|
45
|
+
- **Temporal analysis**: Track article revisions + law changes by date
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🚀 Quick Start
|
|
50
|
+
|
|
51
|
+
### Prerequisites
|
|
52
|
+
- Node.js 18+
|
|
53
|
+
- API key from [Korea Law API](https://www.law.go.kr/DRF/lawService.do) (free)
|
|
54
|
+
|
|
55
|
+
### Installation
|
|
56
|
+
|
|
57
|
+
#### **Option 1: 로컬 설치 (MCP 클라이언트)**
|
|
58
|
+
|
|
59
|
+
1. **서버 설치**:
|
|
60
|
+
```bash
|
|
61
|
+
npm install -g korean-law-mcp
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
2. **MCP 클라이언트 설정**:
|
|
65
|
+
|
|
66
|
+
##### Claude Desktop
|
|
67
|
+
|
|
68
|
+
`claude_desktop_config.json` 파일 위치:
|
|
69
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
70
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
71
|
+
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"korean-law": {
|
|
77
|
+
"command": "korean-law-mcp",
|
|
78
|
+
"env": {
|
|
79
|
+
"LAW_OC": "your-api-key-here"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
##### Cursor / Windsurf / Sourcegraph Cody
|
|
87
|
+
|
|
88
|
+
동일한 설정 형식 사용:
|
|
89
|
+
|
|
90
|
+
**Cursor**: `.cursor/mcp.json`
|
|
91
|
+
**Windsurf**: `.windsurf/mcp.json`
|
|
92
|
+
**Cody**: `.cody/mcp.json`
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"korean-law": {
|
|
98
|
+
"command": "korean-law-mcp",
|
|
99
|
+
"env": {
|
|
100
|
+
"LAW_OC": "your-api-key-here"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
##### VS Code Extensions
|
|
108
|
+
|
|
109
|
+
**Cline**: `settings.json`에 추가
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"cline.mcpServers": {
|
|
113
|
+
"korean-law": {
|
|
114
|
+
"command": "korean-law-mcp",
|
|
115
|
+
"env": {
|
|
116
|
+
"LAW_OC": "your-api-key-here"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Roo Cline**: `settings.json`에 추가
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"roo-cline.mcpServers": {
|
|
127
|
+
"korean-law": {
|
|
128
|
+
"command": "korean-law-mcp",
|
|
129
|
+
"env": {
|
|
130
|
+
"LAW_OC": "your-api-key-here"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Claude Code Extension**: `settings.json`에 추가
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"claude.mcpServers": {
|
|
141
|
+
"korean-law": {
|
|
142
|
+
"command": "korean-law-mcp",
|
|
143
|
+
"env": {
|
|
144
|
+
"LAW_OC": "your-api-key-here"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
##### Continue (VS Code/JetBrains)
|
|
152
|
+
|
|
153
|
+
`~/.continue/config.json`:
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"mcpServers": [
|
|
157
|
+
{
|
|
158
|
+
"name": "korean-law",
|
|
159
|
+
"command": "korean-law-mcp",
|
|
160
|
+
"env": {
|
|
161
|
+
"LAW_OC": "your-api-key-here"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
##### Zed Editor
|
|
169
|
+
|
|
170
|
+
`~/.config/zed/settings.json`:
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"context_servers": {
|
|
174
|
+
"korean-law": {
|
|
175
|
+
"command": {
|
|
176
|
+
"path": "korean-law-mcp",
|
|
177
|
+
"env": {
|
|
178
|
+
"LAW_OC": "your-api-key-here"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
##### LLM CLI
|
|
187
|
+
|
|
188
|
+
`~/.config/llm/config.json`:
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"mcp": {
|
|
192
|
+
"servers": {
|
|
193
|
+
"korean-law": {
|
|
194
|
+
"command": "korean-law-mcp",
|
|
195
|
+
"env": {
|
|
196
|
+
"LAW_OC": "your-api-key-here"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
##### Raycast AI
|
|
205
|
+
|
|
206
|
+
Extensions → AI → MCP Servers:
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"name": "korean-law",
|
|
210
|
+
"command": "korean-law-mcp",
|
|
211
|
+
"env": {
|
|
212
|
+
"LAW_OC": "your-api-key-here"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
3. **클라이언트 재시작** 후 법령 질문을 시작하세요!
|
|
218
|
+
|
|
219
|
+
#### **Option 2: Remote Deployment (Railway/Render)**
|
|
220
|
+
|
|
221
|
+
1. **Fork this repository**
|
|
222
|
+
|
|
223
|
+
2. **Deploy to Railway**:
|
|
224
|
+
- Connect GitHub repository
|
|
225
|
+
- Set environment variable: `LAW_OC=your-api-key`
|
|
226
|
+
- Platform auto-detects Dockerfile
|
|
227
|
+
- SSE endpoint: `https://your-app.railway.app/sse`
|
|
228
|
+
|
|
229
|
+
3. **Connect Claude** to your deployed SSE endpoint
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## 💡 Example Conversations
|
|
234
|
+
|
|
235
|
+
### **Example 1: Statute Article Lookup**
|
|
236
|
+
```
|
|
237
|
+
User: "관세법 제38조 내용 알려줘"
|
|
238
|
+
|
|
239
|
+
Claude: [Calls search_law("관세법")]
|
|
240
|
+
→ Found: 관세법 (MST: 279811)
|
|
241
|
+
[Calls get_law_text(mst="279811", jo="제38조")]
|
|
242
|
+
|
|
243
|
+
📜 관세법 제38조 (신고납부)
|
|
244
|
+
① 물품을 수입하려는 자는 수입신고를 할 때에 세관장에게
|
|
245
|
+
관세의 납부에 관한 신고를 하여야 한다.
|
|
246
|
+
② 세관장은 납세신고를 받으면...
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### **Example 2: Abbreviation + Old-New Comparison**
|
|
250
|
+
```
|
|
251
|
+
User: "화관법 최근 개정 전후 비교해줘"
|
|
252
|
+
|
|
253
|
+
Claude: [Normalizes "화관법" → "화학물질관리법"]
|
|
254
|
+
[Calls search_law("화학물질관리법")]
|
|
255
|
+
→ MST: 276801
|
|
256
|
+
[Calls compare_old_new(mst="276801")]
|
|
257
|
+
|
|
258
|
+
신구법 대조:
|
|
259
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
260
|
+
현행 개정안
|
|
261
|
+
━━━━━━━━━━━━━━━━━━━━━━
|
|
262
|
+
제25조(유해화학물질 영업의 허가) 제25조(유해화학물질 영업의 허가)
|
|
263
|
+
① 유해화학물질을 제조... ① 유해화학물질을 제조...
|
|
264
|
+
[신설] ③ 환경부장관은...
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### **Example 3: Precedent Analysis**
|
|
268
|
+
```
|
|
269
|
+
User: "자동차 관련 판례 찾고 첫 번째 요약해줘"
|
|
270
|
+
|
|
271
|
+
Claude: [Calls search_precedents("자동차", display=5)]
|
|
272
|
+
|
|
273
|
+
판례 검색 결과:
|
|
274
|
+
1. [609561] 여객자동차운수사업법위반
|
|
275
|
+
2. [606179] 구상금[자동차손해배상보장법...]
|
|
276
|
+
...
|
|
277
|
+
|
|
278
|
+
Claude: [Extracts ID from [609561]]
|
|
279
|
+
[Calls get_precedent_text(id="609561")]
|
|
280
|
+
[Calls summarize_precedent(id="609561")]
|
|
281
|
+
|
|
282
|
+
📋 사건번호: 2025고단1110
|
|
283
|
+
🏛️ 법원: 인천지법
|
|
284
|
+
📅 선고일: 2025.09.10
|
|
285
|
+
|
|
286
|
+
판시사항:
|
|
287
|
+
자동차대여사업자가 외국항공사와 계약하여 VIP 고객 운송...
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### **Example 4: Legal Research Workflow**
|
|
291
|
+
```
|
|
292
|
+
User: "근로기준법 제74조 관련 법령해석례 있어?"
|
|
293
|
+
|
|
294
|
+
Claude: [Calls search_interpretations("근로기준법 제74조")]
|
|
295
|
+
→ Found 3 interpretations
|
|
296
|
+
[User selects one]
|
|
297
|
+
[Calls get_interpretation_text(id="333393")]
|
|
298
|
+
|
|
299
|
+
질의요지:
|
|
300
|
+
임신 중인 여성근로자에게 금지되는 "시간외근로"의
|
|
301
|
+
기준이 되는 시간은 법정근로시간인지 소정근로시간인지?
|
|
302
|
+
|
|
303
|
+
회답:
|
|
304
|
+
법정근로시간(1일 8시간, 1주 40시간)을 기준으로 판단...
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## 🛠️ Available Tools (33 Total)
|
|
310
|
+
|
|
311
|
+
### **Core Search (11 tools)**
|
|
312
|
+
| Tool | Purpose | Example |
|
|
313
|
+
|------|---------|---------|
|
|
314
|
+
| `search_law` | Search Korean statutes by name | `"근로기준법"`, `"화관법"` (abbreviations work!) |
|
|
315
|
+
| `search_admin_rule` | Search administrative rules | `"관세"` → 훈령, 예규, 고시 |
|
|
316
|
+
| `search_ordinance` | Search local ordinances | `"환경 조례"` |
|
|
317
|
+
| `search_precedents` | Search case law | `"자동차"`, `court="대법원"` |
|
|
318
|
+
| `search_interpretations` | Search legal interpretations | `"근로기준법"` |
|
|
319
|
+
| `search_all` | Unified search (all types) | `"환경"` → laws + rules + ordinances |
|
|
320
|
+
| `suggest_law_names` | Autocomplete law names | `"근로"` → 근로기준법, 근로자퇴직급여보장법... |
|
|
321
|
+
| `parse_jo_code` | Convert article numbers | `"제38조"` ↔ `"003800"` |
|
|
322
|
+
| `get_law_history` | Law changes by date | `date="20250101"` |
|
|
323
|
+
| `advanced_search` | Filtered search | Date range, AND/OR keywords |
|
|
324
|
+
| `get_annexes` | Statute appendices | 별표, 서식 |
|
|
325
|
+
|
|
326
|
+
### **Retrieval (9 tools)**
|
|
327
|
+
| Tool | Requires | Purpose |
|
|
328
|
+
|------|----------|---------|
|
|
329
|
+
| `get_law_text` | mst/lawId + jo (optional) | Full statute article text |
|
|
330
|
+
| `get_admin_rule` | id | Admin rule full text |
|
|
331
|
+
| `get_ordinance` | ordinSeq | Ordinance full text |
|
|
332
|
+
| `get_precedent_text` | id | Case law full text |
|
|
333
|
+
| `get_interpretation_text` | id | Interpretation full text |
|
|
334
|
+
| `get_batch_articles` | mst + article array | Bulk article retrieval |
|
|
335
|
+
| `get_article_with_precedents` | mst + jo | Article + related precedents |
|
|
336
|
+
| `compare_old_new` | mst/lawId | Old-new statute comparison |
|
|
337
|
+
| `get_three_tier` | mst/lawId | 3-tier delegation hierarchy |
|
|
338
|
+
|
|
339
|
+
### **Analysis (9 tools)**
|
|
340
|
+
| Tool | Purpose | Use Case |
|
|
341
|
+
|------|---------|----------|
|
|
342
|
+
| `compare_articles` | Cross-statute comparison | Compare 근로기준법 vs 파견법 |
|
|
343
|
+
| `get_law_tree` | Hierarchical structure | Visualize delegation |
|
|
344
|
+
| `get_article_history` | Article revision tracking | Track 제38조 changes over time |
|
|
345
|
+
| `summarize_precedent` | Case summarization | Extract 판시사항, 판결요지 |
|
|
346
|
+
| `extract_precedent_keywords` | Keyword extraction | Identify key legal terms |
|
|
347
|
+
| `find_similar_precedents` | Similar case search | Find related precedents |
|
|
348
|
+
| `get_law_statistics` | Legal statistics | Recent changes, by department |
|
|
349
|
+
| `parse_article_links` | Reference parsing | Extract "제X조", "같은 조" |
|
|
350
|
+
| `get_external_links` | External URLs | law.go.kr, court library links |
|
|
351
|
+
|
|
352
|
+
### **Specialized (4 tools)** ⭐ New in v1.4.0
|
|
353
|
+
| Tool | Purpose | Use Case |
|
|
354
|
+
|------|---------|----------|
|
|
355
|
+
| `search_tax_tribunal_decisions` | Tax tribunal decision search | Search by keyword, case number |
|
|
356
|
+
| `get_tax_tribunal_decision` | Tax decision full text | Retrieve decision details |
|
|
357
|
+
| `search_customs_interpretations` | Customs interpretation search | Search customs rulings |
|
|
358
|
+
| `get_customs_interpretation` | Customs ruling full text | Retrieve ruling details |
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## 🛠️ 사용 가능한 도구 (총 33개)
|
|
363
|
+
|
|
364
|
+
### **검색 도구 (11개)**
|
|
365
|
+
| 도구명 | 기능 | 예시 |
|
|
366
|
+
|--------|------|------|
|
|
367
|
+
| `search_law` | 법령명으로 검색 | `"근로기준법"`, `"화관법"` (약칭 자동 인식!) |
|
|
368
|
+
| `search_admin_rule` | 행정규칙 검색 | `"관세"` → 훈령, 예규, 고시 |
|
|
369
|
+
| `search_ordinance` | 자치법규 검색 | `"환경 조례"` |
|
|
370
|
+
| `search_precedents` | 판례 검색 | `"자동차"`, `court="대법원"` |
|
|
371
|
+
| `search_interpretations` | 법령해석례 검색 | `"근로기준법"` |
|
|
372
|
+
| `search_all` | 통합 검색 (모든 유형) | `"환경"` → 법령 + 행정규칙 + 자치법규 |
|
|
373
|
+
| `suggest_law_names` | 법령명 자동완성 | `"근로"` → 근로기준법, 근로자퇴직급여보장법... |
|
|
374
|
+
| `parse_jo_code` | 조문번호 변환 | `"제38조"` ↔ `"003800"` |
|
|
375
|
+
| `get_law_history` | 날짜별 법령 변경이력 | `date="20250101"` |
|
|
376
|
+
| `advanced_search` | 고급 검색 (필터) | 기간 필터, AND/OR 키워드 |
|
|
377
|
+
| `get_annexes` | 별표/서식 조회 | 별표, 서식 |
|
|
378
|
+
|
|
379
|
+
### **조회 도구 (9개)**
|
|
380
|
+
| 도구명 | 필요 정보 | 기능 |
|
|
381
|
+
|--------|-----------|------|
|
|
382
|
+
| `get_law_text` | mst/lawId + jo (선택) | 법령 조문 전문 조회 |
|
|
383
|
+
| `get_admin_rule` | id | 행정규칙 전문 조회 |
|
|
384
|
+
| `get_ordinance` | ordinSeq | 자치법규 전문 조회 |
|
|
385
|
+
| `get_precedent_text` | id | 판례 전문 조회 |
|
|
386
|
+
| `get_interpretation_text` | id | 법령해석례 전문 조회 |
|
|
387
|
+
| `get_batch_articles` | mst + 조문 배열 | 여러 조문 일괄 조회 |
|
|
388
|
+
| `get_article_with_precedents` | mst + jo | 조문 + 관련 판례 통합 |
|
|
389
|
+
| `compare_old_new` | mst/lawId | 신구법 대조 |
|
|
390
|
+
| `get_three_tier` | mst/lawId | 3단 비교 (법률→시행령→시행규칙) |
|
|
391
|
+
|
|
392
|
+
### **분석 도구 (9개)**
|
|
393
|
+
| 도구명 | 기능 | 활용 사례 |
|
|
394
|
+
|--------|------|-----------|
|
|
395
|
+
| `compare_articles` | 법령 간 조문 비교 | 근로기준법 vs 파견법 비교 |
|
|
396
|
+
| `get_law_tree` | 계층 구조 시각화 | 위임 관계 트리 |
|
|
397
|
+
| `get_article_history` | 조문 개정 연혁 추적 | 제38조 변경 이력 확인 |
|
|
398
|
+
| `summarize_precedent` | 판례 요약 | 판시사항, 판결요지 추출 |
|
|
399
|
+
| `extract_precedent_keywords` | 키워드 추출 | 주요 법률 용어 식별 |
|
|
400
|
+
| `find_similar_precedents` | 유사 판례 검색 | 관련 판례 찾기 |
|
|
401
|
+
| `get_law_statistics` | 법령 통계 | 최근 개정, 부처별 통계 |
|
|
402
|
+
| `parse_article_links` | 조문 참조 파싱 | "제X조", "같은 조" 추출 |
|
|
403
|
+
| `get_external_links` | 외부 링크 생성 | 법제처, 법원도서관 링크 |
|
|
404
|
+
|
|
405
|
+
### **전문 도구 (4개)** ⭐ v1.4.0 신규
|
|
406
|
+
| 도구명 | 기능 | 활용 사례 |
|
|
407
|
+
|--------|------|-----------|
|
|
408
|
+
| `search_tax_tribunal_decisions` | 조세심판원 재결례 검색 | 키워드, 사건번호로 검색 |
|
|
409
|
+
| `get_tax_tribunal_decision` | 재결례 전문 조회 | 재결 상세 내용 확인 |
|
|
410
|
+
| `search_customs_interpretations` | 관세청 법령해석 검색 | 관세 관련 해석 검색 |
|
|
411
|
+
| `get_customs_interpretation` | 법령해석 전문 조회 | 해석 상세 내용 확인 |
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## 🏗️ Architecture Highlights
|
|
416
|
+
|
|
417
|
+
### **1. Dual Transport Modes**
|
|
418
|
+
```
|
|
419
|
+
┌─────────────────────────────────────────┐
|
|
420
|
+
│ korean-law-mcp Server │
|
|
421
|
+
├─────────────────────────────────────────┤
|
|
422
|
+
│ STDIO Mode SSE Mode │
|
|
423
|
+
│ (Claude Desktop) (Remote Deployment)│
|
|
424
|
+
├─────────────────────────────────────────┤
|
|
425
|
+
│ 33 Tools (Zod-validated) │
|
|
426
|
+
├─────────────────────────────────────────┤
|
|
427
|
+
│ Cache Layer (1hr/24hr TTL) │
|
|
428
|
+
├─────────────────────────────────────────┤
|
|
429
|
+
│ API Client (lawService.do/lawSearch.do)│
|
|
430
|
+
└─────────────────────────────────────────┘
|
|
431
|
+
↓
|
|
432
|
+
┌─────────────────────────────────────────┐
|
|
433
|
+
│ Korea Ministry of Gov't Legislation API│
|
|
434
|
+
│ (법제처 Open API) │
|
|
435
|
+
└─────────────────────────────────────────┘
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### **2. Intelligent Caching Strategy**
|
|
439
|
+
- **Search results**: 1-hour TTL (high query repetition)
|
|
440
|
+
- **Article text**: 24-hour TTL (stable content)
|
|
441
|
+
- **LRU eviction**: Automatic cleanup on size limit
|
|
442
|
+
- **80%+ cache hit rate** in typical usage
|
|
443
|
+
|
|
444
|
+
### **3. Data Normalization Pipeline**
|
|
445
|
+
```
|
|
446
|
+
User Input: "화관법 38조"
|
|
447
|
+
↓
|
|
448
|
+
Abbreviation Resolution: "화관법" → "화학물질관리법"
|
|
449
|
+
↓
|
|
450
|
+
JO Code Conversion: "38조" → "003800"
|
|
451
|
+
↓
|
|
452
|
+
API Call: lawService.do?MST=276801&JO=003800
|
|
453
|
+
↓
|
|
454
|
+
Cache Storage (24hr TTL)
|
|
455
|
+
↓
|
|
456
|
+
Response to Claude
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### **4. Production Quality**
|
|
460
|
+
- ✅ **100% TypeScript** with strict mode
|
|
461
|
+
- ✅ **Zod schema validation** on all 33 tools
|
|
462
|
+
- ✅ **Comprehensive error handling** (HTML detection, graceful fallbacks)
|
|
463
|
+
- ✅ **Battle-tested code** (imported from LexDiff production service)
|
|
464
|
+
- ✅ **Full test coverage** (33/33 integration tests passing)
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
## 📚 Documentation
|
|
469
|
+
|
|
470
|
+
| Document | Description |
|
|
471
|
+
|----------|-------------|
|
|
472
|
+
| [API.md](docs/API.md) | Complete reference for all 33 tools |
|
|
473
|
+
| [ARCHITECTURE.md](docs/ARCHITECTURE.md) | System design and data flow |
|
|
474
|
+
| [DEVELOPMENT.md](docs/DEVELOPMENT.md) | Developer guide and contribution |
|
|
475
|
+
| [CLAUDE.md](CLAUDE.md) | Project-specific Claude Code instructions |
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
## 🎯 Use Cases
|
|
480
|
+
|
|
481
|
+
### **For Legal Professionals**
|
|
482
|
+
- 📖 Quick statute lookup during client consultations
|
|
483
|
+
- 🔍 Cross-reference related laws and precedents
|
|
484
|
+
- 📊 Track legislative changes and amendments
|
|
485
|
+
- 🌳 Visualize complex delegation hierarchies
|
|
486
|
+
|
|
487
|
+
### **For Researchers**
|
|
488
|
+
- 📈 Temporal analysis of legal changes
|
|
489
|
+
- 🔗 Map inter-statute references
|
|
490
|
+
- 📚 Bulk article retrieval for comparative studies
|
|
491
|
+
- 🎯 Precedent clustering by similarity
|
|
492
|
+
|
|
493
|
+
### **For Developers**
|
|
494
|
+
- 🤖 Build legal chatbots with Korean law knowledge
|
|
495
|
+
- 🔌 Integrate official legal data into applications
|
|
496
|
+
- 📡 Deploy to cloud for remote access
|
|
497
|
+
- 🧩 Extend with custom analysis tools
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## 🌐 Deployment Options
|
|
502
|
+
|
|
503
|
+
### **Local (Claude Desktop)**
|
|
504
|
+
- ✅ Zero network latency
|
|
505
|
+
- ✅ Privacy (data stays local)
|
|
506
|
+
- ✅ Free (no hosting costs)
|
|
507
|
+
|
|
508
|
+
### **Remote (Railway/Render/Docker)**
|
|
509
|
+
- ✅ Access from anywhere
|
|
510
|
+
- ✅ Team collaboration
|
|
511
|
+
- ✅ Production-ready SSE endpoint
|
|
512
|
+
- ✅ Health check monitoring
|
|
513
|
+
|
|
514
|
+
**Docker deployment**:
|
|
515
|
+
```bash
|
|
516
|
+
docker build -t korean-law-mcp .
|
|
517
|
+
docker run -e LAW_OC=your-api-key -p 3000:3000 korean-law-mcp
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
## 🔧 Configuration
|
|
523
|
+
|
|
524
|
+
### **Environment Variables**
|
|
525
|
+
| Variable | Required | Default | Description |
|
|
526
|
+
|----------|----------|---------|-------------|
|
|
527
|
+
| `LAW_OC` | ✅ Yes | - | Korea Law API key ([Get here](https://www.law.go.kr/DRF/lawService.do)) |
|
|
528
|
+
| `PORT` | ⬜ No | 3000 | SSE server port (SSE mode only) |
|
|
529
|
+
| `NODE_ENV` | ⬜ No | development | Environment (production/development) |
|
|
530
|
+
|
|
531
|
+
### **Cache Settings** (src/lib/cache.ts)
|
|
532
|
+
```typescript
|
|
533
|
+
// Configurable cache parameters
|
|
534
|
+
const lawCache = new SimpleCache({
|
|
535
|
+
maxSize: 100, // Max cached entries
|
|
536
|
+
searchTTL: 60 * 60, // 1 hour (search results)
|
|
537
|
+
textTTL: 24 * 60 * 60 // 24 hours (article text)
|
|
538
|
+
})
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
## 🤝 Contributing
|
|
544
|
+
|
|
545
|
+
We welcome contributions! This project aims to win the MCP competition—help us make it even better.
|
|
546
|
+
|
|
547
|
+
### **Areas for Contribution**
|
|
548
|
+
- 🧪 Additional test cases
|
|
549
|
+
- 📊 Enhanced statistical analysis
|
|
550
|
+
- 🔗 More external integrations
|
|
551
|
+
- 🌍 Internationalization (English UI)
|
|
552
|
+
- 🚀 Performance optimizations
|
|
553
|
+
|
|
554
|
+
See [DEVELOPMENT.md](docs/DEVELOPMENT.md) for detailed guidelines.
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## 📊 Performance Benchmarks
|
|
559
|
+
|
|
560
|
+
| Operation | Cold Start | Cached | Speedup |
|
|
561
|
+
|-----------|-----------|--------|---------|
|
|
562
|
+
| Law search | 450ms | 12ms | **37.5×** |
|
|
563
|
+
| Article retrieval | 380ms | 8ms | **47.5×** |
|
|
564
|
+
| Precedent search | 520ms | 15ms | **34.6×** |
|
|
565
|
+
|
|
566
|
+
*Benchmarks on Railway deployment (Seoul region), measured over 100 requests*
|
|
567
|
+
|
|
568
|
+
---
|
|
569
|
+
|
|
570
|
+
## 📄 License
|
|
571
|
+
|
|
572
|
+
MIT License - see [LICENSE](LICENSE) for details
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
## 🙏 Acknowledgments
|
|
577
|
+
|
|
578
|
+
- **Korea Ministry of Government Legislation** for the Open API
|
|
579
|
+
- **LexDiff Project** for battle-tested normalization code
|
|
580
|
+
- **Anthropic** for the MCP specification and Claude
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## 📞 Support
|
|
585
|
+
|
|
586
|
+
- 🐛 **Issues**: [GitHub Issues](https://github.com/chrisryugj/korean-law-mcp/issues)
|
|
587
|
+
- 💬 **Discussions**: [GitHub Discussions](https://github.com/chrisryugj/korean-law-mcp/discussions)
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
<div align="center">
|
|
592
|
+
|
|
593
|
+
**Built with ❤️ for the Korean legal community**
|
|
594
|
+
|
|
595
|
+
[⭐ Star this repo](https://github.com/chrisryugj/korean-law-mcp) if you find it useful!
|
|
596
|
+
|
|
597
|
+
</div>
|