Skip to main content
Glama

MCP Badge Python FastAPI License CI

⚖️ LexGuard MCP (법실마리)

An MCP server that connects Korean statutes, precedents, and statutory interpretations in a form that AI can easily understand

Based on official data from the National Law Information Center (Open Law), it provides statutes, articles, precedents, statutory interpretations, administrative appeals, and Constitutional Court decisions through a single question flow.

Quick Start (5 minutes)

  1. Get an API key — Free issuance at open.law.go.kr. You must register your own IP when applying (see API Key Issuance below)

  2. Run the server

    git clone https://github.com/SeoNaRu/lexguard-mcp
    cd lexguard-mcp
    cp .env.example .env        # LAW_API_KEY=발급키 설정
    docker compose up --build   # 또는: pip install -r requirements.txt && python -m src.main
  3. Connect a client — MCP URL: http://localhost:9099/mcp

Static metadata for marketplaces and crawlers: mcp/manifest.json · Prompt index prompts/ · Resource URI guide resources/README.md · Cursor development skill .cursor/skills/lexguard-mcp-dev/SKILL.md


Why LexGuard?

The law often feels distant and difficult whenever you need it. High costs, unfamiliar terms, and a structure where you don't know where to start.

LexGuard MCP (LexGuard) started from this problem.

  • Users ask questions in human language

  • The AI analyzes the intent of the question

  • Then provides clues based on official statute and precedent data

It does not replace judgment or legal advice. Rather, it aims to make the moment you first encounter the law less difficult.


Related MCP server: LexLink

Core Features

Feature

Description

18 MCP tools

Covers everything from integrated QA to ministry-specific interpretations, legislative history, attached tables/forms, and linked searches

Integrated legal QA

Parallel comprehensive search across statutes, precedents, interpretations, administrative appeals, and Constitutional Court decisions

Precise article lookup

Directly look up a specific provision by statute name + article number

Document/contract analysis

Paste a contract or terms and conditions to automatically detect legal issues by clause

Direct precedent number detection

Automatically recognizes formats like 2023다12345, 2021헌마123 and searches immediately

Automatic domain classification

10 legal domains including labor, personal information, real estate, consumer, tax, and finance

Natural language time conditions

Automatically parses natural language time expressions such as "last 3 years" or "after 2023"

Reranker pipeline

Reorders search results by query relevance (BM25 + Keyword Hybrid)

Parallel search

Minimizes response time with concurrent multi-API calls based on asyncio.gather

Rate Limiting

600 req/min per IP limit (default, adjustable via LEXGUARD_MCP_RATE_LIMIT)


MCP Tools

This is the single entry point for all legal questions. With one question, it searches statutes, precedents, interpretations, and committee decisions in parallel and synthesizes the results. For searches limited to a specific source (precedents only, interpretations only, etc.), you can consider the dedicated tools.

Capabilities

  • Automatic classification across 10 domains

  • Multi-intent detection and priority ordering

  • Parallel search across statutes → precedents → interpretations → committees

  • Natural language time condition filtering (automatic date_from / date_to conversion)

Input Schema

Parameter

Type

Required

Description

query

string

The user's legal question

max_results_per_type

integer

Maximum results per type (default: 3, max: 10)

Example Prompts

프리랜서인데 근로자성 인정된 판례 있나요?
최근 3년 부당해고 판례 알려줘
개인정보 유출됐는데 법적으로 어떻게 되나요?
2023다12345 판례 찾아줘

law_article_tool — Precise statute article lookup

Directly looks up a specific provision when you know the statute name and article number. If legal_qa_tool is "search," this tool is "precise lookup."

Input Schema

Parameter

Type

Required

Description

law_name

string

Required

Statute name (e.g., Labor Standards Act, Civil Act)

article_number

string

Article number (e.g., 50, 2). If omitted, returns the statute overview

hang

string

Paragraph number (e.g., 1, 2)

ho

string

Subparagraph number (e.g., 1, 2)

mok

string

Item number (e.g., , )

Example Prompts

근로기준법 제50조 내용 알려줘
민법 제750조 3항이 뭐야?
개인정보보호법 제17조

