Skip to main content
Glama
japan-legislation-mcp-server

japan-legislation-mcp-server

by cyanheads

Version License Docker MCP SDK npm Bun

Install in Claude Desktop Install in Cursor Install in VS Code

Framework


Overview

Search Japan’s Constitution, Acts, cabinet orders, ministerial ordinances, and rules in the original Japanese. The corpus covers national legislation. Prefectural and municipal 条例 fall outside it. Historical date selection begins on 2017-04-01, which includes the version then in force for laws already in effect. Repealed or expired laws may still have a last published text. Scheduled revisions carry the UnEnforced status.

出典:e-Gov法令検索. This server reformats Japanese legal text from the Digital Agency’s e-Gov Law API v2 under the e-Gov Law Search terms. For English reference translations, see the Ministry of Justice’s Japanese Law Translation.

Tools

Tool

Description

jplaw_search_laws

Search by Japanese title, abbreviation, subject, promulgation, or amendment dates

jplaw_search_text

Search Japanese statutory text and preview matches grouped by law and revision

jplaw_lookup_citation

Resolve law numbers or Japanese citations and parse provision addresses

jplaw_get_law

Browse a revision outline, read selected text, and find official downloads

jplaw_get_provision

Read up to ten articles, paragraphs, or items in one revision

jplaw_list_revisions

Trace amendment history and find exact revision IDs

jplaw_find_subordinate_laws

Find possible implementing orders, ordinances, and rules with supporting evidence

jplaw_list_reference

Look up law types, category codes, identifiers, query syntax, and coverage

Related MCP server: e-gov-law-mcp

Capability reference

jplaw_search_laws tool

  • Start with {"title":"個人情報保護法"}. Use law_types, categories, law_num_era, and law_num_year to narrow the catalog. Get the accepted codes from jplaw_list_reference.

  • The inclusive ranges promulgation_from and promulgation_to filter the law’s own promulgation date. The amendment_promulgation_from and amendment_promulgation_to or amendment_enforcement_from and amendment_enforcement_to pairs filter the amendment in the selected asof view.

  • status defaults to in_force. Use all or filter for Repeal, Expire, Suspend, or LossOfEffectiveness. sort accepts law_number (default), promulgated, or amended.

  • Up to 500 results per page. Pass page.next_offset back as offset with the same filters and sort.

jplaw_search_text tool

  • Try {"keyword":"個人情報 第三者提供","sections":["mainprovision"],"limit":10}. The keyword expression uses a space for AND, | for OR, ! for NOT, and * and ? as wildcards.

  • Use law_types, categories, asof, and sections to narrow matches. Section values are mainprovision, supplprovision, amendsupplprovision, caption, enactstatement, and relatedarticlenum.

  • Up to 1,000 snippets per page. Continue at next_offset even when a filtered page shows zero matches. Any upstream_total_count counts matches before section filtering. Follow up with a pinned law read for complete text.

jplaw_lookup_citation tool

  • Supply 1–25 citations, for example ["平成15年法律第57号","個人情報保護法第二十七条第一項"]. Exact Japanese titles, abbreviations, and e-Gov law IDs also work, as do Gregorian law-number years and kanji numerals.

  • Each citation resolves separately. For ambiguous results, select a returned law ID. Confirm parsed provision addresses with jplaw_get_provision in the relevant revision.

jplaw_get_law tool

  • {"law":"個人情報保護法"} opens the outline. Pass part: "第二十七条", a Japanese structure path, or a canonical selector from that revision for text. Use part: "全部" for whole-law text and include_amendment_suppl: true to include amending supplementary provisions there.

  • Use asof (YYYY-MM-DD) or law_revision_id to select a version. The revision ID can identify the law by itself. Results include pinned links to available attachments and document downloads.

  • The paged outline and text return complete units. Continue with next_offset as offset, keeping part, include_amendment_suppl and the returned law_revision_id fixed. If revision.updated changes, start again at zero because an upstream correction can change the document without changing its revision ID.

jplaw_get_provision tool

  • Try {"law":"個人情報保護法","asof":"2024-04-01","provisions":["第二十七条第一項"]}. Pass up to ten addresses using Japanese 条/項/号 (including branches such as 第二十七条の二), supplementary notation such as 附則第二条, or structured coordinates.

  • Version selection works the same way as in jplaw_get_law. Results distinguish found, deleted, and unresolved provisions. For large provisions returned as an outline, follow the child addresses or pass the canonical selector to jplaw_get_law.

