korean-law-mcp 4.6.2 → 4.6.4
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/build/tool-registry.js +0 -12
- package/build/tools/search.js +25 -0
- package/package.json +1 -1
package/build/tool-registry.js
CHANGED
|
@@ -735,17 +735,6 @@ const V3_EXPOSED = new Set([
|
|
|
735
735
|
* - annotations: MCP ToolAnnotations. 노출 9개 모두 법제처 read-only 조회(멱등) + 외부 API 호출.
|
|
736
736
|
*/
|
|
737
737
|
const SERVICE_NAME = "Korean-law-mcp";
|
|
738
|
-
const TOOL_TITLES = {
|
|
739
|
-
legal_research: "법령 리서치 (다단계 체인)",
|
|
740
|
-
legal_analysis: "법령 정밀분석 (인용검증·영향)",
|
|
741
|
-
search_law: "법령 검색",
|
|
742
|
-
get_law_text: "법령 조문 조회",
|
|
743
|
-
get_annexes: "별표·서식 조회",
|
|
744
|
-
search_decisions: "판례·결정례 통합검색",
|
|
745
|
-
get_decision_text: "판례·결정례 전문조회",
|
|
746
|
-
discover_tools: "전문도구 탐색",
|
|
747
|
-
execute_tool: "전문도구 실행",
|
|
748
|
-
};
|
|
749
738
|
// 이름 기반 O(1) 조회용 Map
|
|
750
739
|
// allTools는 정적 — 모듈 로드 시 1회만 구성 (HTTP 모드에서 요청마다 재구성 방지)
|
|
751
740
|
const toolMap = new Map(allTools.map(tool => [tool.name, tool]));
|
|
@@ -763,7 +752,6 @@ export function registerTools(server, apiClient) {
|
|
|
763
752
|
description: `${SERVICE_NAME} — ${tool.description}`,
|
|
764
753
|
inputSchema: toMcpInputSchema(tool.schema),
|
|
765
754
|
annotations: {
|
|
766
|
-
title: TOOL_TITLES[tool.name] ?? tool.name,
|
|
767
755
|
readOnlyHint: true,
|
|
768
756
|
idempotentHint: true,
|
|
769
757
|
openWorldHint: true,
|
package/build/tools/search.js
CHANGED
|
@@ -9,6 +9,7 @@ import { formatToolError, noResultHint } from "../lib/errors.js";
|
|
|
9
9
|
import { expandLawQuery, normalizeAliasKey, resolveLawAlias } from "../lib/search-normalizer.js";
|
|
10
10
|
import { buildUpcomingNotes, fetchUpcomingLaws } from "../lib/upcoming-laws.js";
|
|
11
11
|
import { searchAdminRule } from "./admin-rule.js";
|
|
12
|
+
import { searchOrdinance } from "./ordinance-search.js";
|
|
12
13
|
export const SearchLawSchema = z.object({
|
|
13
14
|
query: z.string().describe("검색할 법령명 (예: '관세법', 'fta특례법', '화관법')"),
|
|
14
15
|
display: z.number().optional().default(50).describe("최대 결과 개수 (기본 50 — 짧은 법령명 정확매칭 누락 방지)"),
|
|
@@ -33,6 +34,13 @@ function parseLawsXml(xmlText) {
|
|
|
33
34
|
}
|
|
34
35
|
return out;
|
|
35
36
|
}
|
|
37
|
+
// '광진구 복무 조례'처럼 조례 키워드나 지역명 토큰(○○시/군/구)이 있으면 자치법규 쿼리로 판단.
|
|
38
|
+
// '도'는 도로법·양도세 등 오탐이 많아 제외. 토큰 3자 미만('구', '시')도 제외.
|
|
39
|
+
function looksLikeOrdinanceQuery(query) {
|
|
40
|
+
if (query.includes("조례"))
|
|
41
|
+
return true;
|
|
42
|
+
return query.split(/\s+/).some((t) => t.length >= 3 && /[시군구]$/.test(t));
|
|
43
|
+
}
|
|
36
44
|
function formatHit(idx, h) {
|
|
37
45
|
const status = h.statusCode === "연혁" ? " ⚠️[연혁-과거버전]" : h.statusCode === "현행" ? " [현행]" : "";
|
|
38
46
|
let line = `${idx}. ${h.name}${status}\n - 법령ID: ${h.lawId}\n - MST: ${h.mst}\n - 공포일: ${h.promDate}`;
|
|
@@ -95,6 +103,23 @@ export async function searchLaw(apiClient, input) {
|
|
|
95
103
|
content: [{ type: "text", text: truncateResponse(prefix + text) }],
|
|
96
104
|
};
|
|
97
105
|
}
|
|
106
|
+
// Fallback: 조례·규칙(지자체)은 자치법규라 국가법령 검색에 안 잡힘.
|
|
107
|
+
// 쿼리가 자치법규 형태면 search_ordinance 자동 시도.
|
|
108
|
+
if (looksLikeOrdinanceQuery(input.query)) {
|
|
109
|
+
const ordinFallback = await searchOrdinance(apiClient, {
|
|
110
|
+
query: input.query,
|
|
111
|
+
display: Math.min(input.display, 100),
|
|
112
|
+
apiKey: input.apiKey,
|
|
113
|
+
}).catch(() => null);
|
|
114
|
+
if (ordinFallback && !ordinFallback.isError) {
|
|
115
|
+
const text = ordinFallback.content[0]?.text || "";
|
|
116
|
+
const prefix = `[FALLBACK] 법령 '${input.query}' 0건 → 자치법규로 자동 폴백.\n` +
|
|
117
|
+
`💡 조례·규칙(지자체)은 자치법규이며 search_ordinance(execute_tool 경유)가 본 도구입니다.\n\n`;
|
|
118
|
+
return {
|
|
119
|
+
content: [{ type: "text", text: truncateResponse(prefix + text) }],
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
98
123
|
return noResultHint(input.query, "법령");
|
|
99
124
|
}
|
|
100
125
|
// 정확매칭 분리: 법제처 API는 LIKE 검색 + 가나다순 정렬이라
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "korean-law-mcp",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.4",
|
|
4
4
|
"description": "법제처 42개 API → 9개 MCP 도구. 법령·판례·조례·조약 + 다단계 리서치(legal_research, 8 task) + 정밀분석(legal_analysis: 인용검증·판례생사·행위시법·영향그래프) + 시점 비교(time_travel) + 상황별 5단계 안내(action_plan) + 국세청 해석례(nts)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|