Skip to main content
Glama

MCP Badge Python FastAPI License CI

⚖️ LexGuard MCP (法律线索)

将韩国法律、判例、法律解释以 AI 易于理解的形式连接起来的 MCP 服务器

基于国家法律信息中心 (Open Law) 的官方数据,提供涵盖法律、条款、判例、法律解释、行政审判、宪法法院裁决的单一问答流程

快速连接 (复制粘贴)

仅使用远程 MCP 时,可以将以下 JSON 直接放入客户端配置中。

单行本地运行 (Docker): 在仓库根目录下执行 docker compose up --build,MCP URL 为 http://localhost:9099/mcp。(API 密钥: LAW_API_KEY=发放的密钥 docker compose up --build

市场/爬虫用静态元数据: mcp/manifest.json · 提示词索引 prompts/ · 资源 URI 指南 resources/README.md · Cursor 开发技能 .cursor/skills/lexguard-mcp-dev/SKILL.md


Why LexGuard?

法律在需要时总是显得遥远且晦涩。 高昂的成本、陌生的术语、不知从何查起的结构。

LexGuard MCP (法律线索) 正是从这个问题出发的。

  • 用户用人话提问

  • AI 分析提问意图后

  • 官方法律、判例数据为依据提供线索。

不代替判断或法律咨询。 目标仅仅是让初次接触法律的瞬间不再那么困难


Core Features

功能

说明

综合法律 QA

并行综合搜索法律、判例、法律解释、行政审判、宪法法院裁决

条款精确查询

通过法律名称 + 条款编号直接查询特定条款

文档/合同分析

仅需粘贴合同或条款,自动检测各条款的法律问题

判例编号自动检测

自动识别 2023다12345, 2021헌마123 格式并立即搜索

领域自动分类

劳动、个人信息、房地产、消费者、税务、金融等 13 个法律领域

自然语言时间条件

自动解析“最近 3 年”、“2023 年以后”等自然语言时间表达

Reranker 流水线

基于查询相关性 (BM25 + Keyword Hybrid) 对搜索结果进行重排序

并行搜索

基于 asyncio.gather 的多 API 同时调用,最小化响应时间

速率限制

每个 IP 限制 60 req/min,防止滥用


MCP Tools

所有法律问题的单一入口。通过一个问题并行搜索并综合法律、判例、解释、委员会决定。若需限定来源的搜索(仅判例、仅解释等),可查看各专用工具。

Capabilities

  • 13 个领域自动分类

  • 多重意图 (Intent) 检测及优先级排序

  • 法律 → 判例 → 解释 → 委员会并行搜索

  • 自然语言时间条件过滤 (date_from / date_to 自动转换)

Input Schema

参数

类型

必填

说明

query

string

用户的法律问题

max_results_per_type

integer

每种类型的最大结果数 (默认: 3, 最大: 10)

Example Prompts

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

law_article_tool — 法律条款精确查询

在已知法律名称和条款编号时直接查询特定条款。如果说 legal_qa_tool 是“搜索”,那么该工具就是“精确查询”。

Input Schema

参数

类型

必填

说明

law_name

string

法律名称 (例如: 劳动基准法, 民法)

article_number

string

条款编号 (例如: 50, 2)。省略时返回法律概况

hang

string

项编号 (例如: 1, 2)

ho

string

号编号 (例如: 1, 2)

mok

string

目编号 (例如: , )

Example Prompts

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

law_comparison_tool — 法律新旧/沿革/三段对比

以法律名称为基准,查询新旧法对比、沿革、三段对比结果。查询条款原文请使用 law_article_tool,一般问题请使用 legal_qa_tool

Input Schema

参数

类型

必填

说明

law_name

string

法律名称 (例如: 刑法, 民法)

compare_type

string

新旧法 · 沿革 · 三段对比 (默认: 新旧法)

Example Prompts

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

document_issue_tool — 合同/条款分析

粘贴文档后,按条款提取法律问题,并自动搜索相关法律和判例。

Input Schema

参数

类型

必填

说明

document_text

string

合同/条款全文

auto_search

boolean

是否自动搜索各条款相关法律 (默认: true)

max_clauses

integer

分析的最大条款数 (默认: 3)

