Global law
The law of nearly every country on earth, any date: read it, see what changed it, check citations.
Japanese statutes from e-Gov Law API v2 — laws and ordinances per article, with law number and URL.
Lists are ordered by a usage score (out of 100) built from these parts
| Popularity | 6/80 | GitHub stars or weekly downloads: the larger counts 60, the smaller 20 |
|---|---|---|
| Freshness | 7/12 | Full marks for a release or code change within 30 days |
| Still answering | 0/8 | The cloud endpoint answered at the last check |
| Usage score | 13/100 |
Quality: Passed 3/3 basic checks (shown, not used for ordering) · Momentum: No data yet (Used only on the Trending tab)
Pick the AI app you use, then copy the settings.
Let your AI install it with one sentence
Please install Houki Egov MCP. Follow https://mcp.popnx.com/i/shuji-bonji-houki-egov-mcp.md, show me the commands and wait for my OK before running them.Paste it into an AI that can work on your computer (such as Claude Code or Cursor). It reads our steps, shows you the commands and waits for your OK. No key, no sign-up. · See the full text your AI reads
Passed 3/3 checks · Runs on your computer · ✓ Commands checked Nov 20, 2026
First: which AI do you use?
Pick your app and the steps appear below.
Works with Claude, with some setup first
Install Node.js on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone
Copy this message into a Claude chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Houki Egov MCP for Claude on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "houki-egov": { "command": "npx", "args": [ "-y", "@shuji-bonji/houki-egov-mcp" ] } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) No key is needed. 5) Do what we agreed, then check that the Houki Egov MCP tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
SettingsDeveloperEdit Config
{
"mcpServers": {
"houki-egov": {
"command": "npx",
"args": [
"-y",
"@shuji-bonji/houki-egov-mcp"
]
}
}
}Use Houki Egov MCP and tell me what you can do for me, then show me one thing✓ If Claude says it is using Houki Egov MCP or shows a Houki Egov MCP tool in the answer, you are connected
Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version
ChatGPT cannot connect Houki Egov MCP yet
Houki Egov MCP runs on your computer, but ChatGPT can only connect servers that run on the web
A · Use an app that can connect Houki Egov MCP
B · Others in Law & government data that work with ChatGPT
Picked from the most used in the same category, only ones that connect by address with no key
Works with Claude Code, with some setup first
Install Node.js on your computer first (one time)
Copy this message into a Claude Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Houki Egov MCP for Claude Code on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): claude mcp add --scope user houki-egov -- npx -y @shuji-bonji/houki-egov-mcp 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) No key is needed. 5) Do what we agreed, then check that the Houki Egov MCP tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Mac: press Command+Space and type Terminal · Windows: open PowerShell
claude mcp add --scope user houki-egov -- npx -y @shuji-bonji/houki-egov-mcpYou should see Houki Egov MCP listed as connected
Use Houki Egov MCP and tell me what you can do for me, then show me one thing✓ If Claude Code says it is using Houki Egov MCP or shows a Houki Egov MCP tool in the answer, you are connected
Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Works with Cursor, with some setup first
Install Node.js on your computer first (one time)
Copy this message into a Cursor chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Houki Egov MCP for Cursor on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "houki-egov": { "command": "npx", "args": [ "-y", "@shuji-bonji/houki-egov-mcp" ] } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) No key is needed. 5) Do what we agreed, then check that the Houki Egov MCP tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Use Houki Egov MCP and tell me what you can do for me, then show me one thing✓ If Cursor says it is using Houki Egov MCP or shows a Houki Egov MCP tool in the answer, you are connected
Menu names checked against Cursor’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Works with VS Code, with some setup first
Install Node.js on your computer first (one time)
Copy this message into a VS Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Houki Egov MCP for VS Code on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "servers": { "houki-egov": { "type": "stdio", "command": "npx", "args": [ "-y", "@shuji-bonji/houki-egov-mcp" ] } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) No key is needed. 5) Do what we agreed, then check that the Houki Egov MCP tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Use Houki Egov MCP and tell me what you can do for me, then show me one thing✓ If VS Code says it is using Houki Egov MCP or shows a Houki Egov MCP tool in the answer, you are connected
Menu names checked against VS Code’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Other apps that use MCP, such as Windsurf, Zed or Gemini CLI, each add servers differently. See how in the app list.
JSON settings are under “For developers” below
Claude Code
claude mcp add --scope user houki-egov -- npx -y @shuji-bonji/houki-egov-mcpClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"houki-egov": {
"command": "npx",
"args": [
"-y",
"@shuji-bonji/houki-egov-mcp"
]
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"houki-egov": {
"command": "npx",
"args": [
"-y",
"@shuji-bonji/houki-egov-mcp"
]
}
}
}VS Code (mcp.json)
{
"servers": {
"houki-egov": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@shuji-bonji/houki-egov-mcp"
]
}
}
}These settings are generated from the maker’s registry entry. If the README says otherwise, follow the README.
Based on how this server connects and on each app’s own docs, checked Nov 10, 2026.
Run on your computer in
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
Runs on your computer; the tool list appears in your AI app after you install it.
We check information anyone can see; we have not read the code. Checks that do not apply are left out of the count. · Checked Nov 20, 2026
The registry name was verified with the GitHub account shuji-bonji, which owns the repo
Code last changed 39 days ago
Uses MIT
This one runs on your computer; there is no internet endpoint
Runs on your computer and uses local settings instead
Runs on your computer; we can only read tool lists from internet endpoints
No entries on OSV.dev for @shuji-bonji/houki-egov-mcp@0.21.0
Checks only this package version, not every dependency · checked Nov 15, 2026
If you made this, paste this code into your README. The badge links back to this page.
[](https://mcp.popnx.com/en/servers/shuji-bonji-houki-egov-mcp)Ask, share a tip or report that it does not work. Sorted by what people marked helpful.
No posts yet. Be the first to ask or share.
Posts here are written by users, not the PopNx team.
No reviews yet
Compared with every active server in this category in the registry. Stars count only when the publisher owns the repo.
It passed 3 of 3 applicable basic checks. We have not read the code. Before adding a key or token, see what access the server asks for and use a key with only the permissions you need.
The registry does not list a required key, though some servers ask you to sign in on first use.
It runs on your computer. Your AI app starts it when needed, and data does not pass through the maker’s servers (unless it calls an online service itself).
The GitHub repo last changed 39 days ago, and the latest version (0.21.0) reached the registry 39 days ago.
Apps that support MCP, such as Claude Desktop, Claude Code, Cursor and VS Code. You also need Node.js on your computer.
In the same category: Global law, Open Legal Data (Germany), LibreJustice, InfraNode, Fedlex Connector
Same category, other makers, commands already checked. Official ones first, then by stars.
Reading a card:↓ Downloads per weeki★ GitHub starsiThree pillars: reviews · checks · usageiUpdated = latest version published to the registryi
The law of nearly every country on earth, any date: read it, see what changed it, check citations.
German court decisions (Rechtsprechung) and laws (Gesetze) with citation graph and citation checks.
Search French-language and European case law and French legal texts (codes, statutes, treaties).
Keyless open data for 84 German cities: 12 lean read-only MCP tools covering 67 data types.
Search Swiss federal legislation: laws, articles, amendments via the Fedlex SPARQL endpoint.
| This one Houki Egov MCP | Global law | Open Legal Data (Germany) | LibreJustice | InfraNode | Fedlex Connector | |
|---|---|---|---|---|---|---|
| Runs where | Installs on your computer | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install |
| Needs a key | No | No | No | No | No | No |
| Add with + in Claude | No | No | No | No | No | No |
| Basic checks | 3/3 | 4/4 | 4/4 | 4/4 | 4/4 | 4/4 |
| License | MIT | NOASSERTION | MIT | Apache-2.0 | Apache-2.0 | MIT |
| Price | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry |
Copied from the maker’s repo as written. PopNx MCP has not reviewed or endorsed it. HTML, images and scripts are removed. Links lead off this site.
[!CAUTION]
旧リポジトリ名
houki-hub-mcp/ 旧 npm 名@shuji-bonji/houki-hub-mcpは使っていません。
現行は
@shuji-bonji/houki-egov-mcpです。
日本の法令(憲法・法律・政令・省令・規則)を e-Gov 法令API v2 から、条・項・号の単位で、法令番号と URL を添えて返す MCP サーバーです。税法・労働法・会社法・民法など、分野を問わず条文を LLM から引けます。
通達・質疑応答事例・タックスアンサーは @shuji-bonji/houki-nta-mcp が担当します。2 つを分けているのは、「法律で決まっている」と「通達でそうなっている」を混ぜずに返すためです。
税務・労務・会社の手続きなどを調べるときに、根拠になる条文を一次情報のまま確かめるための機能です。
「会社員で、副業の所得が 20 万円以下なら確定申告はしなくてよいか」と尋ねると、LLM が get_law(law_name="所得税法", article="121", paragraph=1) を呼び、「確定所得申告を要しない場合」の条文が返ります。
条文には、答えを分ける条件が並んでいます。給与の支払者が 1 か所か 2 か所以上か、給与の全部が源泉徴収または年末調整の対象か、給与等の金額が 2,000 万円以下か、給与所得と退職所得以外の所得の合計が 20 万円以下か、ただし書きの「政令で定める場合」に当たらないか、です。利用者は、自分の事実がどの条件に当たるかを条文で確かめられます。
国税庁の解説(タックスアンサー「給与所得者で確定申告が必要な人」など)もあわせて引くには、houki-nta-mcp を併用してください。個別の事案に条文を当てはめた結論(「あなたは申告が不要です」)は返しません。理由は業法との関係に書いています。
登録するだけで、14 ツールのうち 13 はそのまま動きます。e-Gov 法令 API v2 をその場で呼ぶためで、事前の取り込みは要りません。
// claude_desktop_config.json
{ "mcpServers": { "houki-egov": { "command": "npx", "args": ["-y", "@shuji-bonji/houki-egov-mcp@latest"] } } }
再起動して「消費税法第 30 条第 1 項を見せて」「インボイス制度の登録要件は」のように尋ねると、search_law → get_law の順に呼ばれ、法令番号と e-Gov の URL 付きで本文が返ります。
ローカル DB が要るのは search_fulltext(条文本文の横断検索)だけです。DB が無いときは search_law(法令名の検索)に切り替わり、応答の source が "api-fallback" になります。本文の全文検索が要ると分かったら、そのとき一度だけ下記の「CLI(ローカル DB の構築)」を実行してください。全法令 zip(約 290 MB)の取得と取り込みが走ります。
| ローカル DB なし | ローカル DB あり | |
|---|---|---|
search_law get_law get_toc get_law_range get_law_revisions resolve_abbreviation explain_law_type get_related_laws get_article_references verify_citations list_attachments get_attachment get_law_file | 動く(e-Gov API をその場で呼ぶ) | 同じ |
search_fulltext | search_law に切り替わる(source: "api-fallback") | 条文本文を横断検索する(freshness 付き) |
| Tool | 用途 |
|---|---|
search_law | 法令タイトルでキーワード検索(略称→正式名解決済み)。total_count は e-Gov で一致した総数で、0 件のときは search_fulltext と resolve_abbreviation を案内する(v0.18.0) |
get_law | 条/項/号レベルで本文取得(Markdown / JSON / TOC)。条は本則から探し、附則の条は suppl_index で附則を指して取る(v0.18.0) |
get_toc | 目次のみ取得(トークン節約)。本則と附則を分け、附則は改正法ごとにまとめる(v0.13.0) |
get_law_range | 編・章・節・款・目のいずれか、または附則 1 本を範囲にして条を本文ごと取得。上限を超える範囲は条の単位で打ち切り、続きの条番号を返す(v0.14.0) |
get_law_revisions | 改正履歴を取得(公布日・施行日・状態) |
search_fulltext | 条文本文の横断全文検索(ローカル SQLite FTS5。bulk DB 未構築時は search_law にフォールバック)。通達などの管轄外の略称だけを渡すと OUT_OF_SCOPE(v0.18.0) |
resolve_abbreviation | 略称→正式名解決の診断。全角英数字・全角空白は揃えて照合し、辞書のエントリはどの管轄でも返して in_scope と hint で管轄を示す(v0.16.0) |
explain_law_type | 法令種別(憲法・法律・政令・省令・通達 等)の解説。e-Gov の法令種別コード(Act・Constitution・Rule など)でも引ける |
get_related_laws | 法令名の規則で施行令・施行規則(施行令からは親の法律)を引き、e-Gov に実在するものだけを law_id 付きで返す(v0.10.0)。法律でも施行令・施行規則でもない法令からは候補を作らない(v0.18.0) |
get_article_references | 本則の条の本文が引用している他法令の条(law_id 付き)・同一法令内の条項号・「附則第N条」・「政令で定める」の委任先を取り出し、get_law(条の無い他法令の参照は get_toc)の引数を next_actions で付ける(v0.10.0。附則と委任先の扱いは v0.18.0) |
verify_citations | 引用のリストをまとめて実在確認し、件ごとに found / not_found / ambiguous を返す(v0.11.0)。条は本則で確かめ、附則の条は suppl_index で指す(v0.18.0) |
list_attachments | 法令に付いた添付ファイル(別表・様式・別記の図。jpg / pdf)の一覧。各ファイルに認証なしで開ける URL と、法令の中の置き場所(「別表第一(第一条関係)」など。附則の別表・様式は v0.18.0 から)を付ける(v0.15.0) |
get_attachment | 添付ファイル 1 件(または zip)。既定は URL とメタ情報だけ、save: true でサーバー側の保存先に書いて絶対パスを返す(v0.15.0) |
get_law_file | 法令本文を xml / json / html / rtf / docx のファイルで。既定は URL だけ、save: true で保存(v0.15.0) |
search_fulltext は、2 文字の語(「相殺」「時効」)を渡されたときに何をして結果を出したかを short_tokens で返します(v0.12.0)。索引が trigram で 3 文字以上の語しか載せないため、既定では条の本文を引かず、法令名を添える形と scan_body: true で走査する形を next_actions で示します。詳しくは2 文字の語の検索をご覧ください。
get_toc は、本則を toc、附則を改正法ごとに suppl_provisions へ分けて返します(v0.13.0)。既定では附則は見出しと条数だけで、suppl: "full" で附則の中の条まで返します。depth で階層を刈ったときは truncated: true と truncated_by: "depth" が返ります(v0.21.0)。この truncated は depth で刈ったときだけ true になり、get_law_range の truncated(文字数の上限で条を打ち切った印)とは意味が違うので、続きを取る操作はありません。詳しくは本則と附則の分け方をご覧ください。
list_attachments / get_attachment / get_law_file は、条文の文字列に入らないもの(別表・様式の図、Word や HTML の本文ファイル)を取る道です(v0.15.0)。ファイルの中身は応答に入れず、認証なしで開ける URL と、save: true のときだけ保存先の絶対パスを返します。詳しくは添付ファイルと法令本文ファイルをご覧ください。
get_law_range は、get_law(1 条ずつ)と get_toc(目次だけ)の間を埋めます(v0.14.0)。民法の「第三編第二章 契約」のように章・節を指定すると、その中の条を本文ごと返し、長い範囲は条の単位で打ち切って続きの条番号を返します。詳しくは章・節単位の取得をご覧ください。
略称辞書(174 エントリ・6 分野)は @shuji-bonji/houki-abbreviations を内部で利用しています。
get_related_laws と get_article_references は、法令名の文字列規則と条文本文の正規表現で 決定論的に引ける参照だけ を返します。同じ入力には同じ出力になり、LLM の判断は挟みません。
get_related_laws({ law_name: "所得税法" }) → related[] に所得税法施行令(340CO0000000096)と所得税法施行規則(340M50000040011)。名前の末尾に「施行令」「施行規則」を付けた候補を e-Gov に問い合わせ、law_title が完全一致した 1 件だけを採用します。無かった候補は not_found[] に残しますget_article_references({ law_name: "所得税法", article: "57の2", paragraph: 2 }) → references[] に「雇用保険法(昭和四十九年法律第百十六号)第十条第五項第一号」が law_id と条・項・号付きで入り、delegations[] に「政令で定める」×N と委任先(所得税法施行令)が入ります。「前項」「同法」は kind: "relative" で解決しませんget_article_references は本則の条だけを対象にし、本文の「附則第N条」は kind: "suppl"・resolved: false で返します。省令・府令の委任先は、施行規則を定めた命令の名前(法令番号の 大蔵省令 など。省の改称は同じ省として扱います)が委任の文言と合うときだけ付け、合わないときと 主務省令 は target_law: null にします。施行規則の本文の「令第N条」は、兄弟の施行令が実在すれば external に解決します。get_related_laws は、法律でも施行令・施行規則でもない法令(省令・政令・規則など)からは候補を作らず、related を空にして note に理由を書きますnote / coverage.note が付き、抽出できた範囲だけを返していること、網羅性を保証しないことを書いています。委任の趣旨の解釈や意味的に近い条の推薦は行いません(houki-hub#8 の法令グラフの担当)上の「まず試す」の claude_desktop_config.json の例をそのまま使います。ローカル DB は無くても動きます。
リポジトリ同梱の .claude-plugin/plugin.json が MCP server として npx -y @shuji-bonji/houki-egov-mcp@latest を登録します。plugin として入れた場合も、下の「Claude Desktop で使う」も、起動されるのは npm に公開された同じパッケージです。
git clone git@github.com:shuji-bonji/houki-egov-mcp.git
cd houki-egov-mcp npm install npm run build npm test
// 開発中の動作確認 (.mcp.json)
{ "mcpServers": { "houki-egov-local": { "command": "node", "args": ["/absolute/path/to/houki-egov-mcp/dist/index.js"] } } }
手元のビルドも、HOUKI_EGOV_DB_PATH が無ければ plugin と同じ ~/.cache/houki-egov-mcp/laws.db を開きます。古いコミットや DB の版を上げる変更を試すときは、別のファイルに向けてください(CONTRIBUTING.md の「ローカル DB を使う開発」)。
# LLM への問いかけ → MCP ツール呼び出し
「消費税法30条1項を見せて」 → get_law(law_name="消法", article="30", paragraph=1)
「消費税法第三十条第一項を見せて」(判決文や通達からの引き写し) → get_law(law_name="消法", article="第三十条", paragraph=1) # 漢数字は v0.7.0 から。項は数値で
「消費税法2条1項8号の2(特定資産の譲渡等)を見せて」 → get_law(law_name="消法", article="2", paragraph=1, item="8の2")
「労働基準法の目次を取得」 → get_toc(law_name="労基法")
「民法の契約の章をまとめて読みたい」 → get_law_range(law_name="民法", part=3, chapter=2) → 第三編 債権 第二章 契約(198 条)を上限(既定 30,000 文字)まで返し、続きは from_article で取る
「会社法の設立の章を見せて」 → get_law_range(law_name="会社法", path="Part2/Chapter1") # get_toc の toc[].path をそのまま渡せる
「個人情報保護法の改正履歴を最新5件」 → get_law_revisions(law_name="個情法", latest=5)
「電帳法って正式名称なに?」 → resolve_abbreviation(abbr="電帳法") → 電子計算機を使用して作成する国税関係帳簿書類の保存方法等の特例に関する法律
「政令と省令の違いは?」 → explain_law_type(name="政令")
「民法で不法行為について定めている条文は?」(bulk DB 構築後) → search_fulltext(keyword="民法 不法行為") → law_scope=[民法] に絞って本文検索。724 条・719 条・509 条 などが snippet 付きで返る
「民法 第709条」(法令名 + 条番号だけ) → search_fulltext(keyword="民法 第709条") → 本文検索をせず、民法 709 条を直接返す
ローカル DB が要るのは search_fulltext だけです。それ以外の 13 ツールは DB が無くても動くので、条文本文の横断検索が要ると分かってから作れば足ります(上の「まず試す」)。
全文検索用のローカル DB(SQLite FTS5)は、e-Gov の bulk ダウンロード zip から構築します。MCP server として常駐する通常起動とは別に、フラグ付きで起動すると CLI モードで動作します。
# 全法令 zip (約 290 MB) を DL して DB に取り込む (初回)
npx -y @shuji-bonji/houki-egov-mcp@latest --bulk-download-everything
npx -y @shuji-bonji/houki-egov-mcp@latest --sync
npx -y @shuji-bonji/houki-egov-mcp@latest --status
コマンドは、どのフォルダーからでも動く npx -y @shuji-bonji/houki-egov-mcp@latest <フラグ> の形で書いています。
npm install -g @shuji-bonji/houki-egov-mcp でグローバルにインストールしたときは、houki-egov-mcp <フラグ> でも動きます。インストールしていないと command not found になりますnpx houki-egov-mcp <フラグ> は、npm に houki-egov-mcp という名前のパッケージが無いので 404 になります(このリポジトリのフォルダーの中でだけ動きます)@latest を付けると、npx が以前に取得した古い版を使わずに、公開中の最新版で実行します。plugin と同じ版で DB を作り、更新するために付けています(0.18.x 以前の版で版 3 の DB を開くと全テーブルが消えるので、古い版を使わないことが大切です)search_fulltext の応答(next_actions と note)と CLI の出力で案内するコマンドも、この npx -y @shuji-bonji/houki-egov-mcp@latest <フラグ> の形です(0.20.0 から)。HOUKI_EGOV_DB_PATH か XDG_CACHE_HOME で DB の場所を決めて起動・実行したときは、同じ変数を前に付けた形(例: HOUKI_EGOV_DB_PATH="$HOME/.cache/houki-egov-mcp/laws.dev.db" npx -y @shuji-bonji/houki-egov-mcp@latest --bulk-download-everything)になるので、そのまま実行すれば同じ DB を作り、更新します。--help の使い方だけは houki-egov-mcp <フラグ> の形で書いています。
--sync は、差分が無い日(土日など)を飛ばし、途中で失敗しても成功した日までを記録して終わります。最終同期から 90 日(HOUKI_EGOV_INCREMENTAL_LIMIT_DAYS)を超えて空いているときは、e-Gov の日次差分の公開範囲を超えるので、何もせずに --bulk-download-everything を促します。1 日分は数百 KB〜30 MB、13 日分でおよそ 1〜2 分です。
DB は既定で ~/.cache/houki-egov-mcp/laws.db に作られます。場所を変えるときは、下の「DB の場所を変える(HOUKI_EGOV_DB_PATH)」を見てください。
--status は、1 行目に版、2 行目に DB:(開く DB のファイル)、3 行目に DB の場所の設定:(HOUKI_EGOV_DB_PATH・XDG_CACHE_HOME・既定 のどれでその場所に決まったか)を出します(3 行目は 0.20.0 から)。同じフォルダーに、名前が laws で始まり .db で終わるファイルがほかにあるときは、その次の行の [WARN] 同じフォルダーに、この DB のほかに laws*.db のファイルがあります: … で、名前・大きさ・最終更新を挙げます。MCP サーバーと CLI が別のファイルを開いていないかを確かめるための行で、終了コードは変わりません。
MCP サーバー(plugin を含む)が開くファイルは、起動時のログ(標準エラー出力)の [server] DB: <絶対パス>(DB の場所の設定: <名前>) の行と、search_fulltext の応答の freshness.db_path(ホームディレクトリの部分は ~)で確かめられます(0.20.0 から)。起動時のログは、MCP クライアントが保存する MCP サーバーのログに出ます。
--bulk-download-by-date YYYYMMDD は 1 日分の差分だけを取り込む確認用のコマンドです。同期の状態(last_sync_date)は変えないので、最新化には --sync を使ってください。差分の無い日を指定したときは 差分なし を出して終了コード 0 で終わります。
引数を打ち間違えたとき(houki-egov-mcp status のような - の無い引数、--sync --status のようにフラグの後に続く引数)は、何もせずにエラーと使い方を出して終了コード 2 で終わります(0.19.0 から。それまでは MCP サーバーとして起動するか、最初のフラグだけを実行していました)。
ふだんの更新は --sync だけで足ります。--bulk-download-everything を使うのは、表の 2〜5 行目の 4 つのときです。
| 場面 | 使うコマンド | すること |
|---|---|---|
| ふだんの更新(毎日・毎週など) | --sync | 最後に同期した日から今日までの日次差分を取り込みます。差分の無い日は 差分なし で飛ばします |
| 初めて DB を作るとき | --bulk-download-everything | 全件の zip(約 290 MB)を取得して DB を作ります |
最後の同期から 90 日(HOUKI_EGOV_INCREMENTAL_LIMIT_DAYS)を超えたとき | --bulk-download-everything | --sync は何もせずに、このコマンドを促して終了コード 1 で終わります |
| houki-egov-mcp を上げて DB の版が変わったとき(0.19.0 で版 2 → 3) | --bulk-download-everything | 版の古い DB を作り直して取り込みます(取り込んだ中身は消えます) |
--sync・--status が [WARN] 施行日が last_sync_date … を出したとき(0.19.1 から) | --bulk-download-everything | 施行日を過ぎても未施行のまま残った版の状態を直します(条の本文は入れ直しません) |
版が同じ DB に --bulk-download-everything を実行しても、作り直しはしません。全件の zip を取り直して、中身の変わった法令と、施行されて状態が変わった版だけを書き換えます。ふだんの更新に使う必要はありません。