jplaw_list_revisions tool

  • Pass {"law":"平成15年法律第57号"} to see versions in e-Gov’s newest-first order. Filter by statuses, or by inclusive enforcement_from/enforcement_to and promulgation_from/promulgation_to ranges.

  • Pass page.next_offset as offset to continue. Copy the chosen law_revision_id into a law or provision read to retrieve that exact version.

jplaw_find_subordinate_laws tool

  • Pass the exact title, number, abbreviation, or law ID of an Act, for example {"law":"個人情報保護法"}. status defaults to in_force. Use all to include inactive candidates and next_offset to page through the unique instruments.

  • Title extensions such as 施行令 or 施行規則 and enactment-statement matches are evidence to inspect. e-Gov does not provide a formal parent relationship.

jplaw_list_reference tool

  • Omit topic to list topics, or choose law_types, categories, law_numbers, identifiers, provision_addresses, keyword_syntax, coverage, or upstream_errors. This tool works offline.

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

  • Date and revision selection for Japanese law text, including supplementary provisions and appendices

  • Revision-specific source links and explicit continuation offsets

  • Catalog snapshots refresh after two hours. Revision lists and parsed law documents are cached for up to five minutes, and text reads check the source update timestamp.

  • Search and browse calls default to offset: 0 and limit: 25. A null continuation offset marks the end of the list.

Getting started

Run it locally with Claude Code:

claude mcp add japan-legislation-mcp-server -- npx -y @cyanheads/japan-legislation-mcp-server

For other clients, add this to the MCP config file:

{
  "mcpServers": {
    "japan-legislation-mcp-server": {
      "command": "npx",
      "args": ["-y", "@cyanheads/japan-legislation-mcp-server"]
    }
  }
}

For a client using Bun, use "command": "bunx" with "args": ["@cyanheads/japan-legislation-mcp-server"]. e-Gov access needs no API key.

For Docker or a source build, see Running the server.

Configuration

Variable

Description

Default

MCP_TRANSPORT_TYPE

Transport (stdio or http).

stdio

MCP_HTTP_HOST

HTTP bind address.

127.0.0.1

MCP_HTTP_PORT

HTTP server port.

3010

MCP_HTTP_ENDPOINT_PATH

Streamable HTTP endpoint path.

/mcp

MCP_SESSION_MODE

HTTP session mode (stateless, stateful, or auto).

stateless

MCP_AUTH_MODE

Authentication mode (none, jwt, or oauth).

none

MCP_LOG_LEVEL

Log level (debug, info, warning, error, etc.).

info

OTEL_ENABLED

Enable OpenTelemetry.

false

See .env.example for common framework overrides.

Running the server

Local development

Requires Bun v1.4.4 or higher to build and Node.js v24+ for the built entry point.

git clone https://github.com/cyanheads/japan-legislation-mcp-server.git
cd japan-legislation-mcp-server
bun install
bun run rebuild
bun run start:http

Connect a Streamable HTTP client to http://127.0.0.1:3010/mcp, or use bun run start:stdio to launch the built server as a stdio process.

Docker

docker run --rm -p 127.0.0.1:3010:3010 ghcr.io/cyanheads/japan-legislation-mcp-server:latest

The image uses HTTP and stateless sessions by default. For stdio, set MCP_TRANSPORT_TYPE=stdio and use docker run -i. To build locally, run docker build -t japan-legislation-mcp-server ..

Project structure

Directory

Purpose

src/mcp-server/tools/definitions

Eight read-only MCP tools.

src/services/egov

e-Gov transport, upstream schemas, and reference data.

src/services/catalog

Catalog search, exact law resolution, and revision history.

src/services/law

XML parsing, provision addressing, and revision text.

src/services/keyword

Snippet search and filtered continuation.

tests/

Contract and service tests.

See the file tree for the full layout.

Development guide

See CLAUDE.md for development guidelines and architectural rules.

Contributing

Issues are welcome. Run checks and tests before submitting:

bun run devcheck
bun run test

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Local stdio MCP server for searching Japanese laws and retrieving article text from e-Gov Law Search. Includes related-law lookup for enforcement orders and regulations, with source attribution baked into every tool result.
      4
      50 npm
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      MCP 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.
      6
      4
      MIT
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables MCP clients to search Japanese laws and fetch specific articles, paragraphs, and items from the e-Gov Law API v2. Supports natural-language legal research with caching and citation formatting.
      -