law_comparison_tool — Old/new, history, and three-way comparison of statutes

Looks up old/new law comparison, legislative history, and three-way comparison results based on the statute name. Use law_article_tool for direct article text lookup and legal_qa_tool for general questions.

Input Schema

Parameter

Type

Required

Description

law_name

string

Required

Statute name (e.g., Criminal Act, Civil Act)

compare_type

string

신구법 · 연혁 · 3단비교 (default: 신구법, uses the corresponding value if the question mentions history/three-way comparison/old-new)

Example Prompts

XPP4


document_issue_tool — Contract and terms analysis

Paste a document to extract legal issues by clause and automatically search related statutes and precedents.

Input Schema

Parameter

Type

Required

Description

document_text

string

Required

Full text of the contract or terms

auto_search

boolean

Whether to automatically search statutes by clause (default: true)

max_clauses

integer

Maximum number of clauses to analyze (default: 3)

max_results_per_type

integer

Maximum results per type (default: 3)

Supported Document Types

  • labor — Employment contract / service contract

  • lease — Lease agreement

  • terms — Terms of use

Example Prompts

이 프리랜서 계약서 문제 있는지 봐줘
아래 임대차 계약서에서 불리한 조항 찾아줘

health — Server status check

Checks whether the MCP server is running, the API key configuration status, and environment variables.


Dedicated search tools (source-limited)

Use these when you want to find only specific data instead of the integrated search (legal_qa_tool).

Tool name

Purpose

Main inputs

precedent_lookup_tool

Precedents only

keyword or case_number

interpretation_tool

Statutory interpretations, authoritative interpretations, etc.

query, optional agency

administrative_appeal_tool

Administrative appeal rulings only

query, optional period

constitutional_decision_tool

Constitutional Court decisions only

query, optional period

committee_decision_tool

Decisions of independent committees, etc.

committee_type, query

special_administrative_appeal_tool

Special Administrative Appeals Tribunal rulings

tribunal_type, query

local_ordinance_tool

Local legislation (ordinances, etc.) only

At least one of query or local_government

administrative_rule_tool

Administrative rules only

At least one of query or agency


Extended lookup tools

Use these when you need in-depth lookups such as supplementary statute information, history, forms, and links.

ministry_interpretation_tool — Per-ministry statutory interpretation

Searches the dedicated statutory interpretation (Q&A reply) database of 39 ministries. If interpretation_tool is an integrated search, this tool directly looks up only the interpretations of a specific ministry.

Parameter

Type

Description

query

string

Search keyword

agency

string

Ministry name (e.g., 고용노동부, 국세청, 보건복지부)

page / per_page

integer

Pagination settings

Supported ministries: Ministry of Employment and Labor, Ministry of Land, Infrastructure and Transport, Ministry of Economy and Finance, National Tax Service, Korea Customs Service, Ministry of Education, Ministry of Health and Welfare, Ministry of Justice, Ministry of Government Legislation, Ministry of Food and Drug Safety, National Police Agency, National Fire Agency, Korea Coast Guard, and 39 other agencies


law_history_tool — Statute and article change history

Tracks when and how a statute was amended.

search_type value

Description

law_change

List of statute change history

article_change

List of article amendment history by date

article_detail

Details of amendment history for a specific article (law_id required)

Example Prompts

근로기준법 개정 이력 알려줘
개인정보보호법 제17조 조문 개정 내역

law_info_tool — Supplementary statute information

Looks up supplementary information such as English statutes, international treaties, statute structure diagrams, at-a-glance summaries, and abbreviations.

info_type value

Description

english_law

English statutes

treaty

International treaties

structure

Statute structure diagram

oneview

At-a-glance view (statute summary)

abbreviation

Statute name abbreviations

deleted

History of deleted statutes and articles


law_form_tool — Attached table/form search

Searches attached tables and forms of statutes, administrative rules, and local legislation by form name or related statute name.

form_type value

Description

law

Attached tables/forms of statutes

admin_rule

Attached tables/forms of administrative rules

ordinance

Attached tables/forms of local legislation


Checks the list of ordinances linked to a specific statute, and the linkage status by competent ministry and local government.

link_type value

