egov-law-mcp
@codeagentjp/egov-law-mcp
用于搜索日本法律并从 e-Gov 法令检索 获取条文文本的本地 stdio MCP 服务器。
本服务器不调用 LLM。它仅返回带有来源支持的法律数据和 e-Gov URL,以便您的 MCP 客户端(Claude Desktop、Claude Code、Cursor 或任何其他代理)能够引用原始来源。
本设计的选择参考了数字厅开源的 Lawsy-Custom-BQ(作为 2026-04-24 政府 AI “源内” OSS 发布的一部分)。设计说明请参阅 codeagent.jp。
为什么需要另一个 e-Gov MCP
npm 上已有另一位作者开发的 egov-law-mcp。本包在以下三个方面有所不同:
find_related_laws— 针对给定的基础法律名称查找施行令(施行令)和施行规则(施行规则)。Lawsy-Custom-BQ 在服务器端也有相同的步骤;这很有用,因为定义和授权规则通常存在于母法之外。每个工具结果中内置来源归属 — 每次响应都包含法律名称、法律 ID、条文编号和规范的 e-Gov URL,因此调用它的 LLM 无法丢弃引用。
单文件
.mjs,无需构建步骤 —bin/egov-law-mcp.mjs可直接在 Node 20+ 环境下运行。更易于审计,安装包更小。
Related MCP server: e-Gov Law MCP Server
状态
MVP 版本。API 接口有意保持精简:
search_laws— 按关键词搜索当前的日本法律。get_article— 通过法律 ID 或法律编号从法律中检索特定条文。get_law— 检索法律的基本元数据和文本预览。find_related_laws— 查找看起来与基础法律名称相关的施行令及施行规则。
要求
Node.js 20 或更高版本
可访问
https://laws.e-gov.go.jp的网络环境
安装
通过 npm 安装:
{
"mcpServers": {
"egov-law": {
"command": "npx",
"args": ["-y", "@codeagentjp/egov-law-mcp"]
}
}
}从源码开发安装:
git clone https://github.com/SHAYOUWORLD/egov-law-mcp.git
cd egov-law-mcp
node bin/egov-law-mcp.mjs{
"mcpServers": {
"egov-law": {
"command": "node",
"args": ["/absolute/path/to/egov-law-mcp/bin/egov-law-mcp.mjs"]
}
}
}工具
search_laws
搜索 e-Gov 法律列表。
{
"keyword": "個人情報",
"limit": 10
}get_article
检索条文文本。提供 lawId 或 lawNum。
{
"lawId": "503AC0000000035",
"article": "2"
}get_law
检索法律的基本元数据和纯文本预览。
{
"lawId": "503AC0000000035",
"previewChars": 3000
}find_related_laws
搜索名称与基础法律名称相关的法律,包括施行令及施行规则。
{
"lawName": "個人情報の保護に関する法律",
"limit": 10
}数据来源与归属
本包使用 e-Gov 法令检索 API:
e-Gov 法令检索: https://laws.e-gov.go.jp/
法律 API 文档: https://laws.e-gov.go.jp/docs/law-data-basic/8529371-law-api-v1/
MCP stdio 传输: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports
工具结果包含来源归属。当您发布或重新分发基于本包的输出时,请包含适当的 e-Gov 来源归属。
建议的归属方式:
出典: e-Gov法令検索(https://laws.e-gov.go.jp/)
安全说明
本包是一个法律参考工具,而非法律建议。请对照官方 e-Gov 页面核实重要的法律结论,并在必要时咨询合格的专业人士。
它不执行 shell 命令。
它仅向 stdout 写入 JSON-RPC 消息,仅向 stderr 记录日志。
它仅抓取 e-Gov 法令检索的端点。
相关内容
关于“源内” OSS 发布的背景: 政府AI「源内」のソースコードが商用利用可能な形で公開 (codeagent.jp)
参考实现: digital-go-jp/genai-ai-api/google-cloud/lawsy-custom-bq
许可证
MIT © codeagent.jp
Available Tools
4 toolsget_articleB
Retrieve a specific article from e-Gov Law Search by law ID or law number.
Inputs: article (required), lawId, lawNum, paragraph.
get_lawA
Retrieve law metadata and a plain text preview from e-Gov Law Search.
Inputs: lawId, lawNum, previewChars.
search_lawsB
Search current Japanese laws from e-Gov Law Search by keyword.
Inputs: keyword (required), category, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a distinct purpose: searching laws, retrieving law metadata, retrieving specific articles, and finding related laws. No overlap in functionality.
All tool names follow a consistent verb_noun pattern in snake_case, e.g., search_laws, get_law, get_article, find_related_laws.
With 4 tools, the server is well-scoped for a focused legal search assistant. The count is neither excessive nor insufficient.
The tool set covers the core operations for searching and retrieving Japanese laws and articles. A minor gap is the lack of a tool to list all laws, but for search purposes this is acceptable.
Maintenance
Related MCP Connectors
Japan Law MCP — Japanese national laws & ordinances via the e-Gov Law API.
Search Japanese statutes via the e-Gov Law API. Free law_search tool.
Japanese law, corporation & statistics data as MCP, normalized to English with source attribution.
Kokkai Diet MCP — Japan National Diet proceedings, speech-level full-text search via the National…
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables LLMs to search and retrieve Japanese laws from the e-Gov API v2, including keyword search, article fetching, table of contents, and revision history.7194 npm2MIT
- AlicenseAqualityDmaintenanceMCP server for searching and retrieving Japanese laws from the e-Gov API, enabling natural language queries for legal information.314 npmMIT
- AlicenseAqualityDmaintenanceMCP server to fetch Japanese financial laws and regulations from the e-Gov API, preventing hallucinations in Claude's responses. Supports 9 domains including Financial Instruments and Exchange Act, Banking Act, etc.5MIT
- AlicenseAqualityCmaintenanceMCP server wrapping the e-Gov law API v2 to search and retrieve Japanese law data, including law lists, revision histories, full text, attachments, and keyword search.64MIT