jp-eli-mcp 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jp_eli_mcp-0.1.1/.github/workflows/release.yml +59 -0
- jp_eli_mcp-0.1.1/.gitignore +20 -0
- jp_eli_mcp-0.1.1/.mcp.json.example +12 -0
- jp_eli_mcp-0.1.1/CONSTITUTION.md +57 -0
- jp_eli_mcp-0.1.1/DISCOVERY.md +71 -0
- jp_eli_mcp-0.1.1/Dockerfile +5 -0
- jp_eli_mcp-0.1.1/LICENSE +202 -0
- jp_eli_mcp-0.1.1/PKG-INFO +118 -0
- jp_eli_mcp-0.1.1/README.md +86 -0
- jp_eli_mcp-0.1.1/glama.json +4 -0
- jp_eli_mcp-0.1.1/pyproject.toml +85 -0
- jp_eli_mcp-0.1.1/server.json +22 -0
- jp_eli_mcp-0.1.1/src/jp_eli_mcp/__init__.py +4 -0
- jp_eli_mcp-0.1.1/src/jp_eli_mcp/audit.py +94 -0
- jp_eli_mcp-0.1.1/src/jp_eli_mcp/cache.py +56 -0
- jp_eli_mcp-0.1.1/src/jp_eli_mcp/citations.py +140 -0
- jp_eli_mcp-0.1.1/src/jp_eli_mcp/client.py +96 -0
- jp_eli_mcp-0.1.1/src/jp_eli_mcp/models.py +118 -0
- jp_eli_mcp-0.1.1/src/jp_eli_mcp/server.py +359 -0
- jp_eli_mcp-0.1.1/tests/test_instructions_drift.py +76 -0
- jp_eli_mcp-0.1.1/tests/test_smoke.py +52 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Publishes to PyPI (org secret PYPI_API_TOKEN) + the MCP Registry (GitHub OIDC).
|
|
4
|
+
# Trigger: push a version tag, e.g. `git tag v0.1.0 && git push origin v0.1.0`.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags:
|
|
9
|
+
- "v*"
|
|
10
|
+
workflow_dispatch: {} # manual re-run of the MCP Registry publish without bumping the package version
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
id-token: write # required for the MCP Registry OIDC login
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build-and-publish-pypi:
|
|
18
|
+
if: github.event_name == 'push' # only on a version tag; skipped on manual dispatch
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.12"
|
|
27
|
+
|
|
28
|
+
- name: Install build tooling
|
|
29
|
+
run: python -m pip install --upgrade build
|
|
30
|
+
|
|
31
|
+
- name: Build sdist + wheel
|
|
32
|
+
run: python -m build
|
|
33
|
+
|
|
34
|
+
- name: Publish to PyPI (org API token)
|
|
35
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
36
|
+
with:
|
|
37
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
38
|
+
|
|
39
|
+
publish-mcp-registry:
|
|
40
|
+
needs: build-and-publish-pypi
|
|
41
|
+
# run after a successful PyPI publish, OR standalone on manual dispatch
|
|
42
|
+
if: always() && (github.event_name == 'workflow_dispatch' || needs.build-and-publish-pypi.result == 'success')
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
permissions:
|
|
45
|
+
contents: read
|
|
46
|
+
id-token: write # OIDC login to the MCP Registry
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
|
|
50
|
+
- name: Install mcp-publisher
|
|
51
|
+
run: |
|
|
52
|
+
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_amd64.tar.gz" | tar xz mcp-publisher
|
|
53
|
+
sudo mv mcp-publisher /usr/local/bin/
|
|
54
|
+
|
|
55
|
+
- name: Login to MCP Registry (GitHub OIDC)
|
|
56
|
+
run: mcp-publisher login github-oidc
|
|
57
|
+
|
|
58
|
+
- name: Publish server.json to MCP Registry
|
|
59
|
+
run: mcp-publisher publish
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
.venv/
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.mypy_cache/
|
|
10
|
+
.ruff_cache/
|
|
11
|
+
|
|
12
|
+
# Local runtime (never source)
|
|
13
|
+
.matematic/
|
|
14
|
+
*.log
|
|
15
|
+
|
|
16
|
+
# OS
|
|
17
|
+
.DS_Store
|
|
18
|
+
Thumbs.db
|
|
19
|
+
|
|
20
|
+
# Note: tests/fixtures/* ARE committed - public e-Gov data needed for tests.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Constitution of jp-eli-mcp
|
|
2
|
+
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Date: 2026-07-06
|
|
5
|
+
Licence: Apache-2.0
|
|
6
|
+
|
|
7
|
+
`jp-eli-mcp` is an MCP server for Japan's official e-Gov law search API
|
|
8
|
+
(`laws.e-gov.go.jp`). It searches, fetches, and cites national legislation as structured JSON.
|
|
9
|
+
Case law is out of scope for this MVP.
|
|
10
|
+
|
|
11
|
+
The 4 principles below are inherited from the `eu-legal-mcp` line Constitution (Article IV),
|
|
12
|
+
adapted for a jurisdiction without ELI.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Art. 1. Public data only
|
|
17
|
+
|
|
18
|
+
The e-Gov law search API is the official, public source of Japanese national legislation,
|
|
19
|
+
published by the Digital Agency as open data (keyless REST/JSON). The server is read-only
|
|
20
|
+
against e-Gov and sends nothing beyond the requested title, keyword, `law_id`, or article number.
|
|
21
|
+
|
|
22
|
+
## Art. 2. Mandatory audit log
|
|
23
|
+
|
|
24
|
+
Every tool call MUST append one JSON line to `~/.matematic/audit/jp-eli-mcp.jsonl`
|
|
25
|
+
(ts / tool / input_hash SHA-256 / output_count_or_size / duration_ms / status). Inability to write
|
|
26
|
+
= the tool returns an error, it does not silently skip.
|
|
27
|
+
|
|
28
|
+
## Art. 3. Vendor neutrality
|
|
29
|
+
|
|
30
|
+
No tool hardcodes an LLM provider, assumes a model, or adds commercial telemetry. The server talks
|
|
31
|
+
only to `laws.e-gov.go.jp` and the local filesystem. Authentication: none; own backoff + cache.
|
|
32
|
+
|
|
33
|
+
## Art. 4. A durable identifier and a human-readable citation are mandatory
|
|
34
|
+
|
|
35
|
+
Every response MUST carry three fields:
|
|
36
|
+
- `eli_uri`: Japan has no ELI. This is the durable e-Gov viewer URL
|
|
37
|
+
(`https://laws.e-gov.go.jp/law/{law_id}`), keyed on the stable `law_id` e-Gov itself assigns -
|
|
38
|
+
never invented. `eli_note` on every response says so explicitly.
|
|
39
|
+
- `human_readable_citation`: law title + law number, the Japanese convention (e.g.
|
|
40
|
+
"民法(明治二十九年法律第八十九号)").
|
|
41
|
+
- `source_url`: the machine-readable API URL used to fetch the law (`/api/2/law_data/{law_id}`).
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Open points
|
|
46
|
+
|
|
47
|
+
1. **Case law** - the Courts in Japan (裁判所) publish judgments separately; not covered by this
|
|
48
|
+
connector. A future `jp-case-law-mcp` would be a distinct source.
|
|
49
|
+
2. **Article numbering edge cases** - branch articles (枝番号, e.g. 第三条の二) are addressed via
|
|
50
|
+
e-Gov's own `Num` attribute (e.g. `"3_2"`); Suppl. Provisions articles are a separate tree and
|
|
51
|
+
not yet distinguished from main-body articles in `jp_get_article`.
|
|
52
|
+
|
|
53
|
+
## Ewolucja konstytucji
|
|
54
|
+
|
|
55
|
+
Changes to art. 1-4 follow SEMVER + an entry in `CHANGELOG.md` + a `pyproject.toml` bump.
|
|
56
|
+
|
|
57
|
+
First version: 2026-07-06. Author: Wieslaw Mazur / MateMatic.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Discovery: e-Gov law search API (laws.e-gov.go.jp) - Japan
|
|
2
|
+
|
|
3
|
+
Date: 2026-07-06. **Status: CLOSED** for a search+fetch+cite MVP (confirmed by live probing).
|
|
4
|
+
|
|
5
|
+
Japan's e-Gov (電子政府の総合窓口) is the Digital Agency's official portal for national law.
|
|
6
|
+
Its "Houki Kensaku" (law search) API v2 is keyless, modern REST/JSON, and returns the full text
|
|
7
|
+
of every law as a JSON-serialized element tree. An existing MIT-licensed reference wrapper
|
|
8
|
+
(`ryoooo/e-gov-law-mcp`) confirmed the wire format was worth cross-checking against; this
|
|
9
|
+
connector is a from-scratch implementation against the live API, not a fork.
|
|
10
|
+
|
|
11
|
+
## Base API properties (CONFIRMED live 2026-07-06)
|
|
12
|
+
|
|
13
|
+
- **Base URL:** `https://laws.e-gov.go.jp/api/2`
|
|
14
|
+
- **Authentication:** none (open data).
|
|
15
|
+
- **Format:** JSON. Full law text is a JSON-serialized tag/attr/children tree (the JSON
|
|
16
|
+
equivalent of the XML the older e-Gov v1 API served) - no AKN, no XML namespace.
|
|
17
|
+
- **ELI:** NO - Japan has not deployed ELI. The stable identifier is e-Gov's own `law_id`
|
|
18
|
+
(e.g. `129AC0000000089` for the Civil Code, Meiji 29 Law No. 89).
|
|
19
|
+
|
|
20
|
+
## Endpoints (CONFIRMED)
|
|
21
|
+
|
|
22
|
+
| Endpoint | Notes |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `GET /laws?law_title={title}&limit={n}` | search by (partial) law title; returns `law_info` + `revision_info` per match |
|
|
25
|
+
| `GET /keyword?keyword={kw}&limit={n}&offset={n}` | full-text search; returns matching laws with highlighted `<span>` snippets |
|
|
26
|
+
| `GET /law_data/{law_id}` | full law: `law_info`, `revision_info`, `law_full_text` (the tree, tag `Law` > `LawBody` > `MainProvision`/`SupplProvision` > `Part`/`Chapter`/`Article`...) |
|
|
27
|
+
|
|
28
|
+
Verified live: `GET /laws?law_title=民法` returns the Civil Code (`law_id=129AC0000000089`,
|
|
29
|
+
`law_num` in kanji era notation "明治二十九年法律第八十九号"); `GET /law_data/129AC0000000089`
|
|
30
|
+
returns 1.6 MB of full text with a well-formed `Article`/`Paragraph`/`Sentence` tree, `Num`
|
|
31
|
+
attributes throughout (e.g. `Part Num="1"`).
|
|
32
|
+
|
|
33
|
+
## Fields used (for the citation contract)
|
|
34
|
+
|
|
35
|
+
- `law_info.law_id` -> the durable identifier -> `eli_uri = https://laws.e-gov.go.jp/law/{law_id}`.
|
|
36
|
+
- `revision_info.law_title` + `law_info.law_num` -> `human_readable_citation` (`"title(law_num)"`).
|
|
37
|
+
- `/api/2/law_data/{law_id}` -> `source_url` (machine-readable original).
|
|
38
|
+
- `law_full_text` tree, `Article[Num=...]` -> `jp_get_article` (recursive walk, no XML dep).
|
|
39
|
+
|
|
40
|
+
## Citation contract (Article IV) - CLOSED for JP
|
|
41
|
+
|
|
42
|
+
- `eli_uri` = e-Gov viewer URL keyed on `law_id` (no native ELI; documented via `eli_note`).
|
|
43
|
+
- `human_readable_citation` = `law_title(law_num)`, e.g. "民法(明治二十九年法律第八十九号)".
|
|
44
|
+
- `source_url` = the `/law_data/{law_id}` API URL (the fetchable original).
|
|
45
|
+
|
|
46
|
+
## Tool mapping - search+fetch+cite MVP
|
|
47
|
+
|
|
48
|
+
| Tool | Endpoint |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `jp_search_laws` | `/laws?law_title=` |
|
|
51
|
+
| `jp_search_by_keyword` | `/keyword?keyword=` |
|
|
52
|
+
| `jp_get_law` | `/law_data/{law_id}` (metadata only) |
|
|
53
|
+
| `jp_get_article` | `/law_data/{law_id}` (walk tree for `Article[Num=...]`) |
|
|
54
|
+
| `jp_get_full_text` | `/law_data/{law_id}` (full tree flattened to text, truncated ~300k chars) |
|
|
55
|
+
|
|
56
|
+
**Deferred:** case law (Courts of Japan publish judgments on a separate portal, not e-Gov).
|
|
57
|
+
|
|
58
|
+
## Differences vs the EU/EEA line
|
|
59
|
+
|
|
60
|
+
- No ELI, no AKN/XML - the source is native JSON with its own tag/attr/children tree; parsed
|
|
61
|
+
with a small recursive walker, no XML library dependency at all (a first for this fleet).
|
|
62
|
+
- Discovery has a real full-text keyword search (unlike FI/IE/LU, which are coordinate-only).
|
|
63
|
+
- Article-level fetch is a first-class tool (`jp_get_article`) because whole-law text can be very
|
|
64
|
+
large (the Civil Code alone is ~1.6 MB) - `jp_get_full_text` truncates and points back to it.
|
|
65
|
+
|
|
66
|
+
## Decision: BUILD
|
|
67
|
+
|
|
68
|
+
Keyless, modern JSON REST, a genuine full-text search endpoint, and Japan's size as a legal
|
|
69
|
+
market make this the highest-ROI non-EU connector evaluated so far. Market-size figures
|
|
70
|
+
(bengoshi headcount, GDP rank) were not independently re-verified in this session and are
|
|
71
|
+
left out of this document rather than repeated unsourced.
|
jp_eli_mcp-0.1.1/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jp-eli-mcp
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: MCP server for Japan's e-Gov law search API (laws.e-gov.go.jp) — search, fetch, and cite national legislation by law_id and article.
|
|
5
|
+
Project-URL: Repository, https://github.com/matematicsolutions/jp-eli-mcp
|
|
6
|
+
Project-URL: Issues, https://github.com/matematicsolutions/jp-eli-mcp/issues
|
|
7
|
+
Project-URL: Homepage, https://matematic.co
|
|
8
|
+
Author-email: Matematic Solutions <kontakt@matematic.co>, Wieslaw Mazur <mazur.wieslaw2022@gmail.com>
|
|
9
|
+
License: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: e-gov,japan,law,legaltech,mcp
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Legal Industry
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Office/Business
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: anyio>=4.3
|
|
22
|
+
Requires-Dist: diskcache>=5.6
|
|
23
|
+
Requires-Dist: fastmcp>=0.2.0
|
|
24
|
+
Requires-Dist: httpx>=0.27
|
|
25
|
+
Requires-Dist: pydantic>=2.6
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# jp-eli-mcp
|
|
34
|
+
|
|
35
|
+
<!-- mcp-name: io.github.matematicsolutions/jp-eli-mcp -->
|
|
36
|
+
|
|
37
|
+
An MCP server for Japan's official **e-Gov** law search API (`laws.e-gov.go.jp`), run by the
|
|
38
|
+
Digital Agency. It searches, fetches, and cites national legislation - acts, cabinet orders,
|
|
39
|
+
ministerial ordinances - with a verifiable citation on every response.
|
|
40
|
+
|
|
41
|
+
Part of the MateMatic `eu-legal-mcp` production line, extended into Asia. Same citation contract
|
|
42
|
+
(a stable identifier + a human-readable citation + a source URL) as the 18 EU/EEA connectors,
|
|
43
|
+
adapted for a jurisdiction with no ELI scheme.
|
|
44
|
+
|
|
45
|
+
> **Scope.** Discovery is by law title (`jp_search_laws`) or full-text keyword
|
|
46
|
+
> (`jp_search_by_keyword`); fetch a specific article (`jp_get_article`) or the full text
|
|
47
|
+
> (`jp_get_full_text`, truncated for very large laws such as the Civil Code). Every response
|
|
48
|
+
> carries a `dataset_note`.
|
|
49
|
+
>
|
|
50
|
+
> **Licence.** e-Gov law data is official public information published by the Japanese
|
|
51
|
+
> government as open data (keyless, REST/JSON). This connector relays it with attribution and a
|
|
52
|
+
> `source_url`.
|
|
53
|
+
|
|
54
|
+
## The tools
|
|
55
|
+
|
|
56
|
+
| Tool | What it does |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `jp_search_laws` | Search laws by (partial) title. |
|
|
59
|
+
| `jp_search_by_keyword` | Full-text search across all laws, with highlighted snippets. |
|
|
60
|
+
| `jp_get_law` | Metadata for a law by `law_id`: title, law number, promulgation date. |
|
|
61
|
+
| `jp_get_article` | The text of one article of a law, by `law_id` and `article_num`. |
|
|
62
|
+
| `jp_get_full_text` | The full text of a law (truncated at ~300,000 characters). |
|
|
63
|
+
|
|
64
|
+
Every response carries the contract: `eli_uri` (Japan has no ELI - this is the durable e-Gov
|
|
65
|
+
viewer URL, e.g. `https://laws.e-gov.go.jp/law/129AC0000000089`, see `eli_note`),
|
|
66
|
+
`human_readable_citation` (e.g. `民法(明治二十九年法律第八十九号)`), and `source_url` (the
|
|
67
|
+
machine-readable API URL).
|
|
68
|
+
|
|
69
|
+
## Install
|
|
70
|
+
|
|
71
|
+
Not yet on PyPI - install from source until the first release ships:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
git clone https://github.com/matematicsolutions/jp-eli-mcp
|
|
75
|
+
cd jp-eli-mcp
|
|
76
|
+
pip install -e .
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Once released, this will be `uvx jp-eli-mcp`.
|
|
80
|
+
|
|
81
|
+
Configuration via env:
|
|
82
|
+
|
|
83
|
+
- `JP_ELI_BASE_URL` - default `https://laws.e-gov.go.jp/api/2`
|
|
84
|
+
- `JP_ELI_CACHE_DIR` - default `~/.matematic/cache/jp-eli`
|
|
85
|
+
- `JP_ELI_AUDIT_DIR` - default `~/.matematic/audit`
|
|
86
|
+
|
|
87
|
+
No API key. e-Gov's law search API is keyless.
|
|
88
|
+
|
|
89
|
+
### Configure (Claude Code / any MCP client)
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"jp-eli-mcp": { "command": "jp-eli-mcp" }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Governance
|
|
100
|
+
|
|
101
|
+
- **Public data only** - read-only against e-Gov; no client data leaves the machine.
|
|
102
|
+
- **Audit log** - every tool call appends one JSON line to `~/.matematic/audit/jp-eli-mcp.jsonl`.
|
|
103
|
+
- **Vendor-neutral** - talks only to `laws.e-gov.go.jp`; no LLM provider, no telemetry.
|
|
104
|
+
- **Verifiable citations** - every response is independently checkable via `source_url`.
|
|
105
|
+
|
|
106
|
+
See `CONSTITUTION.md` and `DISCOVERY.md`.
|
|
107
|
+
|
|
108
|
+
## Tests
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
pip install -e ".[dev]"
|
|
112
|
+
pytest tests/test_instructions_drift.py -v # offline
|
|
113
|
+
pytest tests/test_smoke.py -v # hits live e-Gov
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Licence
|
|
117
|
+
|
|
118
|
+
Apache-2.0. © Matematic Solutions / Wieslaw Mazur.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# jp-eli-mcp
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.matematicsolutions/jp-eli-mcp -->
|
|
4
|
+
|
|
5
|
+
An MCP server for Japan's official **e-Gov** law search API (`laws.e-gov.go.jp`), run by the
|
|
6
|
+
Digital Agency. It searches, fetches, and cites national legislation - acts, cabinet orders,
|
|
7
|
+
ministerial ordinances - with a verifiable citation on every response.
|
|
8
|
+
|
|
9
|
+
Part of the MateMatic `eu-legal-mcp` production line, extended into Asia. Same citation contract
|
|
10
|
+
(a stable identifier + a human-readable citation + a source URL) as the 18 EU/EEA connectors,
|
|
11
|
+
adapted for a jurisdiction with no ELI scheme.
|
|
12
|
+
|
|
13
|
+
> **Scope.** Discovery is by law title (`jp_search_laws`) or full-text keyword
|
|
14
|
+
> (`jp_search_by_keyword`); fetch a specific article (`jp_get_article`) or the full text
|
|
15
|
+
> (`jp_get_full_text`, truncated for very large laws such as the Civil Code). Every response
|
|
16
|
+
> carries a `dataset_note`.
|
|
17
|
+
>
|
|
18
|
+
> **Licence.** e-Gov law data is official public information published by the Japanese
|
|
19
|
+
> government as open data (keyless, REST/JSON). This connector relays it with attribution and a
|
|
20
|
+
> `source_url`.
|
|
21
|
+
|
|
22
|
+
## The tools
|
|
23
|
+
|
|
24
|
+
| Tool | What it does |
|
|
25
|
+
|---|---|
|
|
26
|
+
| `jp_search_laws` | Search laws by (partial) title. |
|
|
27
|
+
| `jp_search_by_keyword` | Full-text search across all laws, with highlighted snippets. |
|
|
28
|
+
| `jp_get_law` | Metadata for a law by `law_id`: title, law number, promulgation date. |
|
|
29
|
+
| `jp_get_article` | The text of one article of a law, by `law_id` and `article_num`. |
|
|
30
|
+
| `jp_get_full_text` | The full text of a law (truncated at ~300,000 characters). |
|
|
31
|
+
|
|
32
|
+
Every response carries the contract: `eli_uri` (Japan has no ELI - this is the durable e-Gov
|
|
33
|
+
viewer URL, e.g. `https://laws.e-gov.go.jp/law/129AC0000000089`, see `eli_note`),
|
|
34
|
+
`human_readable_citation` (e.g. `民法(明治二十九年法律第八十九号)`), and `source_url` (the
|
|
35
|
+
machine-readable API URL).
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
Not yet on PyPI - install from source until the first release ships:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git clone https://github.com/matematicsolutions/jp-eli-mcp
|
|
43
|
+
cd jp-eli-mcp
|
|
44
|
+
pip install -e .
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Once released, this will be `uvx jp-eli-mcp`.
|
|
48
|
+
|
|
49
|
+
Configuration via env:
|
|
50
|
+
|
|
51
|
+
- `JP_ELI_BASE_URL` - default `https://laws.e-gov.go.jp/api/2`
|
|
52
|
+
- `JP_ELI_CACHE_DIR` - default `~/.matematic/cache/jp-eli`
|
|
53
|
+
- `JP_ELI_AUDIT_DIR` - default `~/.matematic/audit`
|
|
54
|
+
|
|
55
|
+
No API key. e-Gov's law search API is keyless.
|
|
56
|
+
|
|
57
|
+
### Configure (Claude Code / any MCP client)
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"jp-eli-mcp": { "command": "jp-eli-mcp" }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Governance
|
|
68
|
+
|
|
69
|
+
- **Public data only** - read-only against e-Gov; no client data leaves the machine.
|
|
70
|
+
- **Audit log** - every tool call appends one JSON line to `~/.matematic/audit/jp-eli-mcp.jsonl`.
|
|
71
|
+
- **Vendor-neutral** - talks only to `laws.e-gov.go.jp`; no LLM provider, no telemetry.
|
|
72
|
+
- **Verifiable citations** - every response is independently checkable via `source_url`.
|
|
73
|
+
|
|
74
|
+
See `CONSTITUTION.md` and `DISCOVERY.md`.
|
|
75
|
+
|
|
76
|
+
## Tests
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install -e ".[dev]"
|
|
80
|
+
pytest tests/test_instructions_drift.py -v # offline
|
|
81
|
+
pytest tests/test_smoke.py -v # hits live e-Gov
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Licence
|
|
85
|
+
|
|
86
|
+
Apache-2.0. © Matematic Solutions / Wieslaw Mazur.
|