e-gov-law-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@e-gov-law-mcp民法の改正履歴を調べて"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
e-gov-law-mcp
e-Gov法令API v2 をラップした Model Context Protocol (MCP) サーバーです。日本の法令データ(法令一覧・改正履歴・法令本文・添付ファイルなど)をMCP対応クライアント(Claude Codeなど)から検索・取得できるようにします。
セットアップ
Claude Code プラグインとして
このリポジトリ自体が Claude Code のマーケットプレイスを兼ねています。
/plugin marketplace add kannkyo/e-gov-law-mcp
/plugin install e-gov-law-mcpMCPサーバー(e-gov-law-mcp)と、法令調査の手順をまとめたスキル(legal-e-gov-law)が一緒にインストールされます。
MCPサーバー単体として
Node.js が必要です。
npx github:kannkyo/e-gov-law-mcpMCPクライアントの設定ファイル(例: Claude Codeの mcp.json 等)に以下のように登録します。
{
"mcpServers": {
"e-gov-law": {
"command": "npx",
"args": ["github:kannkyo/e-gov-law-mcp"]
}
}
}ソースからのビルド
git clone https://github.com/kannkyo/e-gov-law-mcp.git
cd e-gov-law-mcp
npm install
npm run build
npm startRelated MCP server: houan-mcp
提供ツール
ツール名 | 概要 | 対応API |
| 法令名・法令種別・時点(asof)を指定して法令一覧を検索する |
|
| 指定した法令の改正履歴一覧を取得する |
|
| 法令ID・法令番号・改正IDを指定して法令本文をJSONで取得する |
|
| 法令改正IDを指定して添付ファイル(画像・PDF・Zipなど)を取得し、一時ファイルに保存してそのパスを返す |
|
| 法令本文内に指定したキーワードを含む法令を検索する |
|
| 法令本文をファイル形式(xml/json/html/rtf/docx)でダウンロードし、一時ファイルに保存してそのパスを返す |
|
get_attachment / download_law_file はバイナリデータをOSの一時ディレクトリに保存し、保存先パス・サイズ・Content-Typeを返します。
開発
npm run typecheck # 型チェック
npm test # テスト実行(vitest)
npm run build # 型チェック + esbuildでdist/index.jsにバンドルライセンス
Available Tools
6 toolsdownload_law_file法令本文ファイルダウンロードA
法令ID・法令番号・改正IDを指定して法令本文をファイル形式(xml/json/html/rtf/docx)でダウンロードし、一時ファイルに保存してそのパスを返す(e-Gov法令API v2 GET /law_file/{file_type}/{law_id_or_num_or_revision_id})
| Name | Required | Description | Default |
|---|---|---|---|
| asof | No | 法令の時点(YYYY-MM-DD) | |
| file_type | Yes | ダウンロード形式 | |
| law_id_or_num_or_revision_id | Yes | 法令ID、法令番号、または改正ID |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does disclose the key behavior: saving to a temporary file and returning its path. However, it omits details about temp file lifecycle (e.g., cleanup), error handling, or authentication requirements, leaving some behavioral ambiguity.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that efficiently packs the action, parameters, file formats, and return behavior without excessive verbosity. It is slightly dense with the API endpoint reference, but every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema, the description explains the return value (temp file path) adequately. However, it lacks mention of error cases, temp file handling after reading, or when to prefer sibling tools, making it adequate but not fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all parameters clearly. The description reiterates that law_id_or_num_or_revision_id accepts ID/number/revision ID and file_type is the download format, but adds no new meaning beyond the API endpoint path, which is already evident.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool downloads law text in a specified file format (xml/json/html/rtf/docx) and returns the path to a temporary file. This specific verb+resource combination distinguishes it from siblings like get_law_data or search_laws, which are more about structured data or searching.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when a file download is needed, and it provides context on required parameters (law ID/number/revision ID, file type). However, it does not explicitly name alternative tools or state when not to use this tool, so the guidance remains implicit rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_attachment添付ファイル取得A
法令改正IDを指定して法令本文の添付ファイル(画像・PDF・Zipなど)を取得し、一時ファイルに保存してそのパスを返す(e-Gov法令API v2 GET /attachment/{law_revision_id})
| Name | Required | Description | Default |
|---|---|---|---|
| src | No | 添付ファイルの指定(本文中の参照名) | |
| law_revision_id | Yes | 法令改正ID |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses a key side effect: saving the file to a temporary directory and returning its path. It also mentions the HTTP GET endpoint, implying a read-only operation. However, it omits details like authentication requirements, file size limits, or cleanup behavior, preventing a perfect score.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, well-structured sentence that front-loads the core function, mentions the side effect (temp file + path), and includes the API endpoint in parentheses. No wasted words or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Without an output schema, the description explains the return value (path) and file types, which is essential. It also indicates the API. However, it does not explicitly clarify how src selects among multiple attachments, and given the tool's simplicity, this is a minor gap. Overall, the context is sufficiently complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with both parameters documented in the schema. The description merely restates that law_revision_id is required and does not mention the src parameter at all, adding no significant meaning beyond the schema. Baseline of 3 applies because the schema is sufficient.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states that the tool retrieves attachment files (images, PDF, Zip) for a specified law_revision_id, saves them to a temporary file, and returns the path. It also names the exact e-Gov API endpoint, distinguishing it from siblings like download_law_file by focusing on attachments for a specific revision.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when an attachment for a given law revision is needed, but it does not explicitly explain when to use this tool instead of alternatives such as download_law_file or get_law_data, nor does it provide any exclusions. This is a clear implied usage but lacks explicit differentiation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_law_data法令本文取得A
法令ID・法令番号・改正IDを指定して法令本文をJSONで取得する(e-Gov法令API v2 GET /law_data/{law_id_or_num_or_revision_id})
| Name | Required | Description | Default |
|---|---|---|---|
| elm | No | 取得したい要素の指定(例: 条番号) | |
| law_full_text_format | No | 本文の形式(jsonのみサポート) | |
| law_id_or_num_or_revision_id | Yes | 法令ID、法令番号、または改正ID |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It does mention the API endpoint and JSON output, but it omits critical details such as error handling, rate limits, permission requirements, or the structure of the returned JSON. For a read operation, this is a notable gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence that conveys the essential action and inputs without unnecessary detail. It is efficiently written and earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has no output schema and no annotations, leaving the description to provide context. It discloses the return format (JSON) but not the structure or content of the law text. It also lacks any guidance on the optional parameters elm and law_full_text_format, though the schema covers them. As a result, the description is minimally sufficient but not comprehensive.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, so the schema already documents all three parameters. The tool description does not add additional meaning beyond what is in the schema; it primarily restates the main parameter. Thus, the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly specifies the tool's function: retrieving law text (本文) in JSON format using a law ID, law number, or revision ID. It also names the underlying API endpoint, which adds specificity. This distinguishes it from sibling tools like search_laws or get_law_revisions, which handle different tasks.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when you have a law ID/number/revision ID and need the law text, but it does not explicitly state when to use this tool versus alternatives like get_law_revisions or get_attachment. No exclusions or alternative conditions are mentioned, leaving the decision to the agent's inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_law_revisions法令改正履歴取得B
指定した法令の改正履歴一覧を取得する(e-Gov法令API v2 GET /law_revisions/{law_id_or_num})
| Name | Required | Description | Default |
|---|---|---|---|
| law_id_or_num | Yes | 法令ID または 法令番号 | |
| amendment_type | No | 改正種別(1:新規, 3:被改正, 8:廃止。複数指定可) | |
| amendment_date_to | No | 施行期日の範囲終了(YYYY-MM-DD) | |
| amendment_date_from | No | 施行期日の範囲開始(YYYY-MM-DD) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral transparency. It only mentions the API endpoint and does not disclose whether the operation is read-only, what the response format is, whether pagination or rate limits exist, or any error conditions. This is especially lacking for a retrieval tool with potentially complex output.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that is specific and front-loaded, with the API endpoint added in parentheses for extra context. There is no redundancy or wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description is minimal and does not explain the return value or provide any additional context about the amendment history response. However, the schema covers parameters, and the purpose is clear, so it is minimally viable for a simple retrieval operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already describes all four parameters with 100% coverage, so the description adds no additional parameter semantics. The baseline of 3 is appropriate since the schema does the heavy lifting, and the description does not compensate with extra context.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('取得する' - retrieve) and the specific resource ('改正履歴一覧' - amendment history list) and even references the exact API endpoint. This unambiguously distinguishes it from sibling tools like search_laws, get_law_data, or download_law_file.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. The description does not mention any exclusions, prerequisites, or comparisons with sibling tools, leaving the agent to infer usage solely from the tool name and description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_keyword法令キーワード検索C
法令本文内に指定したキーワードを含む法令を検索する(e-Gov法令API v2 GET /keyword)
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | 取得件数の上限 | |
| offset | No | 取得開始位置 | |
| keyword | Yes | 検索キーワード(必須) | |
| law_type | No | 法令種別(複数指定可) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It only references the underlying API endpoint (e-Gov法令API v2 GET /keyword) but does not disclose behavioral traits such as pagination behavior, result limits, rate limits, or whether the operation is read-only. The keyword search nature implies read-only, but this is not explicit.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, concise and directly to the point. It avoids unnecessary words and is easy to parse. However, its brevity means it lacks explanatory richness that would make it more helpful, so it does not earn a 5.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given there is no output schema and the tool is a search with pagination parameters (limit, offset), the description should explain expected return format or pagination behavior. It does not, and also lacks notes on result ordering or response structure. The tool is minimally complete but leaves gaps for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so all four parameters (keyword, limit, offset, law_type) have descriptive text. The description adds no extra meaning beyond what the schema already provides, but it does align with the 'keyword' parameter. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the function: searching for laws containing a specified keyword in the law text ('法令本文内に指定したキーワードを含む法令を検索する'). It specifies the verb (search), resource (laws), and scope (keyword match). However, it does not explicitly distinguish itself from the sibling 'search_laws', so it only partially differentiates.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to use this tool versus alternatives like search_laws. The description only states what it does, with no mention of use cases, exclusions, or comparative advantages. This leaves the agent to infer usage purely from the name.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_laws法令一覧検索A
法令名・法令種別・時点(asof)を指定して法令一覧を検索する(e-Gov法令API v2 GET /laws)
| Name | Required | Description | Default |
|---|---|---|---|
| asof | No | 法令の時点(YYYY-MM-DD) | |
| limit | No | 取得件数の上限 | |
| offset | No | 取得開始位置 | |
| law_type | No | 法令種別(複数指定可) | |
| law_title | No | 法令名(部分一致) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits. It reveals it wraps the e-Gov Law API v2 GET /laws but does not mention pagination, return structure, rate limits, or any side effects. This is minimal disclosure for a search tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that immediately states the tool's purpose and key parameters. No redundant information; it is appropriately brief.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is adequate for starting a search but lacks details about the response format or any constraints on the API. Since there is no output schema, the description could have specified the returned fields or pagination behavior, but it doesn't. The tool has 5 parameters, so a bit more context would help.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema already provides descriptions for all five parameters (100% coverage), so the description adds little. It highlights law_title, law_type, and asof, which are already documented, and omits limit/offset entirely. It does not add meaningful usage context beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool searches a list of laws (法令一覧) using law name, law type, and as-of date. This verb+resource+parameters distinction separates it from siblings like get_law_data (which retrieves specific law details) or search_keyword (likely full-text search).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a clear context for usage: to search law listings by metadata fields. It does not explicitly mention alternatives or exclusions, but the distinct purpose makes the intended use clear relative to sibling tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v0.1.0- First observed
download_law_file - First observed
get_attachment - First observed
get_law_data - First observed
get_law_revisions - First observed
search_keyword - First observed
search_laws
TDQS
Scored across 6 tools
Each tool targets a distinct resource and action: searching by metadata, searching by text keyword, retrieving revision history, retrieving law data, fetching attachments, and downloading law files. Even get_law_data and download_law_file are clearly differentiated by return type (structured JSON vs. saved file path).
All tool names follow a consistent verb_noun pattern in snake_case (search_laws, get_law_revisions, get_law_data, get_attachment, search_keyword, download_law_file). The verb choices are simple and predictable, with no mixed conventions.
Six tools is well-scoped for a legal information API, covering search, revisions, data retrieval, attachments, keyword search, and file download without redundancy or bloat. The count feels appropriate for the domain.
The tool surface covers the main operations of the e-Gov law API: law list searches, keyword text searches, revision history, law data retrieval, attachments, and file downloads. As a read-only API, there are no obvious dead ends or missing core workflows.
Maintenance
Related MCP Connectors
Japan Law MCP — Japanese national laws & ordinances via the e-Gov Law API.
Read-only MCP server for searching Japan government procurement bid information from the KKJ portal.
日本法リサーチMCP。e-Gov全法令の検索・条文取得、委任先解決、裁判例検索、国会会議録、改正沿革、官公庁一次資料(PDF/HTML)の本文読取・読み起こし全文までこれ1本で
Japanese law, corporation & statistics data as MCP, normalized to English with source attribution.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables searching and retrieving Japanese legal information from the e-Gov Law API, including law searches by keyword, detailed law data retrieval, and revision history tracking.31,595 npm48MIT
- AlicenseAqualityCmaintenanceMCP server for searching Japanese Diet bills and committee Q\&A records via the NDL Kokkai API.45 npm1MIT
- -licenseNot gradedqualityCmaintenanceEnables access to Japanese labor and social insurance law data via e-Gov API and official notices from MHLW and JAISH, running as a local MCP server on Windows.-
- AlicenseAqualityDmaintenanceMCP server for searching and retrieving Japanese laws from the e-Gov API, enabling natural language queries for legal information.34 npmMIT