Description

law_to_ordinance

List of statute-local legislation links

ordinance_articles

List of ordinance articles by linked statute

by_department

List of linked statutes by competent ministry

linked_ordinance

List of linked ordinances

law_linked_ordinance

List of ordinances by linked statute

by_region

List of linked ordinances by local government


MCP Prompts

Supports the prompts/list and prompts/get endpoints.

Prompt name

Description

legal_basis_answer

Requests an answer that includes relevant statute article numbers and precedent summaries

precedent_summary

Summarizes a precedent into facts / issues / holding

contract_risk_check

General contract and terms risk clause check. For high-density labor/service contract review, use labor_contract_review or document_issue_tool (when the document is classified as labor).

labor_contract_review

Reviews labor/service contracts clause by clause, including article references, risk levels, and suggested revisions (Type B)

legal_qa

Explains a specific situation from a legal perspective


MCP Resources

Supports the resources/list and resources/read endpoints.

URI Scheme

Format

Description

Example

law://{법령명}

Look up statute text

law://근로기준법

case://{검색어}

Precedent search (top 5 results)

case://부당해고

interpret://{검색어}

Statutory interpretation search (top 5 results)

interpret://근로자성

Major statutes such as the Labor Standards Act, Civil Act, Criminal Act, Personal Information Protection Act, Commercial Act, State Public Officials Act, and Administrative Litigation Act can be looked up immediately.


Installation

Method 1. Local (Python)

git clone https://github.com/SeoNaRu/lexguard-mcp
cd lexguard-mcp
pip install -r requirements.txt
cp .env.example .env   # LAW_API_KEY 설정
python -m src.main
git clone https://github.com/SeoNaRu/lexguard-mcp
cd lexguard-mcp
cp .env.example .env   # LAW_API_KEY 편집
docker compose up --build

Browser/client MCP URL: http://localhost:9099/mcp · Health: http://localhost:9099/health

Method 3. Docker (run only)

docker build -t lexguard-mcp .
docker run -p 9099:9099 -e LAW_API_KEY=your_key lexguard-mcp

Client connection

When the server is running locally, the MCP URL is http://localhost:9099/mcp.

Cursor (.cursor/mcp.json) — Same as the examples/cursor-mcp.local.json file:

{
  "mcpServers": {
    "lexguard-mcp": {
      "url": "http://localhost:9099/mcp"
    }
  }
}

Claude Desktop (claude_desktop_config.json) — Same as the examples/claude-desktop-mcp.local.json file. Claude Desktop does not directly support local HTTP URLs, so use the mcp-remote bridge (requires Node.js):

{
  "mcpServers": {
    "lexguard-mcp": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "http://localhost:9099/mcp"]
    }
  }
}

claude.ai web connector note: The web connector requires a public HTTPS URL, so it cannot connect to a locally running server. We recommend using Claude Desktop or Cursor. If you must use it on the web, deploy it on your own server (static IP + HTTPS) and register that IP with open.law.go.kr.

API Key issuance (required)

You need a National Law Information Center Open API key. Both issuance and usage are free.

  1. Sign up at https://open.law.go.kr

  2. Apply for OPEN API usage — you must register the IP or domain of the server (your PC) that will send requests. law.go.kr only allows requests from registered IPs.

  3. Set LAW_API_KEY=your-issued-key in .env

Dynamic IP caution: Regular home connections may have changing IPs. If you get a "사용자 정보 검증에 실패하였습니다" error, re-register your current IP at [open.law.go.kr → API인증키관리].

DRF scheme selection

lexguard-mcp keeps the host/path of the National Law Information Center DRF URL fixed, and only the scheme can be selected via .env.

LAW_GO_KR_DRF_SCHEME=https
  • Allowed values: http, https

  • Default: https

  • In restricted corporate networks/firewall environments, you may need the http://www.law.go.kr/DRF/... path as shown in the official guide examples.

This setting is an option to adjust the latent URL-generation problem, where hardcoded https could be accidentally hidden in normal environments, per operating environment.


Architecture

Client (Cursor / Claude)
    │ JSON-RPC 2.0 over SSE
    ▼
