law-openapi-mcp
# law-openapi-mcp
<!-- mcp-name: io.github.rubatoyd/law-openapi-mcp -->
[](https://github.com/rubatoyd/law-openapi-mcp/actions/workflows/ci.yml)
[](https://github.com/rubatoyd/law-openapi-mcp/releases/latest)
[](https://github.com/rubatoyd/law-openapi-mcp/releases)
<!-- usage:start -->
> ๐ **์ฌ์ฉ๋** โ ์ต๊ทผ 14์ผ ์กฐํ **0**ํ(๊ณ ์ 0) ยท ํด๋ก **0**ํ(๊ณ ์ 0) ยท ๋ฆด๋ฆฌ์ค ์์ฐ ๋์ ๋ค์ด๋ก๋ **0**
>
> 
>
> <sub>2026-09-22 ์๋ ๊ฐฑ์ ยท ์ ์ฒด ์ด๋ ฅ์ [`docs/usage.csv`](docs/usage.csv). GitHub ํธ๋ํฝ ํต๊ณ๋ 14์ผ ์ฐฝ๋ง ์ ๊ณตํ๋ฏ๋ก ์ด ์ ์ฅ์๊ฐ ๋งค์ผ ์ฐ์ด ๋์ ํ๋ค.</sub>
<!-- usage:end -->
๋ฒ์ ์ฒ **๊ตญ๊ฐ๋ฒ๋ น์ ๋ณด OPEN API**(law.go.kr DRF)๋ฅผ ๊ฒ์ยท์์งํ๋ MCP ์๋ฒ + CLI.
ํํ๋ฒ๋ นยทํ์ ๊ท์นยท์์น๋ฒ๊ทยทํ๋กยทํ์ฌ๊ฒฐ์ ๋กยทํ์ ์ฌํ๋กยท๋ฒ๋ นํด์๋ก(๋ฒ์ ์ฒ + ๋ถ์ฒ 39์ข
)ยท
์์ํ ๊ฒฐ์ ๋ฌธยท๋ณํ์์ยท์กฐ์ฝยท๋ฒ๋ น์ฉ์ด ๋ฑ **72์ข
**์ ํ ์ธํฐํ์ด์ค๋ก ์กฐํํ๊ณ , ๊ฒฐ๊ณผ๋ฅผ
xlsxยทcsvยทjsonยทsqlite ๋ก ๋ด๋ณด๋ธ๋ค. ์ฐ๊ตฌ ์๋ฃ์์ง ๋จ๊ณ์์ ๋ฐ๋ณต ์ฌ์ฌ์ฉํ๊ธฐ ์ํ ๋๊ตฌ๋ค.
์๋งค ์ ์ฅ์: [na-openapi-mcp](https://github.com/rubatoyd/na-openapi-mcp)(๊ตญํ๋์๊ด) ยท
[nl-openapi-mcp](https://github.com/rubatoyd/nl-openapi-mcp)(๊ตญ๋ฆฝ์ค์๋์๊ด) ยท
[kci-openapi-mcp](https://github.com/rubatoyd/KCI_openAPI) ยท [scienceON-mcp](https://github.com/rubatoyd/scienceON-mcp)
---
## ์์ง ๋จ์๋ ์ธ์ฉ ๋จ์๋ค
**๋ฒ๋ น ํ๋๊ฐ ๋ฌธํ ํ๋**๋ค. ์กฐ๋ฌธ์ ์ธ์ฉํ ๋์ ์์น๋ก ๋ฃ์ง, ๋ณ๋ ๋ ์ฝ๋๋ก ์ชผ๊ฐ์ง ์๋๋ค.
ใ์ดยท์ค๋ฑ๊ต์ก๋ฒใ์ ์กฐ๋ฌธ 135๊ฐ์ง๋ฆฌ 309KB ๋ฌธ์์ง๋ง ์ฐธ๊ณ ๋ฌธํ์๋ ํ ์ค๋ก ๋ค์ด๊ฐ๋ค.
ํ๋ก๋ ์ฌ๊ฑด ํ๋, ๋ฒ๋ นํด์๋ก๋ ์๊ฑด ํ๋, ์กฐ์ฝ์ ์กฐ์ฝ ํ๋๋ค.
๋ณธ๋ฌธ์ด ํ์ํ๋ฉด `law_body` ๋ก ๋ฐ๋ก ๋ฐ๋๋ค โ ๊ทธ๋๋ ์กฐ๋ฌธ์ด ๊ตฌ์กฐ๋ก ์จ๋ค.
## ์ค๋น๋ฌผ
`OC` ํ๋๋ฉด ๋๋ค. [open.law.go.kr](https://open.law.go.kr) ์์ OPEN API ๋ฅผ ์ ์ฒญํ ๋
**๊ฐ์
์ด๋ฉ์ผ์ @ ์๋ถ๋ถ**์ ๋ณธ์ธ์ด ์ง์ ํ๋ ๊ฐ์ด๋ค.
```bash
cp .env.example .env # LAW_OC=your_id ๋ฅผ ์ฑ์ด๋ค
```
`OC` ๋ ๋น๋ฐ๊ฐ์ด ์๋๋ค. ์์ฒญ URL์ ํ๋ฌธ์ผ๋ก ์ค๋ฆฌ๊ณ ์๋ต์ ์์ธ๋งํฌ์๋ ๊ทธ๋๋ก ๋๋์์จ๋ค.
๊ทธ๋๋ ์ฌ๋๋ง๋ค ๊ฐ์ด ๋ค๋ฅด๋ฏ๋ก ํ๊ฒฝ๋ณ์๋ก ๋ฐ๋๋ค.
## ์ค์นยท์คํ
```bash
uv sync
uv run law status # ์ฐ๊ฒฐ ์ ๊ฒ
uv run law search --target law --query ๊ต์ก # ํํ๋ฒ๋ น ๊ฒ์
uv run law body --target law --id 209959 # ๋ณธ๋ฌธ ์กฐํ
uv run law collect --target law,prec --query ๊ต์ก,ํ์๊ต์ก --format xlsx
```
MCP ๋ฑ๋ก:
```json
{
"mcpServers": {
"law": {
"command": "uvx",
"args": ["law-openapi-mcp"],
"env": { "LAW_OC": "your_id" }
}
}
}
```
## MCP ๋๊ตฌ
| ๋๊ตฌ | ํ๋ ์ผ |
|------|---------|
| `law_status` | `OC` ๋ณด์ ์ฌ๋ถ + ์ค์ ์๋ณต 1ํ |
| `law_targets` | ๋ค๋ฃฐ ์ ์๋ ๊ฐ๋์ ๊ฐ๋๋ณ ์ค์ธก ์คํค๋งยท์ฃผ์์ฌํญ |
| `law_search` | ๋ชฉ๋ก ๊ฒ์. `total`ยท`truncated`ยท๊ฒฝ๊ณ ๋ฅผ ํจ๊ป ๋๋ ค์ค๋ค |
| `law_body` | ์๋ณ์ 1๊ฑด์ ๋ณธ๋ฌธ(์กฐ๋ฌธยทํ์์ฌํญยท์ง์์์ง ๋ฑ) |
| `law_collect` | ๊ฐ๋ ร ๊ฒ์์ด ์กฐํฉ์ ๋ชจ์ xlsx/csv/json/sqlite ๋ก ์ ์ฅ |
| `law_citation` | ๋ ์ฝ๋๋ฅผ ์์ง ํ๋(๋ฐ๋ น์ฃผ์ฒดยทํธยท์ํ์ผยท์ ์ ๊ธฐ๊ด)๋ก ๋งคํ |
## ๋ค๋ฃจ๋ ๊ฐ๋ โ 72์ข
| ๋ฌด๋ฆฌ | ์ข
์ | ๋ณด๊ธฐ |
|---|--:|---|
| ๋ฒ๋ นยท๊ท์น | 7 | `law` ํํ๋ฒ๋ น ยท `eflaw` ์ํ์ผ๋ฒ๋ น ยท `elaw` ์๋ฌธ๋ฒ๋ น ยท `admrul` ํ์ ๊ท์น ยท `ordin` ์์น๋ฒ๊ท ยท `lsStmd` ๋ฒ๋ น์ฒด๊ณ๋ ยท `school` ํ์น |
| ํ๋กยท์ฌ๊ฒฐ | 3 | `prec` ํ๋ก ยท `detc` ํ์ฌ๊ฒฐ์ ๋ก ยท `decc` ํ์ ์ฌํ๋ก |
| ๋ฒ๋ นํด์ | 40 | `expc` ๋ฒ์ ์ฒ + **๋ถ์ฒ 39์ข
**(`moeCgmExpc` ๊ต์ก๋ถ โฆ) |
| ์์ํ ๊ฒฐ์ ๋ฌธ | 12 | `ppc` ๊ฐ์ธ์ ๋ณด๋ณดํธ์ ยท `ftc` ๊ณต์ ๊ฑฐ๋์ ยท `nlrc` ๋
ธ๋์ ยท `nhrck` ๊ตญ๊ฐ์ธ๊ถ์ โฆ |
| ํน๋ณํ์ ์ฌํ | 4 | `ttSpecialDecc` ์กฐ์ธ์ฌํ์ ยท `kmstSpecialDecc` ํด์์์ ์ฌํ์ โฆ |
| ๋ณํยท์์ | 3 | `licbyl` ๋ฒ๋ น ยท `admbyl` ํ์ ๊ท์น ยท `ordinbyl` ์์น๋ฒ๊ท |
| ์กฐ์ฝยท์ฉ์ด | 2 | `trty` ์กฐ์ฝ ยท `lstrm` ๋ฒ๋ น์ฉ์ด |
| ๊ทธ ๋ฐ | 1 | `baiPvcs` ๊ฐ์ฌ์ ์ฌ์ ์ปจ์คํ
|
์ ์ฒด ๋ชฉ๋ก๊ณผ ๊ฐ๋๋ณ ์ค์ธก ์คํค๋ง๋ `law targets` / `law_targets`,
๋ฌด์์ด ์๋์ง์ ์ง๋๋ [docs/DRF_CATALOG.md](docs/DRF_CATALOG.md).
**๋ณธ๋ฌธ์ด XML ๋ก ์ค์ง ์๋ 4์ข
**: `licbyl`ยท`ordinbyl`(๋ณํยท์์์ ํ์ผ โ ๋ชฉ๋ก์
`๋ณํ์์ํ์ผ๋งํฌ`ยท`๋ณํ์์PDFํ์ผ๋งํฌ` ๊ฐ ์๋ฌธ) ยท `moefCgmExpc`ยท`ntsCgmExpc`(๋ชฉ๋ก๋ง).
ํธ์ถ ์ ์ ๋ง๊ณ ๋์ ๋ฌด์์ ๋ณด๋ผ๊ณ ์๋ ค ์ค๋ค.
`lsHistory`(๋ฒ๋ น ์ฐํ)ยท`couseLs`(๊ด๋ จ๋ฒ๋ น)๋ `type=XML` ์ ๋ฌด์ํ๊ณ HTML ์ ๋๋ ค์ฃผ๋ฏ๋ก
์ด ์๋ฒ๋ ๋ค๋ฃจ์ง ์๋๋ค. ํธ์ถํ๋ฉด ๊ทธ ์ฌ์ค์ ์๋ ค ์ค๋ค.
## ์์ ๋ ๊ฒ (์ ๋ถ ์ค์ธก)
- ๐ด **๋ชจ๋ ์คํจ๊ฐ HTTP 200 ์ด๋ค.** ์๋ target ์ 0๋ฐ์ดํธ, ์๋ชป๋ `OC` ๋ `<Response>`,
์๋ ์๋ณ์๋ `<Law>์ผ์นํ๋ โฆ ์์ต๋๋ค</Law>`. ์ํ์ฝ๋๋ก๋ ์๋ฌด๊ฒ๋ ์ ์ ์๋ค.
- ๐ด **`query` ๋ฅผ ๋นผ๋ฉด ์ ์ฒด ์นดํ๋ก๊ทธ๊ฐ ์จ๋ค** โ ์ค๋ฅ๊ฐ ์๋๋ค(ํํ๋ฒ๋ น 5,614๊ฑด).
์ด ์๋ฒ๋ ๋น ๊ฒ์์ด๋ฅผ ๊ฑฐ๋ถํ๋ค.
- ๐ด **ํ๋ก ๋ณธ๋ฌธ์ ๋ฐ์ดํฐ์ถ์ฒ์ ๋ฐ๋ผ ์๋ค.** `๋ฐ์ดํฐ์ถ์ฒ๋ช
=๋๋ฒ์` ์ ๋ณธ๋ฌธ์ด ์ค๊ณ ,
`๊ตญ์ธ๋ฒ๋ น์ ๋ณด์์คํ
` ์ ๋ชฉ๋ก์๋ง ์๊ณ ๋ณธ๋ฌธ ์กฐํ์ "์ผ์นํ๋ ํ๋ก๊ฐ ์์ต๋๋ค" ๊ฐ ์จ๋ค.
๊ฒฐ์์ผ๋ก ๊ธฐ๋กํ๊ณ ๋์ด๊ฐ ์ผ์ด์ง ์ค๋ฅ๊ฐ ์๋๋ค.
- `display` ์ํ์ 500(1000์ ์์ฒญํ๋ฉด 500์ผ๋ก ๊น์ด๊ณ `numOfRows` ์ ์ ์งํ๊ฒ ์์ฝ๋๋ค).
- `page` ์๋ ํ๋ ์ํ์ด ์๋ค โ `totalCnt` ์ ๋์ ํ์ํ ์ ์๋ค.
- ๊ฐ๋๋ง๋ค ๋ฃจํธ ํ๊ทธยท๋ ์ฝ๋ ํ๊ทธยท์๋ณ์ ํ๋ผ๋ฏธํฐ๊ฐ **์ ๋ถ ๋ค๋ฅด๊ณ ์ด๋ฆ์์ ์ ์ถํ ์ ์๋ค**.
์ ์ ์ค์ธก 62์ข
์ค **45์ข
์ด ์ ์ด๋ฆ์ด ์๋ ๋ ์ฝ๋ ํ๊ทธ**๋ฅผ ์ด๋ค(๋ถ์ฒ ํด์ 39์ข
์ ์ ๋ถ
`<cgmExpc>`, `ordin`ยท`lsStmd` ๋ `<law>`, `school` ์ `<admrul>`). ์๋ณ์ ํ๋ผ๋ฏธํฐ๋
`ID`/`MST` ๋ง์ด ์๋๋ค โ `lstrm` ์ `trmSeqs`.
- โ ๏ธ **`totalCnt=0` ์ target ์ด ๋ฌดํจ๋ผ๋ ๋ป์ด ์๋๋ค** โ ๊ฒ์์ด๊ฐ ์ ๋ง์ ๊ฒ์ผ ๋ฟ์ด๋ค.
์์ธํ ๊ทผ๊ฑฐ์ ์ฌํ ๋ฐฉ๋ฒ์ [docs/LAW_API_GUIDE.md](docs/LAW_API_GUIDE.md).
## ๋ผ์ด์ ์ค
MIT
TDQS
Scored across 6 tools
Each tool has a distinct role: connectivity check, schema map, single-target search, document body retrieval, bulk collection, and citation mapping. Overlapping actions such as search vs. collect are clearly differentiated by single-result versus multi-axis file output.
All tools follow a uniform law_ prefix with short, lowercase, predictable names. Some names are nouns and some are verbs, but the pattern is consistent and easy to infer.
Six tools cover the full workflow without redundancy: verify, discover, search, retrieve, collect, and cite. The count is well within the ideal range for a focused API wrapper.
The set supports a complete read-only workflow for legal documents: discovering targets, querying, fetching full bodies, bulk collection, and citation export. No obvious missing operation would prevent an agent from accomplishing the core domain tasks.