max_results_per_type

integer

每种类型的最大结果数 (默认: 3)

Supported Document Types

  • labor — 劳动合同 / 劳务合同

  • lease — 租赁合同

  • terms — 使用条款

Example Prompts

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

health — 服务器状态检查

检查 MCP 服务器运行状态、API Key 设置状态及环境变量。


专用搜索工具 (限定来源)

代替综合搜索 (legal_qa_tool),在仅查找特定数据时使用。

工具名称

用途

主要输入

precedent_lookup_tool

仅判例

keywordcase_number

interpretation_tool

法律解释/有权解释等

query, 可选 agency

administrative_appeal_tool

仅行政审判裁决

query, 可选期间

constitutional_decision_tool

仅宪法法院裁决

query, 可选期间

committee_decision_tool

独立委员会等决定书

committee_type, query

special_administrative_appeal_tool

特别行政审判院裁决

tribunal_type, query

local_ordinance_tool

仅自治法规(条例等)

querylocal_government 至少一项

administrative_rule_tool

仅行政规则

queryagency 至少一项


MCP Prompts

支持 prompts/listprompts/get 端点。

Prompt 名称

说明

legal_basis_answer

请求包含相关法律条款编号和判例要旨的回答

precedent_summary

将判例总结为事实关系 / 争议点 / 判断要旨

contract_risk_check

通用合同/条款风险检查。劳动/劳务专用高密度审查请使用 labor_contract_reviewdocument_issue_tool (当文档被分类为 labor 时)

labor_contract_review

劳动/劳务合同各条款的法律依据、风险度、修改方向审查 (B 类型)

legal_qa

针对特定情况的法律视角说明


MCP Resources

支持 resources/listresources/read 端点。

URI Scheme

格式

说明

示例

law://{法律名称}

查询法律正文

law://劳动基准法

case://{搜索词}

搜索判例 (前 5 条)

case://不当解雇

interpret://{搜索词}

搜索法律解释 (前 5 条)

interpret://劳动者性

可立即查询劳动基准法、民法、刑法、个人信息保护法、商法、国家公务员法、行政诉讼法等主要法律。


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

Method 2. Docker Compose (推荐 · 近乎单行)

git clone https://github.com/SeoNaRu/lexguard-mcp
cd lexguard-mcp
cp .env.example .env   # LAW_API_KEY 편집
docker compose up --build

浏览器/客户端 MCP URL: http://localhost:9099/mcp · 健康检查: http://localhost:9099/health

Method 3. Docker (仅 run)

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

Method 4. Remote MCP (托管 URL)

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "lexguard-mcp": {
      "url": "https://lexguard-mcp.onrender.com/mcp"
    }
  }
}

Cursor (.cursor/mcp.json)

examples/cursor-mcp.remote.json 文件相同:

{
  "mcpServers": {
    "lexguard-mcp": {
      "url": "https://lexguard-mcp.onrender.com/mcp"
    }
  }
}

API Key 发放

需要国家法律信息中心 Open API 密钥。

  1. 访问 https://open.law.go.kr 注册会员

  2. 申请 API 使用

  3. .env 中设置 LAW_API_KEY=发放的密钥


Architecture

Client (Cursor / Claude)
    │ JSON-RPC 2.0 over SSE
    ▼
FastAPI  (/mcp POST)
    │ Rate Limiting (slowapi, 60 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  (172개 엔드포인트)

搜索流水线

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

主要技术栈

区分

使用技术

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

全文遵循仓库根目录下的 LICENSE 文件。

  • 使用: 与 MIT 相同,允许研究、个人、商业用途,以及修改、分发、转售。

  • 销售/付费提供时: 若单独销售本软件,或将其包含在产品/服务中销售,必须在提供给最终用户的资料(文档、制作人员名单/许可界面、包元数据等)中包含版权声明和本许可声明

本指南为摘要,法律效力以 LICENSE 原文为准。


Contribution

Issues & PRs 随时欢迎。 欢迎法律领域数据、搜索质量改进、新的 MCP 工具创意。


LexGuard MCP — 为您寻找法律信息的线索。 法律虽难,但第一条线索可以变得简单。

-
security - not tested
F
license - not found
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

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