FastAPI  (/mcp POST)
    │ Rate Limiting (slowapi, 600 req/min/IP 기본값)
    ▼
MCP Routes  (tools/call · prompts/get · resources/read)
    │
    ▼
Services  (SmartSearchService · SituationGuidanceService)
    │ asyncio.gather (병렬 멀티 API 호출)
    ▼
Repositories  (Law · Precedent · Interpretation · Appeal · Constitutional …)
    │ httpx (동기/비동기 HTTP 클라이언트)
    │ TTLCache (검색 결과 30분 / 실패 5분)
    │ Exponential Backoff Retry
    ▼
국가법령정보센터 DRF API  (159개 엔트리 / 88개 unique target)

Search pipeline

질문 입력
    → 판례 번호 패턴 조기 감지 (2023다12345 / 2021헌마123)
    → 도메인 분류 + 의도(Intent) 분석
    → 시간 조건 파싱
    → asyncio.gather 병렬 API 호출
    → Reranker (BM25 + Keyword Hybrid 재정렬)
    → 응답 포매팅

Main technology stackMCP Badge Python FastAPI License CI

⚖️ LexGuard MCP (법실마리)

An MCP server that connects Korean statutes, precedents, and statutory interpretations in a form that AI can easily understand

Based on official data from the National Law Information Center (Open Law), it provides statutes, articles, precedents, statutory interpretations, administrative appeals, and Constitutional Court decisions through a single question flow.

Quick Start (5 minutes)

  1. Get an API key — Free issuance at open.law.go.kr. You must register your own IP when applying (see API Key Issuance below)

  2. Run the server

    git clone https://github.com/SeoNaRu/lexguard-mcp
    cd lexguard-mcp
    cp .env.example .env        # LAW_API_KEY=발급키 설정
    docker compose up --build   # 또는: pip install -r requirements.txt && python -m src.main
  3. Connect a client — MCP URL: http://localhost:9099/mcp

Static metadata for marketplaces and crawlers: mcp/manifest.json · Prompt index prompts/ · Resource URI guide resources/README.md · Cursor development skill .cursor/skills/lexguard-mcp-dev/SKILL.md


Why LexGuard?

The law often feels distant and difficult whenever you need it. High costs, unfamiliar terms, and a structure where you don't know where to start.

LexGuard MCP (법실제) started from this problem.

  • Users ask questions in human language

  • The AI analyzes the intent of the question

  • Then provides clues based on official statute and precedent data

It does not replace judgment or legal advice. Rather, it aims to make the moment you first encounter the law less difficult.


Core Features

Feature

Description

18 MCP tools

Covers everything from integrated QA to per-ministry interpretations, statute history, attached tables/forms, and linked searches

Integrated legal QA

Parallel comprehensive search across statutes, precedents, interpretations, administrative appeals, and Constitutional Court decisions

Precise article lookup

Directly look up a specific provision by statute name + article number

Document/contract analysis

Paste a contract or terms and conditions to automatically detect legal issues by clause

Direct precedent number detection

Automatically recognizes formats like 2023다12345, 2021헌마123 and searches immediately

Automatic domain classification

10 legal domains including labor, personal information, real estate, consumer, tax, and finance

Natural language time conditions

Automatically parses natural language time expressions such as "last 3 years" or "after 2023"

Reranker pipeline

Reorders search results by query relevance (BM25 + Keyword Hybrid)

Parallel search

Minimizes response time with concurrent multi-API calls based on asyncio.gather

Rate Limiting

600 req/min per IP limit (default, adjustable via LEXGUARD_MCP_RATE_LIMIT)


MCP Tools

This is the single entry point for all legal questions. With one question, it searches statutes, precedents, interpretations, and committee decisions in parallel and synthesizes the results. For searches limited to a specific source (precedents only, interpretations only, etc.), you can review the dedicated tools.

Capabilities

  • Automatic classification across 10 domains

  • Multi-intent detection and priority sorting

  • Parallel search across statutes → precedents → interpretations → committee decisions

  • Natural language time condition filtering (automatic date_from / date_to conversion)

Input Schema

Parameter

Type

Required

Description

query

string

The user's legal question

