Skip to main content
Glama
SHAYOUWORLD

egov-law-mcp

by SHAYOUWORLD

@codeagentjp/egov-law-mcp

e-Gov法令検索から日本の法令を検索し、条文を取得するためのローカルstdio MCPサーバーです。

このサーバーはLLMを呼び出しません。ソースに基づいた法令データとe-GovのURLのみを返すため、MCPクライアント(Claude Desktop、Claude Code、Cursorなど)が元のソースを引用できるようになります。

設計上の選択は、デジタル庁がオープンソース化したLawsy-Custom-BQ(2026年4月24日に政府AI「源内」OSSリリースの一部として公開)を参考にしています。設計ノートはcodeagent.jpを参照してください。

なぜ別のe-Gov MCPなのか

npmには既に別の著者による egov-law-mcp が存在しますが、本パッケージは以下の3点で異なります。

  1. find_related_laws — 指定された基本法令名に基づき、施行令や施行規則を検索します。Lawsy-Custom-BQもサーバー側で同様のステップを行っています。定義や委任規則が親法とは別に存在することが多いため、非常に有用です。

  2. すべてのツール結果にソースの帰属情報を明記 — すべてのレスポンスに法令名、法令ID、条番号、および正規のe-Gov URLが含まれるため、呼び出し元のLLMが引用を落とすことはありません。

  3. ビルドステップ不要の単一ファイル .mjs — bin/egov-law-mcp.mjs はNode 20+環境で直接実行可能です。監査が容易で、インストールサイズも小さくなっています。

Related MCP server: Houki e-Gov 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
}

施行令や施行規則を含め、基本法令名に関連すると思われる法令を検索します。

{
  "lawName": "個人情報の保護に関する法律",
  "limit": 10
}

データソースと帰属表示

本パッケージはe-Gov法令検索APIを使用しています。

ツールの結果にはソースの帰属情報が含まれています。本パッケージに基づいた出力を公開または再配布する場合は、適切なe-Govのソース帰属表示を含めてください。

推奨される帰属表示:

出典: e-Gov法令検索(https://laws.e-gov.go.jp/)

安全上の注意

  • 本パッケージは法令参照ツールであり、法的助言を行うものではありません。重要な法的結論については、公式のe-Govページで確認し、必要に応じて資格のある専門家に相談してください。

  • シェルコマンドは実行しません。

  • JSON-RPCメッセージはstdoutにのみ書き出し、ログはstderrにのみ出力します。

  • e-Gov法令検索のエンドポイントのみをフェッチします。

関連情報

ライセンス

MIT © codeagent.jp

Available Tools

4 tools
get_articleB

Retrieve a specific article from e-Gov Law Search by law ID or law number.

ParametersJSON Schema
NameRequiredDescriptionDefault
lawIdNoe-Gov law ID, for example 503AC0000000035.
lawNumNoJapanese law number. Either lawId or lawNum is required.
articleYesArticle number, for example 2.
paragraphNoOptional paragraph number.

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description only states 'retrieve' without disclosing behavioral traits such as idempotency, authentication needs, rate limits, or error handling for missing articles.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that front-loads the core purpose. However, it may be too brief for a tool with four parameters, missing important details about parameter dependencies.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with four parameters and no output schema or annotations, the description omits crucial context: it does not mention that the 'article' parameter is required, nor does it explain what the return value contains or how errors are handled.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description's mention of 'by law ID or law number' adds minimal value beyond the existing schema descriptions, which already specify parameter purposes and constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the action (retrieve), resource (a specific article from e-Gov Law Search), and method (by law ID or law number). It distinguishes from sibling tools like get_law and search_laws by targeting articles specifically.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context (retrieving a specific article) but provides no explicit when-to-use or when-not-to-use guidance, nor does it reference alternatives among sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_lawA

Retrieve law metadata and a plain text preview from e-Gov Law Search.

ParametersJSON Schema
NameRequiredDescriptionDefault
lawIdNoe-Gov law ID. Either lawId or lawNum is required.
lawNumNoJapanese law number. Either lawId or lawNum is required.
previewCharsNoMaximum preview length. Defaults to 5000.

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; description implies a read operation but doesn't explicitly confirm idempotency, authentication needs, or rate limits. It only states what is retrieved, which is adequate but not exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, clear, no unnecessary words. Front-loads the key action and resource.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 3 parameters, no output schema, and no annotations, the description is brief but covers the essential purpose. However, it lacks details about return format or side effects, which could be useful for a tool with no output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers 100% of parameters with descriptions. The description adds no extra meaning beyond the schema (e.g., 'metdata and preview' is generic). Baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it retrieves law metadata and plain text preview from e-Gov. It specifies the source and distinguishes from sibling tools like search_laws (search) and get_article (specific article).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus siblings, nor any prerequisites (e.g., need a law ID from search_laws). The description is silent on usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_lawsB

Search current Japanese laws from e-Gov Law Search by keyword.

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordYesKeyword to search in law name, law number, or law ID.
categoryNoLaw category. Defaults to all.
limitNoMaximum number of results. Defaults to 10.

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description must disclose behavioral traits. It only mentions 'current' laws, but lacks details on authorization, rate limits, data freshness, or any side effects. The bare statement is insufficient 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single concise sentence with no superfluous words. It front-loads the action and resource, perfect for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and only three parameters, the description fails to explain return format, pagination, or result structure. Given the tool's complexity (search across categories), completeness is lacking.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and the description adds no extra meaning beyond the schema. The search logic (e.g., partial matching, case sensitivity) is not explained, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'search', the resource 'current Japanese laws', and the source 'e-Gov Law Search by keyword', distinguishing it from siblings like find_related_laws and get_article which target specific relations or articles.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies general keyword search but does not explicitly state when to use this tool versus alternatives, nor does it mention when not to use it. No exclusions or prerequisites are provided.

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.

  1. 4 tool updatesv0.1.0
    • First observedfind_related_laws
    • First observedget_article
    • First observedget_law
    • First observedsearch_laws

TDQS

A3.8/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a distinct purpose: searching laws, retrieving law metadata, retrieving specific articles, and finding related laws. No overlap in functionality.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case, e.g., search_laws, get_law, get_article, find_related_laws.

Tool Count5/5

With 4 tools, the server is well-scoped for a focused legal search assistant. The count is neither excessive nor insufficient.

Completeness4/5

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

ActivityMaintained
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers