Korean Law MCP Server
Enables real-time search and analysis of Korean laws, legal precedents, and administrative rules through the National Law Information Center Open API, allowing AI agents to access official legal information for contract review, compliance, and legal research.
README
๐๏ธ ํ๊ตญ ๋ฒ๋ฅ /ํ๋ก ๊ฒ์ MCP ์๋ฒ
๊ตญ๊ฐ๋ฒ๋ น์ ๋ณด์ผํฐ Open API๋ฅผ ํ์ฉํ ๊ณ ์ฑ๋ฅ MCP (Model Context Protocol) ์๋ฒ์ ๋๋ค.
AI ์์ด์ ํธ(Claude Desktop, Cursor ๋ฑ)๊ฐ ์ค์๊ฐ์ผ๋ก ํ๊ตญ ๋ฒ๋ น, ํ๋ก, ํ์ ๊ท์น์ ๊ฒ์ํ๊ณ ๋ถ์ํ ์ ์๋๋ก ํฉ๋๋ค.
โจ ์ฃผ์ ๊ธฐ๋ฅ
๐ ๋ฒ๋ น ๊ฒ์
- ํค์๋ ๊ธฐ๋ฐ ๋ฒ๋ น ๊ฒ์: ๋ฏผ๋ฒ, ์๋ฒ, ๊ทผ๋ก๊ธฐ์ค๋ฒ ๋ฑ ๋ค์ํ ๋ฒ๋ น ๊ฒ์
- ๋ฒ๋ น ์์ธ ์กฐํ: ํน์ ๋ฒ๋ น์ ์ ๋ฌธ(์กฐ๋ฌธ) ๋ฐ ์์ธ ์ ๋ณด ์กฐํ
- ๋ฒ๋ น ๊ธฐ๋ณธ ์ ๋ณด: ์๊ด๋ถ์ฒ, ๊ณตํฌ์ผ์, ์ํ์ผ์, ๊ฐ์ ์ ๋ณด ํฌํจ
โ๏ธ ํ๋ก ๊ฒ์
- ํ๋ก ํค์๋ ๊ฒ์: ์ํด๋ฐฐ์, ๊ณ์ฝ, ๋ถ๋นํด๊ณ ๋ฑ ํ๋ก ๊ฒ์
- ํ๋ก ์์ธ ์กฐํ: ํ๊ฒฐ์์ง, ํ์์ฌํญ, ํ๋ก ์ ๋ฌธ ์กฐํ
- ๋ฒ์ ํํฐ๋ง: ๋๋ฒ์, ํ๋ฒ์ฌํ์ ๋ฑ ๋ฒ์๋ณ ํํฐ๋ง ์ง์
- ์ฐธ์กฐ์กฐ๋ฌธ/ํ๋ก: ๊ด๋ จ ๋ฒ๋ น ๋ฐ ์ฐธ์กฐ ํ๋ก ์ ๋ณด ์ ๊ณต
๐ ํ์ ๊ท์น ๊ฒ์
- ํ์ ๊ท์น ๊ฒ์: ๊ฐ ๋ถ์ฒ์ ํ์ ๊ท์น ๊ฒ์
- ์๊ด๋ถ์ฒ ์ ๋ณด: ์ ์ ์ผ์, ์ํ์ผ์ ๋ฑ ์์ธ ์ ๋ณด
๐ ์ฑ๋ฅ ์ต์ ํ
- ์ ๋ต์ ์บ์ฑ: ๋ฒ๋ น/ํ๋ก ๋ฐ์ดํฐ๋ฅผ 24์๊ฐ ์บ์ฑํ์ฌ API ํธ์ถ ์ต์ํ
- ๋น ๋ฅธ ์๋ต ์๋: ์บ์ ๊ธฐ๋ฐ ์ฆ์ ์๋ต
- ์์ ์ ์ธ ์ด์: ์๋ฌ ํธ๋ค๋ง ๋ฐ ๋ก๊น ์์คํ
๐ฏ ํ์ฉ ์ฌ๋ก
๋ฒ๋ฅ ์ ๋ฌธ๊ฐ
- ๊ณ์ฝ์ ๊ฒํ : AI๊ฐ ๊ณ์ฝ์๋ฅผ ๋ถ์ํ๊ณ ๊ด๋ จ ๋ฒ๋ น ๋ฐ ํ๋ก๋ฅผ ์๋ ์ฐธ์กฐ
- ๋ฒ๋ฅ ์๋ฌธ: ํน์ ์ฌ์์ ๋ํ ๊ด๋ จ ๋ฒ๋ น ๋ฐ ํ๋ก๋ฅผ ์ฆ์ ์กฐํ
- ํ๋ก ์ฐ๊ตฌ: ์ ์ฌ ํ๋ก๋ฅผ ๋น ๋ฅด๊ฒ ๊ฒ์ํ๊ณ ๋น๊ต ๋ถ์
๊ธฐ์ ๋ฒ๋ฌดํ
- ๊ธฐ์ ์ปดํ๋ผ์ด์ธ์ค: ์ฌ์ ๊ด๋ จ ๋ฒ๋ น์ ์ค์๊ฐ ์กฐํ
- ๋ ธ๋ฌด ๊ด๋ฆฌ: ๊ทผ๋ก๊ธฐ์ค๋ฒ ๋ฑ ๋ ธ๋ ๊ด๋ จ ๋ฒ๋ น ๋ฐ ํ๋ก ๊ฒ์
- ์์ก ์ค๋น: ๊ด๋ จ ํ๋ก ๋ฐ ๋ฒ๋ น ์๋ ์์ง
์คํํธ์ /๊ฐ๋ฐ์
- ์๋น์ค ๋ฒ๋ฅ ๊ฒํ : ๊ฐ์ธ์ ๋ณด๋ณดํธ๋ฒ, ์ ์์๊ฑฐ๋๋ฒ ๋ฑ ๊ด๋ จ ๋ฒ๋ น ํ์ธ
- ์ฝ๊ด ์์ฑ: ๊ด๋ จ ๋ฒ๋ น์ ์ฐธ์กฐํ์ฌ ์ฝ๊ด ์์ฑ
- ๋ฒ๋ฅ ๋ฆฌ์คํฌ ๋ถ์: AI๊ฐ ์๋น์ค ๊ธฐํ์๋ฅผ ๋ถ์ํ๊ณ ๊ด๋ จ ๋ฒ๋ฅ ๋ฆฌ์คํฌ ํ์
์ผ๋ฐ ์ฌ์ฉ์
- ๋ฒ๋ฅ ์๋ด: AI ์์ด์ ํธ๋ฅผ ํตํ ๊ธฐ๋ณธ์ ์ธ ๋ฒ๋ฅ ์ ๋ณด ์กฐํ
- ๊ถ๋ฆฌ ํ์ธ: ์๋น์ ๊ถ๋ฆฌ, ์์ฐจ๊ถ ๋ฑ ๊ด๋ จ ๋ฒ๋ น ๋ฐ ํ๋ก ๊ฒ์
- ๋ฏผ์ ์ค๋น: ํ์ ์ฌํ, ์์ก ์ค๋น๋ฅผ ์ํ ๋ฒ๋ฅ ์ ๋ณด ์์ง
๐ ๏ธ ๊ธฐ์ ์คํ
- MCP Framework: FastMCP
- Data Validation: Pydantic
- HTTP Client: Requests
- XML Parsing: xml.etree.ElementTree
- Caching: cachetools (24์๊ฐ TTL)
- Async Processing: asyncio
- Environment: Python-dotenv
๐ฆ ์ค์น ๋ฐ ์ค์
1) ์์กด์ฑ ์ค์น
pip install -r requirements.txt
๐ก
uv๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ:uv sync
2) API ํค ๋ฐ๊ธ
๊ตญ๊ฐ๋ฒ๋ น์ ๋ณด์ผํฐ Open API ํค๋ฅผ ๋ฐ๊ธ๋ฐ์์ผ ํฉ๋๋ค:
- ๊ตญ๊ฐ๋ฒ๋ น์ ๋ณด์ผํฐ Open API ์ฌ์ดํธ ๋ฐฉ๋ฌธ
- ํ์๊ฐ์ ๋ฐ ๋ก๊ทธ์ธ
- ๊ณต๋ํ์ฉ ์๋น์ค > Open API ๋ฉ๋ด์์ API ์ ์ฒญ
- ์น์ธ ํ ์ธ์ฆํค(OC) ๋ฐ๊ธ๋ฐ๊ธฐ
๐ ์ฐธ๊ณ : API ํค ๋ฐ๊ธ์ ๋ณดํต ์ฆ์ ์น์ธ๋๋ฉฐ, ๋ฌด๋ฃ๋ก ์ด์ฉ ๊ฐ๋ฅํฉ๋๋ค.
3) ํ๊ฒฝ ๋ณ์ ์ค์
ํ๋ก์ ํธ ๋ฃจํธ์ .env ํ์ผ์ ์์ฑํ๊ณ API ํค๋ฅผ ์ค์ ํฉ๋๋ค:
cp env.law.example .env
.env ํ์ผ ๋ด์ฉ:
LAW_API_KEY=your_law_api_key_here
LOG_LEVEL=INFO
PORT=8096
4) ์๋ฒ ์คํ
python -m src.law_main
๋๋ HTTP ์๋ฒ๋ก ์คํ:
python src/law_main.py
๐ณ Docker ์คํ
Docker๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐํธํ๊ฒ ์คํํ ์ ์์ต๋๋ค:
# ์ด๋ฏธ์ง ๋น๋
docker build -t korean-law-mcp:latest .
# ์ปจํ
์ด๋ ์คํ
docker run --rm \
-e LAW_API_KEY=your_law_api_key_here \
-p 8096:8096 \
korean-law-mcp:latest
๐งฐ ์ฌ์ฉ ๊ฐ๋ฅํ ๋๊ตฌ (Tools)
1. health
- ์ค๋ช : ์๋น์ค ์ํ ๋ฐ API ํค ์ค์ ํ์ธ
- ํ๋ผ๋ฏธํฐ: ์์
- ๋ฐํ: ์๋น์ค ์ํ ๊ฐ์ฒด
2. search_law_tool
- ์ค๋ช : ๋ฒ๋ น์ ํค์๋๋ก ๊ฒ์
- ํ๋ผ๋ฏธํฐ:
query(string, ํ์): ๊ฒ์ํ ๋ฒ๋ น ํค์๋ (์: '๋ฏผ๋ฒ', '์๋ฒ')page(integer, ์ ํ): ํ์ด์ง ๋ฒํธ (๊ธฐ๋ณธ๊ฐ: 1)page_size(integer, ์ ํ): ํ์ด์ง๋น ๊ฒฐ๊ณผ ์ (๊ธฐ๋ณธ๊ฐ: 10, ์ต๋: 50)
- ๋ฐํ: ๊ฒ์๋ ๋ฒ๋ น ๋ชฉ๋ก (๋ฒ๋ น๋ช , ์๊ด๋ถ์ฒ, ๊ณตํฌ์ผ์, ์ํ์ผ์ ๋ฑ)
์์ ์๋ต:
{
"total": 152,
"page": 1,
"page_size": 10,
"laws": [
{
"๋ฒ๋ นID": "001122",
"๋ฒ๋ น๋ช
": "๋ฏผ๋ฒ",
"๋ฒ๋ น๊ตฌ๋ถ": "๋ฒ๋ฅ ",
"์๊ด๋ถ์ฒ": "๋ฒ๋ฌด๋ถ",
"๊ณตํฌ์ผ์": "19580222",
"์ํ์ผ์": "19600101"
}
]
}
3. get_law_detail_tool
- ์ค๋ช : ํน์ ๋ฒ๋ น์ ์์ธ ์ ๋ณด ๋ฐ ์ ๋ฌธ(์กฐ๋ฌธ) ์กฐํ
- ํ๋ผ๋ฏธํฐ:
law_id(string, ํ์): ๋ฒ๋ น ID (๋ฒ๋ น ๊ฒ์ ๊ฒฐ๊ณผ์์ ์ป์ ๋ฒ๋ นID)
- ๋ฐํ: ๋ฒ๋ น์ ์์ธ ์ ๋ณด์ ๋ชจ๋ ์กฐ๋ฌธ ๋ด์ฉ
์์ ์๋ต:
{
"๋ฒ๋ นID": "001122",
"๋ฒ๋ น๋ช
": "๋ฏผ๋ฒ",
"๋ฒ๋ น๊ตฌ๋ถ": "๋ฒ๋ฅ ",
"์๊ด๋ถ์ฒ": "๋ฒ๋ฌด๋ถ",
"๊ณตํฌ์ผ์": "19580222",
"์ํ์ผ์": "19600101",
"์กฐ๋ฌธ์": 1118,
"์กฐ๋ฌธ": [
{
"์กฐ๋ฌธ๋ฒํธ": "์ 1์กฐ",
"์กฐ๋ฌธ์ ๋ชฉ": "๋ฒ์",
"์กฐ๋ฌธ๋ด์ฉ": "๋ฏผ์ฌ์ ๊ดํ์ฌ ๋ฒ๋ฅ ์ ๊ท์ ์ด ์์ผ๋ฉด..."
}
]
}
4. search_precedent_tool
- ์ค๋ช : ํ๋ก๋ฅผ ํค์๋๋ก ๊ฒ์
- ํ๋ผ๋ฏธํฐ:
query(string, ํ์): ๊ฒ์ํ ํ๋ก ํค์๋ (์: '์ํด๋ฐฐ์', '๊ณ์ฝ')page(integer, ์ ํ): ํ์ด์ง ๋ฒํธ (๊ธฐ๋ณธ๊ฐ: 1)page_size(integer, ์ ํ): ํ์ด์ง๋น ๊ฒฐ๊ณผ ์ (๊ธฐ๋ณธ๊ฐ: 10, ์ต๋: 50)court(string, ์ ํ): ๋ฒ์ ๊ตฌ๋ถ (์: '๋๋ฒ์', 'ํ๋ฒ์ฌํ์')
- ๋ฐํ: ๊ฒ์๋ ํ๋ก ๋ชฉ๋ก
์์ ์๋ต:
{
"total": 2453,
"page": 1,
"page_size": 10,
"precedents": [
{
"ํ๋ก์ผ๋ จ๋ฒํธ": "202012345",
"์ฌ๊ฑด๋ช
": "์ํด๋ฐฐ์(๊ธฐ)",
"์ฌ๊ฑด๋ฒํธ": "2020๋ค123456",
"์ ๊ณ ์ผ์": "20201015",
"์ ๊ณ ": "ํ๊ธฐํ์ก",
"๋ฒ์๋ช
": "๋๋ฒ์",
"์ฌ๊ฑด์ข
๋ฅ๋ช
": "๋ฏผ์ฌ",
"ํ์์ฌํญ": "...",
"ํ๊ฒฐ์์ง": "..."
}
]
}
5. get_precedent_detail_tool
- ์ค๋ช : ํน์ ํ๋ก์ ์์ธ ์ ๋ณด ์กฐํ
- ํ๋ผ๋ฏธํฐ:
precedent_id(string, ํ์): ํ๋ก ์ผ๋ จ๋ฒํธ
- ๋ฐํ: ํ๋ก์ ์์ธ ์ ๋ณด (ํ๊ฒฐ์์ง, ์ฐธ์กฐ์กฐ๋ฌธ, ํ๋ก ์ ๋ฌธ ๋ฑ)
์์ ์๋ต:
{
"ํ๋ก์ผ๋ จ๋ฒํธ": "202012345",
"์ฌ๊ฑด๋ช
": "์ํด๋ฐฐ์(๊ธฐ)",
"์ฌ๊ฑด๋ฒํธ": "2020๋ค123456",
"์ ๊ณ ์ผ์": "20201015",
"์ ๊ณ ": "ํ๊ธฐํ์ก",
"๋ฒ์๋ช
": "๋๋ฒ์",
"ํ์์ฌํญ": "...",
"ํ๊ฒฐ์์ง": "...",
"์ฐธ์กฐ์กฐ๋ฌธ": "๋ฏผ๋ฒ ์ 750์กฐ, ์ 751์กฐ",
"์ฐธ์กฐํ๋ก": "๋๋ฒ์ 2019๋ค234567...",
"ํ๋ก๋ด์ฉ": "ใ์ ๋ฌธใ..."
}
6. search_administrative_rule_tool
- ์ค๋ช : ํ์ ๊ท์น์ ํค์๋๋ก ๊ฒ์
- ํ๋ผ๋ฏธํฐ:
query(string, ํ์): ๊ฒ์ํ ํ์ ๊ท์น ํค์๋page(integer, ์ ํ): ํ์ด์ง ๋ฒํธ (๊ธฐ๋ณธ๊ฐ: 1)page_size(integer, ์ ํ): ํ์ด์ง๋น ๊ฒฐ๊ณผ ์ (๊ธฐ๋ณธ๊ฐ: 10, ์ต๋: 50)
- ๋ฐํ: ๊ฒ์๋ ํ์ ๊ท์น ๋ชฉ๋ก
๐ก ์ฌ์ฉ ์์
Claude Desktop์์ ์ฌ์ฉ
- Claude Desktop ์ค์ ํ์ผ (
claude_desktop_config.json) ์์ :
{
"mcpServers": {
"korean-law": {
"command": "python",
"args": ["-m", "src.law_main"],
"env": {
"LAW_API_KEY": "your_api_key_here"
}
}
}
}
-
Claude Desktop ์ฌ์์
-
Claude์๊ฒ ์ง๋ฌธ:
- "๋ฏผ๋ฒ ์ 750์กฐ์ ๋ํด ์๋ ค์ค"
- "๋ถ๋นํด๊ณ ๊ด๋ จ ํ๋ก ์ฐพ์์ค"
- "๊ฐ์ธ์ ๋ณด๋ณดํธ๋ฒ ๊ฒ์ํด์ค"
Cursor์์ ์ฌ์ฉ
Cursor์ MCP ์ค์ ์์ ์์ ๋์ผํ๊ฒ ์ถ๊ฐํ๋ฉด ๋ฉ๋๋ค.
๐ ํ๋ก์ ํธ ๊ตฌ์กฐ
korean-law-mcp/
โโโ src/
โ โโโ __init__.py
โ โโโ law_main.py # MCP ์๋ฒ ๋ฉ์ธ ํ์ผ
โ โโโ law_tools.py # ๋ฒ๋ฅ API ํธ์ถ ๋๊ตฌ
โโโ .env # ํ๊ฒฝ ๋ณ์ ํ์ผ (API ํค ๋ฑ)
โโโ env.law.example # ํ๊ฒฝ ๋ณ์ ์์ ํ์ผ
โโโ requirements.txt # Python ์์กด์ฑ
โโโ README_LAW.md # ํ๋ก์ ํธ ๋ฌธ์ (์ด ํ์ผ)
โโโ pyproject.toml # ํ๋ก์ ํธ ์ค์
๐ ๋ก๋๋งต
- [ ] ๋ฒ๋ น ๊ฐ์ ์ด๋ ฅ ์กฐํ
- [ ] ๋ฒ๋ น/ํ๋ก ์ ๋ฌธ PDF ๋ค์ด๋ก๋
- [ ] ์์ฐ์ด ๊ธฐ๋ฐ ๋ฒ๋ น ํด์
- [ ] ๋ฒ๋ น ๋น๊ต ๋ถ์ ๊ธฐ๋ฅ
- [ ] ํ๋ก ์ ์ฌ๋ ๋ถ์
- [ ] ๋ฒ๋ฅ ์ฉ์ด ์ฌ์
๐ฐ ๋น์ฆ๋์ค ๋ชจ๋ธ
์ด MCP ์๋ฒ๋ ํ๋งค์ฉ ์ ํ์ผ๋ก ๊ฐ๋ฐ๋์์ต๋๋ค:
ํ๊ฒ ๊ณ ๊ฐ
- ๐ข ๋ฒ๋ฅ ์ฌ๋ฌด์/๋กํ: ๋ฒ๋ฅ ๋ฆฌ์์น ์๋ํ
- ๐ญ ๊ธฐ์ ๋ฒ๋ฌดํ: ์ปดํ๋ผ์ด์ธ์ค ๊ด๋ฆฌ
- ๐ ์คํํธ์ : ๋ฒ๋ฅ ๋ฆฌ์คํฌ ๋ถ์
- ๐ ๋ฒํ ์ฐ๊ตฌ์: ํ๋ก ์ฐ๊ตฌ ๋๊ตฌ
๊ฐ๊ฒฉ ์ฑ ์ (์ฐธ๊ณ )
- Basic: 30๋ง์ (๊ธฐ๋ณธ ๊ฒ์ ๊ธฐ๋ฅ)
- Pro: 100๋ง์ (AI ๋ถ์ ๊ธฐ๋ฅ ์ถ๊ฐ)
- Enterprise: 200๋ง์+ (์ปค์คํฐ๋ง์ด์ง, ๊ธฐ์ ์ง์)
์ฐจ๋ณํ ํฌ์ธํธ
- โ ๊ตญ๊ฐ ๊ณต์ ๋ฐ์ดํฐ ํ์ฉ
- โ AI ์์ด์ ํธ ์ง์ ํตํฉ
- โ ์ค์๊ฐ ์ต์ ๋ฒ๋ น/ํ๋ก ์กฐํ
- โ ํ๊ตญ์ด ์๋ฒฝ ์ง์
- โ ๋ณต์กํ API ์ฒ๋ฆฌ ์๋ํ
๐ ๋ผ์ด์ ์ค
MIT License
๐ค ๊ธฐ์ฌ ๋ฐ ๋ฌธ์
- ์ด์: GitHub Issues
- ๋ฌธ์: law-mcp@example.com
- ๋ฌธ์: https://github.com/your-repo/korean-law-mcp
Made with โค๏ธ for Korean Legal Professionals
๊ตญ๊ฐ๋ฒ๋ น์ ๋ณด์ผํฐ Open API๋ฅผ ํ์ฉํ์ฌ ๊ฐ๋ฐ๋์์ต๋๋ค.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.