Skip to main content
Glama
Legal Search MCP

Legal Search MCP

by woongaro

Legal Search MCP

한국 법제처 법령정보 API를 활용한 MCP(Model Context Protocol) 서버입니다. AI 에이전트가 한국 법령을 검색하고 조문 내용을 조회할 수 있도록 지원합니다.

기능

🔍 search-law

법령을 검색합니다.

파라미터

타입

필수

설명

query

string

✅

검색 키워드 (예: "자동차관리법", "개인정보")

searchType

enum

-

name: 법령명 검색(기본), content: 본문 검색

lawStatus

enum

-

current: 현행, scheduled: 시행예정, history: 연혁, all: 전체

display

number

-

결과 개수 (기본: 20, 최대: 100)

page

number

-

페이지 번호 (기본: 1)

sort

enum

-

lasc/ldes: 법령명순, dasc/ddes: 공포일순, efasc/efdes: 시행일순

org

string

-

소관부처 코드 (예: "1613000"=국토교통부)

📖 get-law-detail

법령의 상세 내용(조문)을 조회합니다.

파라미터

타입

필수

설명

lawId

string

⚡

법령 ID (search-law 결과에서 확인)

mst

string

⚡

법령 마스터 번호

efYd

string

조건부

시행일자 (mst 사용시 필수, 형식: YYYYMMDD)

articleNumber

string

-

특정 조문 번호 (6자리: 조번호4자리+가지번호2자리)

⚡ lawId 또는 mst 중 하나는 반드시 입력해야 합니다.

Related MCP server: e-Gov Law MCP Server

설치

# 의존성 설치
npm install

# 빌드
npm run build

설정

환경 변수

.env.example을 .env로 복사하고 법제처 API 인증 정보를 설정합니다.

cp .env.example .env
# 법제처 API OC 값 (이메일 ID 부분)
# 예: g4c@korea.kr → LAW_API_OC=g4c
# 주의: https://open.law.go.kr 에서 IP 등록이 완료된 환경에서만 작동합니다.
LAW_API_OC=your_email_id_here

⚠️ 중요: 법제처 API는 IP 기반 접근 제어를 수행합니다. API를 호출하는 서버(또는 로컬 PC)의 IP가 국가법령정보센터 Open API 관리 페이지에 등록되어 있어야 합니다.> 💡 법제처 API는 별도 인증 키 없이 이메일 ID(OC)만 입력하면 사용할 수 있습니다.

연결 및 기능 검증

설정 후 아래 명령어로 API 연결과 기능이 정상 작동하는지 확인할 수 있습니다.

npm test

MCP 클라이언트 설정

Cursor / Claude Desktop

~/.cursor/mcp.json 또는 claude_desktop_config.json에 추가:

{
  "mcpServers": {
    "legal-search": {
      "command": "node",
      "args": ["/path/to/legal-search-mcp/dist/index.js"],
      "env": {
        "LAW_API_OC": "your_email_id"
      }
    }
  }
}

npx로 실행 (개발용)

npx @modelcontextprotocol/inspector dist/index.js

사용 예시

법령 검색

"자동차관리법" 검색해줘
국토교통부 소관 법령 중 "도로"가 포함된 법령 찾아줘

법령 상세 조회

자동차관리법(법령ID: 1747)의 전체 내용 보여줘
자동차관리법 제3조 내용만 조회해줘

개발

# 개발 모드 (TypeScript 감시)
npm run dev

# MCP Inspector로 테스트
npm run inspector

라이선스

MIT License

참고

배포 및 공유 방법

1. GitHub에 배포하기 (소스 코드 공유)

소스 코드를 GitHub에 올려 다른 사람들과 공유하거나, 다른 컴퓨터에서 git clone하여 사용할 수 있습니다.

  1. GitHub에서 새 레포지토리(Repository) 생성 (예: legal-search-mcp)

  2. 로컬 프로젝트를 GitHub에 연결 및 푸시:

# git 초기화 (이미 되어 있다면 생략)
git init

# 파일 추가 및 커밋
git add .
git commit -m "Initial commit"

# 원격 저장소 연결 (URL은 본인의 레포지토리 주소로 변경)
git remote add origin https://github.com/YOUR_USERNAME/legal-search-mcp.git
git branch -M main
git push -u origin main

2. NPM에 배포하기 (패키지 공유)

NPM에 배포하면 npx 명령어로 누구나 설치 없이 바로 실행할 수 있습니다. (NPM 계정 필요)

  1. package.json의 name이 유니크한지 확인 (이미 누가 쓰고 있다면 변경 필요)

  2. NPM 로그인 및 게시:

# NPM 로그인
npm login

# 패키지 게시
npm publish --access public

사용법 (배포 후):

npx your-package-name

(물론 .env 설정이나 환경 변수 주입은 필요합니다.)

3. Docker로 실행하기 (권장)

Docker를 사용하면 환경 설정 없이 바로 실행할 수 있습니다.

1. 이미지 빌드

docker build -t legal-search-mcp .

2. 실행 (테스트)

docker run -e LAW_API_OC="본인_OC_코드" legal-search-mcp

3. Claude Desktop 설정 (Docker 사용)

claude_desktop_config.json에 다음과 같이 추가합니다:

{
  "mcpServers": {
    "legal-search-docker": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "LAW_API_OC=본인_OC_코드",
        "legal-search-mcp"
      ]
    }
  }
}

4. 상시 실행 (PM2 사용)

로컬 컴퓨터에서 서버를 끄지 않고 계속 실행해두고 싶다면 pm2를 사용할 수 있습니다.

npm install -g pm2
npm run build
pm2 start dist/index.js --name "legal-search-mcp"

Available Tools

2 tools
get-law-detailB

특정 법령의 상세 내용(조문)을 조회합니다. 법령 ID 또는 법령 마스터 번호로 조회할 수 있습니다.

Inputs: mst, efYd, lawId, articleNumber.

search-lawB

한국 법령을 검색합니다. 법령명이나 본문 내용으로 검색할 수 있습니다.

Inputs: query (required), org, page, sort, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 2 tools

    Disambiguation5/5

    search-law and get-law-detail have clearly distinct roles: the former finds laws by query, the latter retrieves specific articles by ID. No overlap in functionality.

    Naming Consistency5/5

    Both tool names follow a consistent verb_noun pattern with hyphen separation: search-law and get-law-detail. Predictable and readable.

    Tool Count3/5

    Only two tools, which is on the thin side. While they cover the essential search-and-retrieve workflow, the small number may limit broader legal research tasks.

    Completeness5/5

    For a legal search server, the two tools provide a complete workflow: search for relevant statutes and retrieve their detailed provisions. No evident dead ends.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      MCP server for the Korean National Assembly Open API, enabling querying of bills, members, votes, committees, and more via natural language.
      20
      50 PyPI
      1
      Apache 2.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      This MCP server integrates South Korea's national law information, building registers from MOLIT, and KOSIS statistics for housing development research. It enables searching laws, retrieving building details, and accessing statistical data through natural language.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables searching and retrieving Korean statutes, precedents, and constitutional court decisions via MCP, using the National Law Information Center API.
      2
      MIT