max_results_per_type

integer

Maximum results per type (default: 3, max: 10)

Example Prompts

프리랜서인데 근로자성 인정된 판례 있나요?
최근 3년 부당해고 판례 알려줘
개인정보 유출됐는데 법적으로 어떻게 되나요?
2023다12345 판례 찾아줘

law_article_tool — Precise statute article lookup

Directly looks up a specific provision when you know the statute name and article number. If legal_qa_tool is "search," this tool is "precise lookup."

Input Schema

Parameter

Type

Required

Description

law_name

string

Statute name (e.g., Labor Standards Act, Civil Act)

article_number

string

Article number (e.g., 50, 2). If omitted, returns the statute overview

hang

string

Paragraph number (e.g., 1, 2)

ho

string

Subparagraph number (e.g., 1, 2)

mok

string

Item number (e.g., , )

Example Prompts

근로기준법 제50조 내용 알려줘
민법 제750조 3항이 뭐야?
개인정보보호법 제17조

law_comparison_tool — Old/new, history, and three-way comparison of statutes

Provides old/new comparison, legislative history, and three-way comparison results based on the statute name. Use law_article_tool for direct article text lookup and legal_qa_tool for general questions.

Input Schema

Parameter

Type

Required

Description

law_name

string

Statute name (e.g., Criminal Act, Civil Act)

compare_type

string

신구법 · 연혁 · 3단비교 (default: 신구법, uses the corresponding value if the question mentions history/three-way comparison/old-new)

Example Prompts

근로기준법 신구법 비교 보여줘
민법 연혁 조회

document_issue_tool — Contract and terms analysis

Paste a document to extract legal issues by clause and automatically search related statutes and precedents.

Input Schema

Parameter

Type

Required

Description

document_text

string

Full text of the contract or terms

auto_search

boolean

Whether to automatically search statutes by clause (default: true)

max_clauses

integer

Maximum number of clauses to analyze (default: 3)

max_results_per_type

integer

Maximum results per type (default: 3)

Supported Document Types

  • labor — Employment contract / service contract

  • lease — Lease agreement

  • terms — Terms of use

Example Prompts

이 프리랜서 계약서 문제 있는지 봐줘
아래 임대차 계약서에서 불리한 조항 찾아줘

health — Server status check

Checks whether the MCP server is running, the API key configuration status, and environment variables.


Dedicated search tools (source-limited)

Use these when you want to find only specific data instead of the integrated search (legal_qa_tool).

Tool name

Purpose

Main inputs

precedent_lookup_tool

Precedents only

keyword or case_number

interpretation_tool

Statutory interpretations, authoritative interpretations, etc.

query, optional agency

administrative_appeal_tool

Administrative appeal rulings only

query, optional period

constitutional_decision_tool

Constitutional Court decisions only

query, optional period

committee_decision_tool

Decisions of independent committees, etc.

committee_type, query

special_administrative_appeal_tool

Special Administrative Appeals Tribunal rulings

tribunal_type, query

local_ordinance_tool

Local legislation (ordinances, etc.) only

At least one of query or local_government

administrative_rule_tool

Administrative rules only

At least one of query or agency


Extended lookup tools

Use these when you need in-depth lookups such as supplementary statute information, history, forms, and links.

ministry_interpretation_tool — Per-ministry statutory interpretation

Searches the dedicated statutory interpretation (Q&A reply) database of 39 ministries. If interpretation_tool is an integrated search, this tool directly looks up only the interpretations of a specific ministry.

Parameter

Type

Description

query

string

Search keyword

agency

string

Ministry name (e.g., 고용노동부, 국세청, 보건복지부)

page / per_page

integer

Pagination settings

Supported ministries: Ministry of Employment and Labor, Ministry of Land, Infrastructure and Transport, Ministry of Economy and Finance, National Tax Service, Korea Customs Service, Ministry of Education, Ministry of Health and Welfare, Ministry of Justice, Ministry of Government Legislation, Ministry of Food and Drug Safety, National Police Agency, National Fire Agency, Korea Coast Guard, and 39 other agencies


law_history_tool — Statute and article change history

Tracks when and how a statute was amended.

