eu-reg-mcp 0.1.0__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.
- eu_reg_mcp-0.1.0/.github/workflows/ci.yml +15 -0
- eu_reg_mcp-0.1.0/.gitignore +6 -0
- eu_reg_mcp-0.1.0/LICENSE +21 -0
- eu_reg_mcp-0.1.0/Makefile +10 -0
- eu_reg_mcp-0.1.0/PKG-INFO +124 -0
- eu_reg_mcp-0.1.0/README.md +98 -0
- eu_reg_mcp-0.1.0/docs/development.md +9 -0
- eu_reg_mcp-0.1.0/docs/guardrails.md +8 -0
- eu_reg_mcp-0.1.0/docs/tools.md +28 -0
- eu_reg_mcp-0.1.0/pyproject.toml +48 -0
- eu_reg_mcp-0.1.0/server.json +21 -0
- eu_reg_mcp-0.1.0/src/eu_reg_mcp/__init__.py +0 -0
- eu_reg_mcp-0.1.0/src/eu_reg_mcp/data.py +60 -0
- eu_reg_mcp-0.1.0/src/eu_reg_mcp/integrations.py +95 -0
- eu_reg_mcp-0.1.0/src/eu_reg_mcp/register.py +105 -0
- eu_reg_mcp-0.1.0/src/eu_reg_mcp/server.py +85 -0
- eu_reg_mcp-0.1.0/tests/fixtures/changelog.jsonl +3 -0
- eu_reg_mcp-0.1.0/tests/fixtures/latest.json +1 -0
- eu_reg_mcp-0.1.0/tests/test_integrations.py +29 -0
- eu_reg_mcp-0.1.0/tests/test_register.py +56 -0
- eu_reg_mcp-0.1.0/tests/test_server.py +46 -0
- eu_reg_mcp-0.1.0/uv.lock +770 -0
eu_reg_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sebastian Förste
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: eu-reg-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server giving AI agents cited, review-gated grounding in EU regulation: ESMA MiCAR register search, register change tracking, white paper linting, EU AI Act classification.
|
|
5
|
+
Project-URL: Homepage, https://github.com/sebastianfoerste/eu-reg-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/sebastianfoerste/eu-reg-mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/sebastianfoerste/eu-reg-mcp/issues
|
|
8
|
+
Author: Sebastian Förste
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai-act,compliance,crypto,esma,eu,mcp,micar,model-context-protocol,regulation
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Requires-Python: >=3.13
|
|
18
|
+
Requires-Dist: mcp<2,>=1.2
|
|
19
|
+
Provides-Extra: classify
|
|
20
|
+
Requires-Dist: eu-ai-act-classifier>=0.2.0; extra == 'classify'
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
23
|
+
Provides-Extra: lint
|
|
24
|
+
Requires-Dist: micar-whitepaper-linter>=0.2.0; extra == 'lint'
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
<!-- mcp-name: io.github.sebastianfoerste/eu-reg-mcp -->
|
|
28
|
+
# eu-reg-mcp
|
|
29
|
+
|
|
30
|
+
[](https://github.com/sebastianfoerste/eu-reg-mcp/actions/workflows/ci.yml)
|
|
31
|
+
|
|
32
|
+
**Let your AI agent check the ESMA MiCAR register and cite EU AI Act provisions instead of guessing — with every answer framed as a fact or a candidate flag for human review.**
|
|
33
|
+
|
|
34
|
+
Scope today: the ESMA interim MiCAR register (search, summary, change tracking), MiCAR white paper linting, and EU AI Act risk-tier classification. Other EU regulation is not covered.
|
|
35
|
+
|
|
36
|
+
## Try it
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
claude mcp add eu-reg -- uvx eu-reg-mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then ask your agent: *"Is `<entity>` on the MiCAR register, and what format is its white paper?"* The register tools need no API key. Claude Desktop config, the lint/classify extras and other clients: [docs/tools.md](docs/tools.md#data-sources-and-network-use).
|
|
43
|
+
|
|
44
|
+
<details>
|
|
45
|
+
<summary>Claude Desktop (<code>claude_desktop_config.json</code>)</summary>
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"eu-reg": {
|
|
51
|
+
"command": "uvx",
|
|
52
|
+
"args": ["eu-reg-mcp"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
</details>
|
|
58
|
+
|
|
59
|
+
## Example output
|
|
60
|
+
|
|
61
|
+
> **Synthetic data.** Produced on 2026-10-14 by running this repo's register code (`register.search_entries` / `register.recent_changes`) against the **synthetic test fixtures** in `tests/fixtures/`, not the live register. The entity and its LEI are test data. Output shape is what a live call returns; values are not.
|
|
62
|
+
|
|
63
|
+
`search_micar_register(query="skygate")`:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"snapshot_date": "2026-07-07",
|
|
68
|
+
"total_matches": 1,
|
|
69
|
+
"results": [
|
|
70
|
+
{
|
|
71
|
+
"register": "other-wp",
|
|
72
|
+
"entity_name": "SKYGATE Network GmbH",
|
|
73
|
+
"lei": "984500BBFE52FE449926",
|
|
74
|
+
"member_state": "AT",
|
|
75
|
+
"authority": "FMA",
|
|
76
|
+
"whitepaper_url": "WWW.SKYGATETOKEN.AT",
|
|
77
|
+
"format_class": "unspecified",
|
|
78
|
+
"register_last_update": "30/12/2024"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"truncated": false,
|
|
82
|
+
"notice": "Facts from the public ESMA interim MiCAR register (Art. 109 MiCAR) as mirrored by the MiCAR Register Observatory. No legal assessment of any entity; not legal advice."
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`micar_register_changes(change_type="removed")` returns the same kind of cited record (snapshot date, register, entity) and notes that *"the register itself does not state why"* an entry was removed. The lint and classify tools return pinpoint citations (MiCAR Annex I–III; AI Act Art. 5 / Annex III / GPAI); I have not run them for this README, so no sample is shown. [UNVERIFIED: live output of those two tools]
|
|
87
|
+
|
|
88
|
+
## Tools
|
|
89
|
+
|
|
90
|
+
| Tool | What it does | Needs |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| `search_micar_register` | Look up an entity by name or LEI in the ESMA interim MiCAR register | — |
|
|
93
|
+
| `micar_register_summary` | Register totals and white paper format coverage | — |
|
|
94
|
+
| `micar_register_changes` | New filings, changed entries, removals | — |
|
|
95
|
+
| `lint_micar_whitepaper` | Deterministic Annex I–III lint of a draft white paper | `lint` extra |
|
|
96
|
+
| `classify_eu_ai_act_system` | AI Act risk tier with pinpoint citations | `classify` extra |
|
|
97
|
+
|
|
98
|
+
Parameters, data sources, caching and network requirements: [docs/tools.md](docs/tools.md).
|
|
99
|
+
|
|
100
|
+
## Why not just ask an LLM?
|
|
101
|
+
|
|
102
|
+
An ungrounded model can invent register entries or provisions. Here, register answers come from a dated snapshot of the public register, and lint/classification output comes from deterministic rules with citations. **Review-gated** means the output is a candidate flag pending human legal review — never a legal assessment or legal advice. Details: [docs/guardrails.md](docs/guardrails.md).
|
|
103
|
+
|
|
104
|
+
## Links
|
|
105
|
+
|
|
106
|
+
- Register data: [micar-register-observatory](https://github.com/sebastianfoerste/micar-register-observatory) (weekly snapshots of the public ESMA register, Art. 109 VO (EU) 2023/1114)
|
|
107
|
+
- Linter: [micar-whitepaper-linter](https://github.com/sebastianfoerste/micar-whitepaper-linter) (36 rules mapped to Annex I–III) · Classifier: [eu-ai-act-classifier](https://github.com/sebastianfoerste/eu-ai-act-classifier) — both MIT-licensed
|
|
108
|
+
- Development and tests: [docs/development.md](docs/development.md)
|
|
109
|
+
|
|
110
|
+
## Part of the EU regulation as code suite
|
|
111
|
+
|
|
112
|
+
By [sebastianfoerste](https://github.com/sebastianfoerste):
|
|
113
|
+
|
|
114
|
+
- [awesome-eu-fintech-regulation](https://github.com/sebastianfoerste/awesome-eu-fintech-regulation)
|
|
115
|
+
- [contract-review-eval-harness](https://github.com/sebastianfoerste/contract-review-eval-harness)
|
|
116
|
+
- [legal-function-operating-system](https://github.com/sebastianfoerste/legal-function-operating-system)
|
|
117
|
+
- [eu-ai-act-classifier](https://github.com/sebastianfoerste/eu-ai-act-classifier)
|
|
118
|
+
- [micar-whitepaper-linter](https://github.com/sebastianfoerste/micar-whitepaper-linter)
|
|
119
|
+
- **eu-reg-mcp** (this repo)
|
|
120
|
+
- [micar-register-observatory](https://github.com/sebastianfoerste/micar-register-observatory)
|
|
121
|
+
|
|
122
|
+
## Caveats
|
|
123
|
+
|
|
124
|
+
Register results are public-register facts with extraction artifacts possible; lint and classification outputs are candidate flags pending human legal review. Nothing here is legal advice. MIT licensed.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<!-- mcp-name: io.github.sebastianfoerste/eu-reg-mcp -->
|
|
2
|
+
# eu-reg-mcp
|
|
3
|
+
|
|
4
|
+
[](https://github.com/sebastianfoerste/eu-reg-mcp/actions/workflows/ci.yml)
|
|
5
|
+
|
|
6
|
+
**Let your AI agent check the ESMA MiCAR register and cite EU AI Act provisions instead of guessing — with every answer framed as a fact or a candidate flag for human review.**
|
|
7
|
+
|
|
8
|
+
Scope today: the ESMA interim MiCAR register (search, summary, change tracking), MiCAR white paper linting, and EU AI Act risk-tier classification. Other EU regulation is not covered.
|
|
9
|
+
|
|
10
|
+
## Try it
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
claude mcp add eu-reg -- uvx eu-reg-mcp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Then ask your agent: *"Is `<entity>` on the MiCAR register, and what format is its white paper?"* The register tools need no API key. Claude Desktop config, the lint/classify extras and other clients: [docs/tools.md](docs/tools.md#data-sources-and-network-use).
|
|
17
|
+
|
|
18
|
+
<details>
|
|
19
|
+
<summary>Claude Desktop (<code>claude_desktop_config.json</code>)</summary>
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"eu-reg": {
|
|
25
|
+
"command": "uvx",
|
|
26
|
+
"args": ["eu-reg-mcp"]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
</details>
|
|
32
|
+
|
|
33
|
+
## Example output
|
|
34
|
+
|
|
35
|
+
> **Synthetic data.** Produced on 2026-10-14 by running this repo's register code (`register.search_entries` / `register.recent_changes`) against the **synthetic test fixtures** in `tests/fixtures/`, not the live register. The entity and its LEI are test data. Output shape is what a live call returns; values are not.
|
|
36
|
+
|
|
37
|
+
`search_micar_register(query="skygate")`:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"snapshot_date": "2026-07-07",
|
|
42
|
+
"total_matches": 1,
|
|
43
|
+
"results": [
|
|
44
|
+
{
|
|
45
|
+
"register": "other-wp",
|
|
46
|
+
"entity_name": "SKYGATE Network GmbH",
|
|
47
|
+
"lei": "984500BBFE52FE449926",
|
|
48
|
+
"member_state": "AT",
|
|
49
|
+
"authority": "FMA",
|
|
50
|
+
"whitepaper_url": "WWW.SKYGATETOKEN.AT",
|
|
51
|
+
"format_class": "unspecified",
|
|
52
|
+
"register_last_update": "30/12/2024"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"truncated": false,
|
|
56
|
+
"notice": "Facts from the public ESMA interim MiCAR register (Art. 109 MiCAR) as mirrored by the MiCAR Register Observatory. No legal assessment of any entity; not legal advice."
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`micar_register_changes(change_type="removed")` returns the same kind of cited record (snapshot date, register, entity) and notes that *"the register itself does not state why"* an entry was removed. The lint and classify tools return pinpoint citations (MiCAR Annex I–III; AI Act Art. 5 / Annex III / GPAI); I have not run them for this README, so no sample is shown. [UNVERIFIED: live output of those two tools]
|
|
61
|
+
|
|
62
|
+
## Tools
|
|
63
|
+
|
|
64
|
+
| Tool | What it does | Needs |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
| `search_micar_register` | Look up an entity by name or LEI in the ESMA interim MiCAR register | — |
|
|
67
|
+
| `micar_register_summary` | Register totals and white paper format coverage | — |
|
|
68
|
+
| `micar_register_changes` | New filings, changed entries, removals | — |
|
|
69
|
+
| `lint_micar_whitepaper` | Deterministic Annex I–III lint of a draft white paper | `lint` extra |
|
|
70
|
+
| `classify_eu_ai_act_system` | AI Act risk tier with pinpoint citations | `classify` extra |
|
|
71
|
+
|
|
72
|
+
Parameters, data sources, caching and network requirements: [docs/tools.md](docs/tools.md).
|
|
73
|
+
|
|
74
|
+
## Why not just ask an LLM?
|
|
75
|
+
|
|
76
|
+
An ungrounded model can invent register entries or provisions. Here, register answers come from a dated snapshot of the public register, and lint/classification output comes from deterministic rules with citations. **Review-gated** means the output is a candidate flag pending human legal review — never a legal assessment or legal advice. Details: [docs/guardrails.md](docs/guardrails.md).
|
|
77
|
+
|
|
78
|
+
## Links
|
|
79
|
+
|
|
80
|
+
- Register data: [micar-register-observatory](https://github.com/sebastianfoerste/micar-register-observatory) (weekly snapshots of the public ESMA register, Art. 109 VO (EU) 2023/1114)
|
|
81
|
+
- Linter: [micar-whitepaper-linter](https://github.com/sebastianfoerste/micar-whitepaper-linter) (36 rules mapped to Annex I–III) · Classifier: [eu-ai-act-classifier](https://github.com/sebastianfoerste/eu-ai-act-classifier) — both MIT-licensed
|
|
82
|
+
- Development and tests: [docs/development.md](docs/development.md)
|
|
83
|
+
|
|
84
|
+
## Part of the EU regulation as code suite
|
|
85
|
+
|
|
86
|
+
By [sebastianfoerste](https://github.com/sebastianfoerste):
|
|
87
|
+
|
|
88
|
+
- [awesome-eu-fintech-regulation](https://github.com/sebastianfoerste/awesome-eu-fintech-regulation)
|
|
89
|
+
- [contract-review-eval-harness](https://github.com/sebastianfoerste/contract-review-eval-harness)
|
|
90
|
+
- [legal-function-operating-system](https://github.com/sebastianfoerste/legal-function-operating-system)
|
|
91
|
+
- [eu-ai-act-classifier](https://github.com/sebastianfoerste/eu-ai-act-classifier)
|
|
92
|
+
- [micar-whitepaper-linter](https://github.com/sebastianfoerste/micar-whitepaper-linter)
|
|
93
|
+
- **eu-reg-mcp** (this repo)
|
|
94
|
+
- [micar-register-observatory](https://github.com/sebastianfoerste/micar-register-observatory)
|
|
95
|
+
|
|
96
|
+
## Caveats
|
|
97
|
+
|
|
98
|
+
Register results are public-register facts with extraction artifacts possible; lint and classification outputs are candidate flags pending human legal review. Nothing here is legal advice. MIT licensed.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Development
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
git clone https://github.com/sebastianfoerste/eu-reg-mcp
|
|
5
|
+
cd eu-reg-mcp
|
|
6
|
+
make install && make test # `make run` starts the server over stdio
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Tests run offline against the fixtures in `tests/fixtures/`. These fixtures are small **synthetic** snapshots, not real register data. The server itself is MIT-licensed.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Guardrails: what "review-gated" means here
|
|
2
|
+
|
|
3
|
+
Every response carries its framing:
|
|
4
|
+
|
|
5
|
+
- **Register results** are facts from a public register, returned with the snapshot date. A `removed` change record means the entry left the register export; the register does not state why.
|
|
6
|
+
- **Lint and classification outputs** are candidate flags from deterministic rules, **pending human legal review**. Extraction artifacts exist.
|
|
7
|
+
|
|
8
|
+
Nothing this server returns is a legal assessment of any entity or legal advice — that is a design contract, not a disclaimer. The text lives in the server instructions and in the `notice` field of each response (see `src/eu_reg_mcp/server.py`, `register.py`, `integrations.py`).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Tools reference
|
|
2
|
+
|
|
3
|
+
| Tool | What it does | Needs |
|
|
4
|
+
| --- | --- | --- |
|
|
5
|
+
| `search_micar_register` | Look up an entity by name or LEI in the ESMA interim MiCAR register: white papers (Titles II–IV), authorised CASPs, non-compliant entities | — |
|
|
6
|
+
| `micar_register_summary` | Current register totals and white paper format coverage | — |
|
|
7
|
+
| `micar_register_changes` | Register movement: new filings, changed entries, removals (withdrawal tracking) | — |
|
|
8
|
+
| `lint_micar_whitepaper` | Deterministic Annex I–III lint of a draft white paper: cited candidate findings | `lint` extra |
|
|
9
|
+
| `classify_eu_ai_act_system` | EU AI Act risk-tier classification with pinpoint Art. 5 / Annex III / GPAI citations | `classify` extra |
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
- `search_micar_register(query, register_slug="all", member_state="")` — `query` is a case-insensitive entity-name substring or an exact LEI; `register_slug` is one of `all | other-wp | emt-wp | art-wp | casps | ncasp`; `member_state` is an optional two-letter code (DE, IE, MT, …).
|
|
14
|
+
- `micar_register_summary()` — no parameters.
|
|
15
|
+
- `micar_register_changes(limit=50, change_type="all")` — `change_type` is `all | added | changed | removed`.
|
|
16
|
+
- `lint_micar_whitepaper(whitepaper_json)` — a draft white paper as a JSON string.
|
|
17
|
+
- `classify_eu_ai_act_system(profile_json="")` — a SystemProfile as JSON; an empty string returns the schema.
|
|
18
|
+
|
|
19
|
+
## Data sources and network use
|
|
20
|
+
|
|
21
|
+
Register data comes from the [MiCAR Register Observatory](https://github.com/sebastianfoerste/micar-register-observatory), which snapshots the public ESMA register weekly (Art. 109 VO (EU) 2023/1114). The server reads the observatory's `data/latest.json` and `data/changelog.jsonl` from GitHub raw (`src/eu_reg_mcp/data.py`) and caches them in memory for one hour. The three register tools therefore need network access to GitHub; they do not contact ESMA directly. If the observatory files are unreachable, the register tools raise an error (no fallback is implemented).
|
|
22
|
+
|
|
23
|
+
The linter is [micar-whitepaper-linter](https://github.com/sebastianfoerste/micar-whitepaper-linter) (36 rules mapped to Annex I–III); the classifier is [eu-ai-act-classifier](https://github.com/sebastianfoerste/eu-ai-act-classifier). Both are separate packages from their own repositories, MIT-licensed like this server. Without the extras, both tools return an install hint instead of failing.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
uv pip install 'eu-reg-mcp[lint]'
|
|
27
|
+
uv pip install 'eu-reg-mcp[classify]'
|
|
28
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "eu-reg-mcp"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "MCP server giving AI agents cited, review-gated grounding in EU regulation: ESMA MiCAR register search, register change tracking, white paper linting, EU AI Act classification."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.13"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Sebastian Förste" }]
|
|
10
|
+
keywords = ["mcp", "model-context-protocol", "eu", "regulation", "micar", "esma", "ai-act", "compliance", "crypto"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 3 - Alpha",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.13",
|
|
16
|
+
"Topic :: Software Development :: Libraries",
|
|
17
|
+
]
|
|
18
|
+
dependencies = ["mcp>=1.2,<2"]
|
|
19
|
+
|
|
20
|
+
[project.optional-dependencies]
|
|
21
|
+
dev = ["pytest>=8.0"]
|
|
22
|
+
lint = [
|
|
23
|
+
"micar-whitepaper-linter>=0.2.0",
|
|
24
|
+
]
|
|
25
|
+
classify = [
|
|
26
|
+
"eu-ai-act-classifier>=0.2.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/sebastianfoerste/eu-reg-mcp"
|
|
31
|
+
Repository = "https://github.com/sebastianfoerste/eu-reg-mcp"
|
|
32
|
+
Issues = "https://github.com/sebastianfoerste/eu-reg-mcp/issues"
|
|
33
|
+
|
|
34
|
+
[project.scripts]
|
|
35
|
+
eu-reg-mcp = "eu_reg_mcp.server:main"
|
|
36
|
+
|
|
37
|
+
[build-system]
|
|
38
|
+
requires = ["hatchling"]
|
|
39
|
+
build-backend = "hatchling.build"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.metadata]
|
|
42
|
+
allow-direct-references = true
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.wheel]
|
|
45
|
+
packages = ["src/eu_reg_mcp"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.sebastianfoerste/eu-reg-mcp",
|
|
4
|
+
"title": "EU Regulatory Grounding",
|
|
5
|
+
"description": "Cited, review-gated grounding in EU regulation: ESMA MiCAR register search and change tracking, white paper linting, EU AI Act classification.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/sebastianfoerste/eu-reg-mcp",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"version": "0.1.0",
|
|
11
|
+
"packages": [
|
|
12
|
+
{
|
|
13
|
+
"registryType": "pypi",
|
|
14
|
+
"registryBaseUrl": "https://pypi.org",
|
|
15
|
+
"identifier": "eu-reg-mcp",
|
|
16
|
+
"version": "0.1.0",
|
|
17
|
+
"runtimeHint": "uvx",
|
|
18
|
+
"transport": { "type": "stdio" }
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Fetch and cache the observatory's published register data.
|
|
2
|
+
|
|
3
|
+
The MiCAR Register Observatory commits its normalized snapshot and changelog
|
|
4
|
+
to GitHub; this module reads those raw files so every MCP client sees the
|
|
5
|
+
same weekly, review-gated dataset without touching ESMA directly.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
import time
|
|
12
|
+
import urllib.request
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
OBSERVATORY_RAW = (
|
|
16
|
+
"https://raw.githubusercontent.com/sebastianfoerste/micar-register-observatory/main"
|
|
17
|
+
)
|
|
18
|
+
LATEST_URL = f"{OBSERVATORY_RAW}/data/latest.json"
|
|
19
|
+
CHANGELOG_URL = f"{OBSERVATORY_RAW}/data/changelog.jsonl"
|
|
20
|
+
|
|
21
|
+
USER_AGENT = "eu-reg-mcp/0.1 (+https://github.com/sebastianfoerste/eu-reg-mcp)"
|
|
22
|
+
|
|
23
|
+
CACHE_TTL_SECONDS = 3600 # register moves weekly; an hour is generous
|
|
24
|
+
|
|
25
|
+
_cache: dict[str, tuple[float, Any]] = {}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _get(url: str) -> bytes:
|
|
29
|
+
request = urllib.request.Request(url, headers={"User-Agent": USER_AGENT})
|
|
30
|
+
with urllib.request.urlopen(request, timeout=30) as response:
|
|
31
|
+
return response.read()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _cached(key: str, url: str, parse: Any) -> Any:
|
|
35
|
+
now = time.monotonic()
|
|
36
|
+
hit = _cache.get(key)
|
|
37
|
+
if hit is not None and now - hit[0] < CACHE_TTL_SECONDS:
|
|
38
|
+
return hit[1]
|
|
39
|
+
value = parse(_get(url))
|
|
40
|
+
_cache[key] = (now, value)
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def load_snapshot() -> dict[str, Any]:
|
|
45
|
+
return _cached("latest", LATEST_URL, lambda raw: json.loads(raw.decode("utf-8")))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def load_changelog() -> list[dict[str, Any]]:
|
|
49
|
+
def parse(raw: bytes) -> list[dict[str, Any]]:
|
|
50
|
+
return [
|
|
51
|
+
json.loads(line)
|
|
52
|
+
for line in raw.decode("utf-8").splitlines()
|
|
53
|
+
if line.strip()
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
return _cached("changelog", CHANGELOG_URL, parse)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def clear_cache() -> None:
|
|
60
|
+
_cache.clear()
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Optional integrations with the linter and classifier packages.
|
|
2
|
+
|
|
3
|
+
Both packages are MIT-licensed and live in their own repositories. They
|
|
4
|
+
install via the `lint` and `classify` extras and degrade to an install hint
|
|
5
|
+
when absent. Findings from either tool are candidate flags requiring human
|
|
6
|
+
legal review, never confirmed deficiencies or legal conclusions — that
|
|
7
|
+
framing is part of the contract.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import json
|
|
13
|
+
import shutil
|
|
14
|
+
import subprocess
|
|
15
|
+
import tempfile
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import Any
|
|
18
|
+
|
|
19
|
+
REVIEW_NOTICE = (
|
|
20
|
+
"Deterministic rule output. Every finding is a candidate gap in the "
|
|
21
|
+
"submitted text pending human legal review; extraction artifacts occur. "
|
|
22
|
+
"Not legal advice."
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def lint_whitepaper(whitepaper_json: str) -> dict[str, Any]:
|
|
27
|
+
binary = shutil.which("micar-lint")
|
|
28
|
+
if binary is None:
|
|
29
|
+
return {
|
|
30
|
+
"available": False,
|
|
31
|
+
"hint": (
|
|
32
|
+
"micar-lint is not installed. Install the optional extra: "
|
|
33
|
+
"`uv pip install 'eu-reg-mcp[lint]'` "
|
|
34
|
+
"(see github.com/sebastianfoerste/micar-whitepaper-linter)."
|
|
35
|
+
),
|
|
36
|
+
}
|
|
37
|
+
try:
|
|
38
|
+
payload = json.loads(whitepaper_json)
|
|
39
|
+
except json.JSONDecodeError as error:
|
|
40
|
+
return {"available": True, "error": f"whitepaper_json is not valid JSON: {error}"}
|
|
41
|
+
|
|
42
|
+
with tempfile.NamedTemporaryFile(
|
|
43
|
+
"w", suffix=".json", delete=False, encoding="utf-8"
|
|
44
|
+
) as handle:
|
|
45
|
+
json.dump(payload, handle)
|
|
46
|
+
path = handle.name
|
|
47
|
+
try:
|
|
48
|
+
result = subprocess.run(
|
|
49
|
+
[binary, path, "--json"],
|
|
50
|
+
capture_output=True,
|
|
51
|
+
text=True,
|
|
52
|
+
timeout=120,
|
|
53
|
+
check=False,
|
|
54
|
+
)
|
|
55
|
+
finally:
|
|
56
|
+
Path(path).unlink(missing_ok=True)
|
|
57
|
+
if result.stdout.strip():
|
|
58
|
+
try:
|
|
59
|
+
report = json.loads(result.stdout)
|
|
60
|
+
except json.JSONDecodeError:
|
|
61
|
+
report = {"raw_output": result.stdout[:5000]}
|
|
62
|
+
return {"available": True, "report": report, "notice": REVIEW_NOTICE}
|
|
63
|
+
return {
|
|
64
|
+
"available": True,
|
|
65
|
+
"error": (result.stderr or "linter produced no output")[:2000],
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def classify_ai_system(profile_json: str) -> dict[str, Any]:
|
|
70
|
+
try:
|
|
71
|
+
from eu_ai_act_classifier.local_api import classify_payload, schema_payload
|
|
72
|
+
except ImportError:
|
|
73
|
+
return {
|
|
74
|
+
"available": False,
|
|
75
|
+
"hint": (
|
|
76
|
+
"eu-ai-act-classifier is not installed. Install the optional "
|
|
77
|
+
"extra: `uv pip install 'eu-reg-mcp[classify]'` "
|
|
78
|
+
"(see github.com/sebastianfoerste/eu-ai-act-classifier)."
|
|
79
|
+
),
|
|
80
|
+
}
|
|
81
|
+
if not profile_json.strip():
|
|
82
|
+
return {
|
|
83
|
+
"available": True,
|
|
84
|
+
"profile_schema": schema_payload(),
|
|
85
|
+
"notice": "Empty profile: returning the expected SystemProfile schema.",
|
|
86
|
+
}
|
|
87
|
+
try:
|
|
88
|
+
payload = json.loads(profile_json)
|
|
89
|
+
except json.JSONDecodeError as error:
|
|
90
|
+
return {"available": True, "error": f"profile_json is not valid JSON: {error}"}
|
|
91
|
+
return {
|
|
92
|
+
"available": True,
|
|
93
|
+
"classification": classify_payload(payload),
|
|
94
|
+
"notice": REVIEW_NOTICE,
|
|
95
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""Pure query functions over the observatory snapshot."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections import Counter
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
MAX_RESULTS = 25
|
|
9
|
+
|
|
10
|
+
NOTICE = (
|
|
11
|
+
"Facts from the public ESMA interim MiCAR register (Art. 109 MiCAR) as "
|
|
12
|
+
"mirrored by the MiCAR Register Observatory. No legal assessment of any "
|
|
13
|
+
"entity; not legal advice."
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _all_entries(snapshot: dict[str, Any]) -> list[dict[str, Any]]:
|
|
18
|
+
return [
|
|
19
|
+
entry
|
|
20
|
+
for register in snapshot.get("registers", [])
|
|
21
|
+
if register.get("fetched")
|
|
22
|
+
for entry in register.get("entries", [])
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def search_entries(
|
|
27
|
+
snapshot: dict[str, Any],
|
|
28
|
+
query: str,
|
|
29
|
+
register: str = "all",
|
|
30
|
+
member_state: str = "",
|
|
31
|
+
) -> dict[str, Any]:
|
|
32
|
+
needle = query.strip().lower()
|
|
33
|
+
state = member_state.strip().upper()
|
|
34
|
+
matches = []
|
|
35
|
+
for entry in _all_entries(snapshot):
|
|
36
|
+
if register != "all" and entry.get("register_slug") != register:
|
|
37
|
+
continue
|
|
38
|
+
if state and entry.get("member_state", "").upper() != state:
|
|
39
|
+
continue
|
|
40
|
+
name = entry.get("entity_name", "").lower()
|
|
41
|
+
lei = entry.get("lei", "").lower()
|
|
42
|
+
if needle and needle not in name and needle != lei:
|
|
43
|
+
continue
|
|
44
|
+
matches.append(
|
|
45
|
+
{
|
|
46
|
+
"register": entry.get("register_slug"),
|
|
47
|
+
"entity_name": entry.get("entity_name"),
|
|
48
|
+
"lei": entry.get("lei"),
|
|
49
|
+
"member_state": entry.get("member_state"),
|
|
50
|
+
"authority": entry.get("authority"),
|
|
51
|
+
"whitepaper_url": entry.get("wp_url"),
|
|
52
|
+
"format_class": entry.get("format_class"),
|
|
53
|
+
"register_last_update": entry.get("last_update"),
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
return {
|
|
57
|
+
"snapshot_date": snapshot.get("snapshot_date"),
|
|
58
|
+
"total_matches": len(matches),
|
|
59
|
+
"results": matches[:MAX_RESULTS],
|
|
60
|
+
"truncated": len(matches) > MAX_RESULTS,
|
|
61
|
+
"notice": NOTICE,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def summarize(snapshot: dict[str, Any]) -> dict[str, Any]:
|
|
66
|
+
registers = [
|
|
67
|
+
{
|
|
68
|
+
"register": register.get("slug"),
|
|
69
|
+
"title": register.get("title"),
|
|
70
|
+
"entries": len(register.get("entries", [])),
|
|
71
|
+
"fetched": register.get("fetched"),
|
|
72
|
+
}
|
|
73
|
+
for register in snapshot.get("registers", [])
|
|
74
|
+
]
|
|
75
|
+
formats = Counter(
|
|
76
|
+
entry.get("format_class")
|
|
77
|
+
for register in snapshot.get("registers", [])
|
|
78
|
+
if register.get("kind") == "whitepaper" and register.get("fetched")
|
|
79
|
+
for entry in register.get("entries", [])
|
|
80
|
+
)
|
|
81
|
+
return {
|
|
82
|
+
"snapshot_date": snapshot.get("snapshot_date"),
|
|
83
|
+
"registers": registers,
|
|
84
|
+
"whitepaper_format_coverage": dict(formats),
|
|
85
|
+
"notice": NOTICE,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def recent_changes(
|
|
90
|
+
changelog: list[dict[str, Any]], limit: int = 50, change_type: str = "all"
|
|
91
|
+
) -> dict[str, Any]:
|
|
92
|
+
records = [
|
|
93
|
+
record
|
|
94
|
+
for record in changelog
|
|
95
|
+
if record.get("change") != "baseline"
|
|
96
|
+
and (change_type == "all" or record.get("change") == change_type)
|
|
97
|
+
]
|
|
98
|
+
records = list(reversed(records)) # newest snapshot entries last in file
|
|
99
|
+
return {
|
|
100
|
+
"total_changes": len(records),
|
|
101
|
+
"changes": records[: max(1, min(limit, 200))],
|
|
102
|
+
"notice": NOTICE
|
|
103
|
+
+ " A 'removed' record means the entry left the register export; the "
|
|
104
|
+
"register itself does not state why.",
|
|
105
|
+
}
|