search_type value

Description

law_change

List of statute change history

article_change

List of article amendment history by date

article_detail

Details of amendment history for a specific article (law_id required)

Example Prompts

근로기준법 개정 이력 알려줘
개인정보보호법 제17조 조문 개정 내역

law_info_tool — Supplementary statute information

Provides supplementary information such as English statutes, international treaties, statute structure diagrams, at-a-glance views, and abbreviations.

info_type value

Description

english_law

English statutes

treaty

International treaties

structure

Statute structure diagram

oneview

At-a-glance view (statute summary)

abbreviation

Statute name abbreviations

deleted

History of deleted statutes and articles


law_form_tool — Attached table and form search

Searches attached tables and forms of statutes, administrative rules, and local legislation by form name or related statute name.

form_type value

Description

law

Attached tables/forms of statutes

admin_rule

Attached tables/forms of administrative rules

ordinance

Attached tables/forms of local legislation


Checks the list of ordinances linked to a specific statute, and the linkage status by competent ministry and local government.

link_type value

Description

law_to_ordinance

List of statute-local legislation links

ordinance_articles

List of ordinance articles by linked statute

by_department

List of linked statutes by competent ministry

linked_ordinance

List of linked ordinances

law_linked_ordinance

List of ordinances by linked statute

by_region

List of linked ordinances by local government


MCP Prompts

Supports the prompts/list and prompts/get endpoints.

Prompt name

Description

legal_basis_answer

Requests an answer that includes relevant statute article numbers and precedent summaries

precedent_summary

Summarizes a precedent into facts / issue / holding

contract_risk_check

General contract and terms risk clause check. For high-density labor/service contract review, use labor_contract_review or document_issue_tool (when the document is classified as labor).

labor_contract_review

Reviews labor/service contract clauses by clause, including article references, risk, and suggested revisions (Type B)

legal_qa

Explains a specific situation from a legal perspective


MCP Resources

Supports the resources/list and resources/read endpoints.

URI Scheme

Format

Description

Example

law://{법령명}

Look up statute text

law://근로기준법

case://{검색어}

Precedent search (top 5 results)

case://부당해고

interpret://{검색어}

Statutory interpretation search (top 5 results)

interpret://근로자성

Major statutes such as the Labor Standards Act, Civil Act, Criminal Act, Personal Information Protection Act, Commercial Act, State Public Officials Act, and Administrative Litigation Act can be looked up immediately.


Installation

Method 1. Local (Python)

git clone https://github.com/SeoNaRu/lexguard-mcp
cd lexguard-mcp
pip install -r requirements.txt
cp .env.example .env   # LAW_API_KEY 설정
python -m src.main
git clone https://github.com/SeoNaRu/lexguard-mcp
cd lexguard-mcp
cp .env.example .env   # LAW_API_KEY 편집
docker compose up --build

Browser/client MCP URL: http://localhost:9099/mcp · Health: http://localhost:9099/health

Method 3. Docker (run only)

docker build -t lexguard-mcp .
docker run -p 9099:9099 -e LAW_API_KEY=your_key lexguard-mcp

Client connection

When the server is running locally, the MCP URL is http://localhost:9099/mcp.

Cursor (.cursor/mcp.json) — Same as the examples/cursor-mcp.local.json file:

{
  "mcpServers": {
    "lexguard-mcp": {
      "url": "http://localhost:9099/mcp"
    }
  }
}

Claude Desktop (claude_desktop_config.json) — Same as the examples/claude-desktop-mcp.local.json file. Claude Desktop does not directly support local HTTP URLs, so use the mcp-remote bridge (requires Node.js):

{
  "mcpServers": {
    "lexguard-mcp": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "http://localhost:9099/mcp"]
    }
  }
}

claude.ai web connector guide: The web connector requires a public HTTPS URL, so it cannot connect to a locally running server. We recommend using Claude Desktop or Cursor. If you must use it on the web, deploy it on your own server (static IP + HTTPS) and register that IP with open.law.go.kr.

API Key Issuance (required)

A National Law Information Center Open API key is required. Both issuance and usage are free.

  1. Sign up at https://open.law.go.kr

  2. Apply for OPEN API usage — you must register the IP or domain of the server (your PC) that will send requests. law.go.kr only allows requests from registered IPs.

  3. Set LAW_API_KEY=your-issued-key in .env

Dynamic IP caution: Regular home internet connections may have changing IPs. If you get a "사용자 정보 검증에 실패하였습니다" error, re-register your current IP at [open.law.go.kr → API인증키관리].

DRF scheme selection

lexguard-mcp keeps the host/path of the National Law Information Center DRF URL fixed, and only the scheme can be selected via .env.

LAW_GO_KR_DRF_SCHEME=https
  • Allowed values: http, https

  • Default: https

  • In restricted corporate networks/firewall environments, you may need the http://www.law.go.kr/DRF/... path as shown in the official guide examples.

This setting is an option to adjust the latent URL-generation issue where hardcoded https could be accidentally hidden in normal environments, per operating environment.


Architecture

Client (Cursor / Claude)
    │ JSON-RPC 2.0 over SSE
    ▼
FastAPI  (/mcp POST)
    │ Rate Limiting (slowapi, 600 req/min/IP 기본값)
    ▼
MCP Routes  (tools/call · prompts/get · resources/read)
    │
    ▼
Services  (SmartSearchService · SituationGuidanceService)
    │ asyncio.gather (병렬 멀티 API 호출)
    ▼
Repositories  (Law · Precedent · Interpretation · Appeal · Constitutional …)
    │ httpx (동기/비동기 HTTP 클라이언트)
    │ TTLCache (검색 결과 30분 / 실패 5분)
    │ Exponential Backoff Retry
    ▼
국가법령정보센터 DRF API  (159개 엔트리 / 88개 unique target)

Search pipeline

질문 입력
    → 판례 번호 패턴 조기 감지 (2023다12345 / 2021헌마123)
    → 도메인 분류 + 의도(Intent) 분석
    → 시간 조건 파싱
    → asyncio.gather 병렬 API 호출
    → Reranker (BM25 + Keyword Hybrid 재정렬)
    → 응답 포매팅

Main technology stack

Category

Technologies Used

Web Framework

FastAPI + Uvicorn

MCP Transport

Streamable HTTP (SSE)

HTTP Client

httpx (sync + async)

Cache

cachetools TTLCache

Rate Limiting

slowapi

Search Ranking

BM25 + Keyword Hybrid Reranker

CI/CD

GitHub Actions (Python 3.11 / 3.12)

Testing

pytest + pytest-asyncio


Development

# 테스트 실행
pytest tests/ -v

# 린트
ruff check src/

# 로컬 서버 (자동 재로드)
RELOAD=true python -m src.main

License

The full text is provided in the LICENSE file in the repository root.

  • Usage: Same as MIT — research, personal, and commercial use, including modification, distribution, and resale, are permitted.

  • When selling or offering for a fee: If you sell this software on its own or include it in a product or service, you must include the copyright notice and this license text in materials delivered to end users (documentation, credits/license screens, package metadata, etc.).

This notice is a summary; the original LICENSE text takes precedence.


Contribution

Issues & PRs are always welcome. Legal domain data, search quality improvements, and new MCP tool ideas are all welcome.


LexGuard MCP — We help you find the thread of legal information. The law is difficult, but the first thread can be easy.

F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
20hResponse time
Release cycle
Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables searching and retrieving Korean legal information including laws, court precedents, legal interpretations, and local ordinances from the Korean National Law Information Center API with intelligent search ranking.
  • F
    license
    A
    quality
    B
    maintenance
    Enables AI systems to search, retrieve, and analyze Korean legal information from the National Law Information API (law.go.kr), including laws, administrative rules, English translations, and law-ordinance linkages.
    26
    1
  • F
    license
    Not graded
    quality
    D
    maintenance
    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.
    71
  • A
    license
    A
    quality
    D
    maintenance
    Enables users to search and retrieve South Korean statutes, precedents, and administrative rules via the National Law Information Center API. It supports deep legal chain analysis, legislative history tracking, and legal terminology lookups through natural language.
    10
    4
    MIT

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SeoNaRu/lexguard-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server