@ansvar/eu-regulations-mcp 0.8.0 → 1.1.0
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.
- package/README.md +76 -29
- package/data/regulations.db +0 -0
- package/data/seed/applicability/chips-act.json +67 -0
- package/data/seed/applicability/crma.json +85 -0
- package/data/seed/chips-act.json +714 -0
- package/data/seed/crma.json +877 -0
- package/data/seed/mappings/iso27001-chips-act.json +50 -0
- package/data/seed/mappings/iso27001-crma.json +50 -0
- package/data/seed/mappings/nist-csf-chips-act.json +56 -0
- package/data/seed/mappings/nist-csf-crma.json +56 -0
- package/dist/database/sqlite-adapter.d.ts +2 -2
- package/dist/database/sqlite-adapter.d.ts.map +1 -1
- package/dist/database/sqlite-adapter.js.map +1 -1
- package/dist/http-server.js +27 -5
- package/dist/http-server.js.map +1 -1
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/dist/tools/about.d.ts +40 -0
- package/dist/tools/about.d.ts.map +1 -0
- package/dist/tools/about.js +61 -0
- package/dist/tools/about.js.map +1 -0
- package/dist/tools/list.d.ts +7 -0
- package/dist/tools/list.d.ts.map +1 -1
- package/dist/tools/list.js +73 -8
- package/dist/tools/list.js.map +1 -1
- package/dist/tools/registry.d.ts +11 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +56 -4
- package/dist/tools/registry.js.map +1 -1
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +17 -5
- package/dist/worker.js.map +1 -1
- package/package.json +8 -7
- package/scripts/add-cross-references.sql +0 -200
- package/scripts/analyze-survey-responses.ts +0 -285
- package/scripts/build-db.ts +0 -421
- package/scripts/bulk-reingest-all.ts +0 -331
- package/scripts/check-updates.ts +0 -294
- package/scripts/extract-eprivacy-recitals.ts +0 -98
- package/scripts/ingest-eurlex-browser.ts +0 -113
- package/scripts/ingest-eurlex.ts +0 -346
- package/scripts/ingest-unece.ts +0 -382
- package/scripts/migrate-postgres.ts +0 -445
- package/scripts/migrate-to-postgres.ts +0 -353
- package/scripts/reingest-all-with-recitals.sh +0 -81
- package/scripts/sync-versions.ts +0 -206
- package/scripts/test-cross-refs.js +0 -26
- package/scripts/test-postgres-adapter.ts +0 -146
- package/scripts/update-dora-rts-metadata.ts +0 -112
- package/src/database/postgres-adapter.ts +0 -84
- package/src/database/sqlite-adapter.ts +0 -44
- package/src/database/types.ts +0 -10
- package/src/http-server.ts +0 -149
- package/src/index.ts +0 -61
- package/src/middleware/rate-limit.ts +0 -104
- package/src/tools/applicability.ts +0 -167
- package/src/tools/article.ts +0 -81
- package/src/tools/compare.ts +0 -217
- package/src/tools/definitions.ts +0 -49
- package/src/tools/evidence.ts +0 -84
- package/src/tools/list.ts +0 -124
- package/src/tools/map.ts +0 -86
- package/src/tools/recital.ts +0 -60
- package/src/tools/registry.ts +0 -311
- package/src/tools/search.ts +0 -297
- package/src/worker.ts +0 -708
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"control_id": "A.5.7",
|
|
4
|
+
"control_name": "Threat intelligence",
|
|
5
|
+
"regulation": "CHIPS_ACT",
|
|
6
|
+
"articles": ["19", "20"],
|
|
7
|
+
"coverage": "partial",
|
|
8
|
+
"notes": "Art 19-20 require strategic mapping and monitoring of semiconductor supply chain vulnerabilities and disruptions"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"control_id": "A.5.19",
|
|
12
|
+
"control_name": "Information security in supplier relationships",
|
|
13
|
+
"regulation": "CHIPS_ACT",
|
|
14
|
+
"articles": ["21", "22"],
|
|
15
|
+
"coverage": "full",
|
|
16
|
+
"notes": "Art 21-22 establish key market actor monitoring and alert mechanisms for supply chain security"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"control_id": "A.5.22",
|
|
20
|
+
"control_name": "Monitoring, review and change management of supplier services",
|
|
21
|
+
"regulation": "CHIPS_ACT",
|
|
22
|
+
"articles": ["20", "22"],
|
|
23
|
+
"coverage": "full",
|
|
24
|
+
"notes": "Art 20 continuous monitoring of semiconductor supply chains; Art 22 alert mechanisms for disruptions"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"control_id": "A.5.23",
|
|
28
|
+
"control_name": "Information security for use of cloud services",
|
|
29
|
+
"regulation": "CHIPS_ACT",
|
|
30
|
+
"articles": ["13", "14"],
|
|
31
|
+
"coverage": "related",
|
|
32
|
+
"notes": "Art 13-14 Integrated Production Facilities and Open EU Foundries must ensure security of semiconductor design data and IP"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"control_id": "A.8.8",
|
|
36
|
+
"control_name": "Management of technical vulnerabilities",
|
|
37
|
+
"regulation": "CHIPS_ACT",
|
|
38
|
+
"articles": ["22", "24"],
|
|
39
|
+
"coverage": "partial",
|
|
40
|
+
"notes": "Art 22-24 crisis response mechanisms address semiconductor supply vulnerabilities and emergency toolbox measures"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"control_id": "A.8.9",
|
|
44
|
+
"control_name": "Configuration management",
|
|
45
|
+
"regulation": "CHIPS_ACT",
|
|
46
|
+
"articles": ["13", "17"],
|
|
47
|
+
"coverage": "related",
|
|
48
|
+
"notes": "Art 13 Integrated Production Facilities; Art 17 Design Centers of Excellence maintain secure semiconductor design configurations"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"control_id": "A.5.7",
|
|
4
|
+
"control_name": "Threat intelligence",
|
|
5
|
+
"regulation": "CRMA",
|
|
6
|
+
"articles": ["18", "19"],
|
|
7
|
+
"coverage": "partial",
|
|
8
|
+
"notes": "Art 18-19 strategic mapping and monitoring of critical raw materials supply chain risks and vulnerabilities"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"control_id": "A.5.19",
|
|
12
|
+
"control_name": "Information security in supplier relationships",
|
|
13
|
+
"regulation": "CRMA",
|
|
14
|
+
"articles": ["4", "5"],
|
|
15
|
+
"coverage": "full",
|
|
16
|
+
"notes": "Art 4-5 supply chain due diligence and transparency requirements for critical raw materials"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"control_id": "A.5.20",
|
|
20
|
+
"control_name": "Addressing information security within supplier agreements",
|
|
21
|
+
"regulation": "CRMA",
|
|
22
|
+
"articles": ["5", "15"],
|
|
23
|
+
"coverage": "full",
|
|
24
|
+
"notes": "Art 5 supply chain due diligence; Art 15 permitting procedures with security considerations"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"control_id": "A.5.22",
|
|
28
|
+
"control_name": "Monitoring, review and change management of supplier services",
|
|
29
|
+
"regulation": "CRMA",
|
|
30
|
+
"articles": ["19", "29"],
|
|
31
|
+
"coverage": "full",
|
|
32
|
+
"notes": "Art 19 continuous monitoring; Art 29 regular review and updates of critical raw materials list"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"control_id": "A.5.30",
|
|
36
|
+
"control_name": "ICT readiness for business continuity",
|
|
37
|
+
"regulation": "CRMA",
|
|
38
|
+
"articles": ["23", "25"],
|
|
39
|
+
"coverage": "partial",
|
|
40
|
+
"notes": "Art 23-25 crisis response mechanisms and emergency supply measures ensure business continuity"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"control_id": "A.8.8",
|
|
44
|
+
"control_name": "Management of technical vulnerabilities",
|
|
45
|
+
"regulation": "CRMA",
|
|
46
|
+
"articles": ["23", "24"],
|
|
47
|
+
"coverage": "partial",
|
|
48
|
+
"notes": "Art 23-24 address supply chain vulnerabilities through alert mechanisms and emergency toolbox"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"framework": "NIST_CSF",
|
|
4
|
+
"control_id": "GV.SC-01",
|
|
5
|
+
"control_name": "Establish and maintain a cybersecurity supply chain risk management policy",
|
|
6
|
+
"regulation": "CHIPS_ACT",
|
|
7
|
+
"articles": ["19", "20", "21"],
|
|
8
|
+
"coverage": "full",
|
|
9
|
+
"notes": "Art 19-21 establish comprehensive semiconductor supply chain risk management framework"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"framework": "NIST_CSF",
|
|
13
|
+
"control_id": "GV.SC-02",
|
|
14
|
+
"control_name": "Establish cybersecurity requirements for suppliers",
|
|
15
|
+
"regulation": "CHIPS_ACT",
|
|
16
|
+
"articles": ["13", "21"],
|
|
17
|
+
"coverage": "partial",
|
|
18
|
+
"notes": "Art 13 Integrated Production Facilities; Art 21 key market actor requirements"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"framework": "NIST_CSF",
|
|
22
|
+
"control_id": "ID.RA-02",
|
|
23
|
+
"control_name": "Cyber threat intelligence is received from information sharing forums",
|
|
24
|
+
"regulation": "CHIPS_ACT",
|
|
25
|
+
"articles": ["20", "22"],
|
|
26
|
+
"coverage": "full",
|
|
27
|
+
"notes": "Art 20 monitoring and assessment; Art 22 alert mechanisms and information sharing"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"framework": "NIST_CSF",
|
|
31
|
+
"control_id": "ID.SC-01",
|
|
32
|
+
"control_name": "Suppliers are identified, prioritized, and assessed",
|
|
33
|
+
"regulation": "CHIPS_ACT",
|
|
34
|
+
"articles": ["19", "21"],
|
|
35
|
+
"coverage": "full",
|
|
36
|
+
"notes": "Art 19 strategic mapping; Art 21 identification of key market actors in semiconductor supply chain"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"framework": "NIST_CSF",
|
|
40
|
+
"control_id": "ID.SC-02",
|
|
41
|
+
"control_name": "Suppliers are monitored for performance",
|
|
42
|
+
"regulation": "CHIPS_ACT",
|
|
43
|
+
"articles": ["20", "21", "22"],
|
|
44
|
+
"coverage": "full",
|
|
45
|
+
"notes": "Art 20-22 continuous monitoring of semiconductor supply chain performance and disruptions"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"framework": "NIST_CSF",
|
|
49
|
+
"control_id": "RS.MA-01",
|
|
50
|
+
"control_name": "The incident response plan is executed during or after an incident",
|
|
51
|
+
"regulation": "CHIPS_ACT",
|
|
52
|
+
"articles": ["23", "24"],
|
|
53
|
+
"coverage": "full",
|
|
54
|
+
"notes": "Art 23-24 semiconductor crisis stage activation and emergency toolbox response measures"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"framework": "NIST_CSF",
|
|
4
|
+
"control_id": "GV.SC-01",
|
|
5
|
+
"control_name": "Establish and maintain a cybersecurity supply chain risk management policy",
|
|
6
|
+
"regulation": "CRMA",
|
|
7
|
+
"articles": ["4", "5", "18"],
|
|
8
|
+
"coverage": "full",
|
|
9
|
+
"notes": "Art 4-5 supply chain due diligence; Art 18-19 strategic mapping and risk management for critical raw materials"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"framework": "NIST_CSF",
|
|
13
|
+
"control_id": "GV.SC-02",
|
|
14
|
+
"control_name": "Establish cybersecurity requirements for suppliers",
|
|
15
|
+
"regulation": "CRMA",
|
|
16
|
+
"articles": ["5", "15"],
|
|
17
|
+
"coverage": "partial",
|
|
18
|
+
"notes": "Art 5 supply chain transparency; Art 15 permitting with security considerations"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"framework": "NIST_CSF",
|
|
22
|
+
"control_id": "ID.RA-01",
|
|
23
|
+
"control_name": "Asset vulnerabilities are identified and documented",
|
|
24
|
+
"regulation": "CRMA",
|
|
25
|
+
"articles": ["18", "19"],
|
|
26
|
+
"coverage": "full",
|
|
27
|
+
"notes": "Art 18-19 identification and monitoring of critical raw materials supply chain vulnerabilities"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"framework": "NIST_CSF",
|
|
31
|
+
"control_id": "ID.SC-01",
|
|
32
|
+
"control_name": "Suppliers are identified, prioritized, and assessed",
|
|
33
|
+
"regulation": "CRMA",
|
|
34
|
+
"articles": ["4", "18", "19"],
|
|
35
|
+
"coverage": "full",
|
|
36
|
+
"notes": "Art 4 strategic projects; Art 18-19 mapping and assessment of critical raw materials suppliers"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"framework": "NIST_CSF",
|
|
40
|
+
"control_id": "ID.SC-02",
|
|
41
|
+
"control_name": "Suppliers are monitored for performance",
|
|
42
|
+
"regulation": "CRMA",
|
|
43
|
+
"articles": ["19", "29"],
|
|
44
|
+
"coverage": "full",
|
|
45
|
+
"notes": "Art 19 continuous monitoring; Art 29 periodic review and update of critical raw materials list"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"framework": "NIST_CSF",
|
|
49
|
+
"control_id": "RS.MA-01",
|
|
50
|
+
"control_name": "The incident response plan is executed during or after an incident",
|
|
51
|
+
"regulation": "CRMA",
|
|
52
|
+
"articles": ["23", "24", "25"],
|
|
53
|
+
"coverage": "full",
|
|
54
|
+
"notes": "Art 23-25 crisis response mechanisms, emergency toolbox, and supply security measures"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type Database from '
|
|
1
|
+
import type Database from '@ansvar/mcp-sqlite';
|
|
2
2
|
import type { DatabaseAdapter } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Adapter that wraps better-sqlite3 Database to match DatabaseAdapter interface.
|
|
5
5
|
* Allows existing SQLite-based entry points (stdio) to work with the new adapter interface.
|
|
6
6
|
*/
|
|
7
|
-
export declare function createSqliteAdapter(db: Database
|
|
7
|
+
export declare function createSqliteAdapter(db: InstanceType<typeof Database>): DatabaseAdapter;
|
|
8
8
|
//# sourceMappingURL=sqlite-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-adapter.d.ts","sourceRoot":"","sources":["../../src/database/sqlite-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"sqlite-adapter.d.ts","sourceRoot":"","sources":["../../src/database/sqlite-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,YAAY,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,YAAY,CAAC,OAAO,QAAQ,CAAC,GAAG,eAAe,CAoCtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-adapter.js","sourceRoot":"","sources":["../../src/database/sqlite-adapter.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"sqlite-adapter.js","sourceRoot":"","sources":["../../src/database/sqlite-adapter.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAiC;IACnE,OAAO;QACL,IAAI,EAAE,QAAiB;QAEvB,KAAK,CAAC,KAAK,CAAU,GAAW,EAAE,MAAc;YAC9C,IAAI,CAAC;gBACH,6CAA6C;gBAC7C,IAAI,SAAS,GAAG,GAAG;oBACjB,mCAAmC;qBAClC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;oBACvB,0EAA0E;qBACzE,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC;oBACjC,mDAAmD;qBAClD,OAAO,CAAC,cAAc,EAAE,kBAAkB,CAAC;qBAC3C,OAAO,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;oBAClD,4CAA4C;oBAC5C,gFAAgF;oBAChF,2EAA2E;qBAC1E,OAAO,CAAC,sCAAsC,EAAE,QAAQ,CAAC,CAAC;gBAE7D,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBACnC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;gBACvD,OAAO;oBACL,IAAI,EAAE,IAAW;oBACjB,QAAQ,EAAE,IAAI,CAAC,MAAM;iBACtB,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;gBAC1D,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QAED,KAAK,CAAC,KAAK;YACT,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/http-server.js
CHANGED
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
import { createServer } from 'node:http';
|
|
9
9
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
10
10
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
11
|
-
import Database from '
|
|
11
|
+
import Database from '@ansvar/mcp-sqlite';
|
|
12
12
|
import { fileURLToPath } from 'url';
|
|
13
13
|
import { dirname, join } from 'path';
|
|
14
|
-
import { randomUUID } from 'crypto';
|
|
14
|
+
import { createHash, randomUUID } from 'crypto';
|
|
15
|
+
import { readFileSync, statSync } from 'fs';
|
|
15
16
|
import { registerTools } from './tools/registry.js';
|
|
16
17
|
import { createSqliteAdapter } from './database/sqlite-adapter.js';
|
|
17
18
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -20,6 +21,9 @@ const __dirname = dirname(__filename);
|
|
|
20
21
|
const DB_PATH = process.env.EU_COMPLIANCE_DB_PATH || join(__dirname, '..', 'data', 'regulations.db');
|
|
21
22
|
// HTTP server port
|
|
22
23
|
const PORT = parseInt(process.env.PORT || '3000', 10);
|
|
24
|
+
// Read package version
|
|
25
|
+
const PKG_PATH = join(__dirname, '..', 'package.json');
|
|
26
|
+
const pkgVersion = JSON.parse(readFileSync(PKG_PATH, 'utf-8')).version;
|
|
23
27
|
let db;
|
|
24
28
|
function getDatabase() {
|
|
25
29
|
if (!db) {
|
|
@@ -33,19 +37,37 @@ function getDatabase() {
|
|
|
33
37
|
}
|
|
34
38
|
return db;
|
|
35
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Compute about context at startup: version, DB fingerprint, build date.
|
|
42
|
+
*/
|
|
43
|
+
function computeAboutContext() {
|
|
44
|
+
let fingerprint = 'unknown';
|
|
45
|
+
let dbBuilt = new Date().toISOString();
|
|
46
|
+
try {
|
|
47
|
+
const dbBuffer = readFileSync(DB_PATH);
|
|
48
|
+
fingerprint = createHash('sha256').update(dbBuffer).digest('hex').slice(0, 12);
|
|
49
|
+
const dbStat = statSync(DB_PATH);
|
|
50
|
+
dbBuilt = dbStat.mtime.toISOString();
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Non-fatal: fingerprint stays 'unknown' if DB can't be read for hashing
|
|
54
|
+
}
|
|
55
|
+
return { version: pkgVersion, fingerprint, dbBuilt };
|
|
56
|
+
}
|
|
57
|
+
const aboutContext = computeAboutContext();
|
|
36
58
|
// Create MCP server instance
|
|
37
59
|
function createMcpServer() {
|
|
38
60
|
const db = getDatabase();
|
|
39
61
|
const server = new Server({
|
|
40
62
|
name: 'eu-regulations-mcp',
|
|
41
|
-
version:
|
|
63
|
+
version: pkgVersion,
|
|
42
64
|
}, {
|
|
43
65
|
capabilities: {
|
|
44
66
|
tools: {},
|
|
45
67
|
},
|
|
46
68
|
});
|
|
47
|
-
// Register all tools using shared registry
|
|
48
|
-
registerTools(server, db);
|
|
69
|
+
// Register all tools using shared registry (with about context)
|
|
70
|
+
registerTools(server, db, aboutContext);
|
|
49
71
|
return server;
|
|
50
72
|
}
|
|
51
73
|
// Start HTTP server with Streamable HTTP transport
|
package/dist/http-server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-server.js","sourceRoot":"","sources":["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C,CAAC;QAC5E,OAAO,CAAC,KAAK,CAAC,kCAAkC,IAAI,MAAM,CAAC,CAAC;QAC5D,OAAO,CAAC,KAAK,CAAC,kCAAkC,IAAI,SAAS,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,oBAAoB;IACpB,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;QACzB,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACpD,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE;YACpB,IAAI,EAAE;gBAAE,EAAE,CAAC,KAAK,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
-
import Database from '
|
|
4
|
+
import Database from '@ansvar/mcp-sqlite';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import { dirname, join } from 'path';
|
|
7
|
+
import { createHash } from 'crypto';
|
|
8
|
+
import { readFileSync, statSync } from 'fs';
|
|
7
9
|
import { registerTools } from './tools/registry.js';
|
|
8
10
|
import { createSqliteAdapter } from './database/sqlite-adapter.js';
|
|
9
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
12
|
const __dirname = dirname(__filename);
|
|
11
13
|
// Database path - look for regulations.db in data folder
|
|
12
14
|
const DB_PATH = process.env.EU_COMPLIANCE_DB_PATH || join(__dirname, '..', 'data', 'regulations.db');
|
|
15
|
+
// Read package version
|
|
16
|
+
const PKG_PATH = join(__dirname, '..', 'package.json');
|
|
17
|
+
const pkgVersion = JSON.parse(readFileSync(PKG_PATH, 'utf-8')).version;
|
|
13
18
|
let db;
|
|
14
19
|
function getDatabase() {
|
|
15
20
|
if (!db) {
|
|
@@ -23,16 +28,34 @@ function getDatabase() {
|
|
|
23
28
|
}
|
|
24
29
|
return db;
|
|
25
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Compute about context at startup: version, DB fingerprint, build date.
|
|
33
|
+
*/
|
|
34
|
+
function computeAboutContext() {
|
|
35
|
+
let fingerprint = 'unknown';
|
|
36
|
+
let dbBuilt = new Date().toISOString();
|
|
37
|
+
try {
|
|
38
|
+
const dbBuffer = readFileSync(DB_PATH);
|
|
39
|
+
fingerprint = createHash('sha256').update(dbBuffer).digest('hex').slice(0, 12);
|
|
40
|
+
const dbStat = statSync(DB_PATH);
|
|
41
|
+
dbBuilt = dbStat.mtime.toISOString();
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Non-fatal: fingerprint stays 'unknown' if DB can't be read for hashing
|
|
45
|
+
}
|
|
46
|
+
return { version: pkgVersion, fingerprint, dbBuilt };
|
|
47
|
+
}
|
|
48
|
+
const aboutContext = computeAboutContext();
|
|
26
49
|
const server = new Server({
|
|
27
50
|
name: 'eu-regulations-mcp',
|
|
28
|
-
version:
|
|
51
|
+
version: pkgVersion,
|
|
29
52
|
}, {
|
|
30
53
|
capabilities: {
|
|
31
54
|
tools: {},
|
|
32
55
|
},
|
|
33
56
|
});
|
|
34
|
-
// Register all tools using shared registry
|
|
35
|
-
registerTools(server, getDatabase());
|
|
57
|
+
// Register all tools using shared registry (with about context)
|
|
58
|
+
registerTools(server, getDatabase(), aboutContext);
|
|
36
59
|
// Start the server
|
|
37
60
|
async function main() {
|
|
38
61
|
const transport = new StdioServerTransport();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAKjF,OAAO,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAKjF,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAInE,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,yDAAyD;AACzD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAErG,uBAAuB;AACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AACvD,MAAM,UAAU,GAAW,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAA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KAAK,EAAE,EAAE;KACV;CACF,CACF,CAAC;AAEF,gEAAgE;AAChE,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,YAAY,CAAC,CAAC;AAEnD,mBAAmB;AACnB,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;AACrD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DatabaseAdapter } from '../database/types.js';
|
|
2
|
+
export interface AboutContext {
|
|
3
|
+
version: string;
|
|
4
|
+
fingerprint: string;
|
|
5
|
+
dbBuilt: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AboutResult {
|
|
8
|
+
server: {
|
|
9
|
+
name: string;
|
|
10
|
+
package: string;
|
|
11
|
+
version: string;
|
|
12
|
+
suite: string;
|
|
13
|
+
repository: string;
|
|
14
|
+
};
|
|
15
|
+
dataset: {
|
|
16
|
+
fingerprint: string;
|
|
17
|
+
built: string;
|
|
18
|
+
jurisdiction: string;
|
|
19
|
+
content_basis: string;
|
|
20
|
+
counts: Record<string, number>;
|
|
21
|
+
freshness: {
|
|
22
|
+
last_checked: string | null;
|
|
23
|
+
check_method: string;
|
|
24
|
+
source_registry_entries: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
provenance: {
|
|
28
|
+
sources: string[];
|
|
29
|
+
license: string;
|
|
30
|
+
authenticity_note: string;
|
|
31
|
+
};
|
|
32
|
+
security: {
|
|
33
|
+
access_model: string;
|
|
34
|
+
network_access: boolean;
|
|
35
|
+
filesystem_access: boolean;
|
|
36
|
+
arbitrary_execution: boolean;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export declare function getAbout(db: DatabaseAdapter, context: AboutContext): Promise<AboutResult>;
|
|
40
|
+
//# sourceMappingURL=about.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"about.d.ts","sourceRoot":"","sources":["../../src/tools/about.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/B,SAAS,EAAE;YACT,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;YAC5B,YAAY,EAAE,MAAM,CAAC;YACrB,uBAAuB,EAAE,MAAM,CAAC;SACjC,CAAC;KACH,CAAC;IACF,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,QAAQ,EAAE;QACR,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,OAAO,CAAC;QACxB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,mBAAmB,EAAE,OAAO,CAAC;KAC9B,CAAC;CACH;AAED,wBAAsB,QAAQ,CAC5B,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,WAAW,CAAC,CA0EtB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export async function getAbout(db, context) {
|
|
2
|
+
// Run all count queries in parallel
|
|
3
|
+
const [regulationsResult, articlesResult, recitalsResult, definitionsResult, controlMappingsResult, applicabilityResult, evidenceResult, freshnessResult,] = await Promise.all([
|
|
4
|
+
db.query('SELECT COUNT(*) as count FROM regulations'),
|
|
5
|
+
db.query('SELECT COUNT(*) as count FROM articles'),
|
|
6
|
+
db.query('SELECT COUNT(*) as count FROM recitals'),
|
|
7
|
+
db.query('SELECT COUNT(*) as count FROM definitions'),
|
|
8
|
+
db.query('SELECT COUNT(*) as count FROM control_mappings'),
|
|
9
|
+
db.query('SELECT COUNT(*) as count FROM applicability_rules'),
|
|
10
|
+
db.query('SELECT COUNT(*) as count FROM evidence_requirements').catch(() => ({ rows: [{ count: 0 }] })),
|
|
11
|
+
db.query('SELECT COUNT(*) as entry_count, MAX(last_fetched) as last_checked FROM source_registry').catch(() => ({ rows: [{ entry_count: 0, last_checked: null }] })),
|
|
12
|
+
]);
|
|
13
|
+
const counts = {
|
|
14
|
+
regulations: Number(regulationsResult.rows[0].count),
|
|
15
|
+
articles: Number(articlesResult.rows[0].count),
|
|
16
|
+
recitals: Number(recitalsResult.rows[0].count),
|
|
17
|
+
definitions: Number(definitionsResult.rows[0].count),
|
|
18
|
+
control_mappings: Number(controlMappingsResult.rows[0].count),
|
|
19
|
+
applicability_rules: Number(applicabilityResult.rows[0].count),
|
|
20
|
+
evidence_requirements: Number(evidenceResult.rows[0].count),
|
|
21
|
+
};
|
|
22
|
+
const freshnessRow = freshnessResult.rows[0];
|
|
23
|
+
return {
|
|
24
|
+
server: {
|
|
25
|
+
name: 'EU Regulations MCP',
|
|
26
|
+
package: '@ansvar/eu-regulations-mcp',
|
|
27
|
+
version: context.version,
|
|
28
|
+
suite: 'Ansvar Compliance Suite',
|
|
29
|
+
repository: 'https://github.com/Ansvar-Systems/EU_compliance_MCP',
|
|
30
|
+
},
|
|
31
|
+
dataset: {
|
|
32
|
+
fingerprint: context.fingerprint,
|
|
33
|
+
built: context.dbBuilt,
|
|
34
|
+
jurisdiction: 'EU',
|
|
35
|
+
content_basis: 'EUR-Lex consolidated texts with amendments applied as of build date. ' +
|
|
36
|
+
'Original OJ text used where no consolidation exists (e.g., DORA RTS/ITS). ' +
|
|
37
|
+
'Not an official legal publication.',
|
|
38
|
+
counts,
|
|
39
|
+
freshness: {
|
|
40
|
+
last_checked: freshnessRow.last_checked,
|
|
41
|
+
check_method: 'Daily EUR-Lex RSS + version comparison',
|
|
42
|
+
source_registry_entries: Number(freshnessRow.entry_count),
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
provenance: {
|
|
46
|
+
sources: ['EUR-Lex', 'UNECE'],
|
|
47
|
+
license: 'Apache-2.0 (server code). EU legal documents reusable under EUR-Lex reuse policy; ' +
|
|
48
|
+
'editorial content under CC BY 4.0.',
|
|
49
|
+
authenticity_note: 'Only documents published in the Official Journal of the EU are deemed authentic ' +
|
|
50
|
+
'(Article 297 TFEU). This dataset is derived from EUR-Lex and should be verified ' +
|
|
51
|
+
'against official publications for legal purposes.',
|
|
52
|
+
},
|
|
53
|
+
security: {
|
|
54
|
+
access_model: 'read-only',
|
|
55
|
+
network_access: false,
|
|
56
|
+
filesystem_access: false,
|
|
57
|
+
arbitrary_execution: false,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=about.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"about.js","sourceRoot":"","sources":["../../src/tools/about.ts"],"names":[],"mappings":"AAyCA,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,EAAm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.js';
|
|
2
2
|
export interface ListInput {
|
|
3
3
|
regulation?: string;
|
|
4
|
+
category?: string;
|
|
4
5
|
}
|
|
5
6
|
export interface Chapter {
|
|
6
7
|
number: string;
|
|
@@ -17,6 +18,12 @@ export interface RegulationInfo {
|
|
|
17
18
|
}
|
|
18
19
|
export interface ListResult {
|
|
19
20
|
regulations: RegulationInfo[];
|
|
21
|
+
category_summary?: string;
|
|
20
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Regulation categories for discoverability.
|
|
25
|
+
* Maps category name → array of regulation IDs.
|
|
26
|
+
*/
|
|
27
|
+
export declare const REGULATION_CATEGORIES: Record<string, string[]>;
|
|
21
28
|
export declare function listRegulations(db: DatabaseAdapter, input: ListInput): Promise<ListResult>;
|
|
22
29
|
//# sourceMappingURL=list.d.ts.map
|
package/dist/tools/list.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/tools/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/tools/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAe1D,CAAC;AAEF,wBAAsB,eAAe,CACnC,EAAE,EAAE,eAAe,EACnB,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,UAAU,CAAC,CAoJrB"}
|
package/dist/tools/list.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regulation categories for discoverability.
|
|
3
|
+
* Maps category name → array of regulation IDs.
|
|
4
|
+
*/
|
|
5
|
+
export const REGULATION_CATEGORIES = {
|
|
6
|
+
cybersecurity: ['NIS2', 'CYBERSECURITY_ACT', 'CYBER_SOLIDARITY', 'EUCC'],
|
|
7
|
+
data_protection: ['GDPR', 'EPRIVACY', 'LED', 'DGA', 'DATA_ACT', 'EHDS'],
|
|
8
|
+
digital_services: ['DSA', 'DMA', 'EIDAS2', 'EECC'],
|
|
9
|
+
financial_services: ['DORA', 'MICA', 'MIFID2', 'MIFIR', 'PSD2', 'AIFMD', 'SFDR', 'EU_TAXONOMY',
|
|
10
|
+
'DORA_RTS_ICT_RISK', 'DORA_RTS_INCIDENT_CLASS', 'DORA_RTS_INCIDENT_REPORTING',
|
|
11
|
+
'DORA_ITS_INCIDENT_FORMS', 'DORA_RTS_TLPT', 'DORA_RTS_ICT_SERVICES',
|
|
12
|
+
'DORA_RTS_CRITICAL_PROVIDER', 'DORA_RTS_OVERSIGHT',
|
|
13
|
+
'DORA_RTS_OVERSIGHT_FEES', 'DORA_ITS_REGISTER'],
|
|
14
|
+
ai_and_technology: ['AI_ACT', 'CHIPS_ACT'],
|
|
15
|
+
product_safety: ['CRA', 'GPSR', 'MACHINERY', 'RED', 'PLD'],
|
|
16
|
+
healthcare: ['MDR', 'IVDR', 'EHDS'],
|
|
17
|
+
sustainability: ['CSRD', 'CSDDD', 'EU_TAXONOMY', 'SFDR', 'CBAM', 'EUDR', 'CRMA'],
|
|
18
|
+
critical_infrastructure: ['CER', 'NIS2'],
|
|
19
|
+
automotive: ['UN_R155', 'UN_R156'],
|
|
20
|
+
};
|
|
1
21
|
export async function listRegulations(db, input) {
|
|
2
|
-
const { regulation } = input;
|
|
22
|
+
const { regulation, category } = input;
|
|
3
23
|
if (regulation) {
|
|
4
24
|
// Get specific regulation with chapters
|
|
5
25
|
const regResult = await db.query(`SELECT id, full_name, celex_id, effective_date
|
|
@@ -51,14 +71,59 @@ export async function listRegulations(db, input) {
|
|
|
51
71
|
GROUP BY r.id, r.full_name, r.celex_id, r.effective_date
|
|
52
72
|
ORDER BY r.id`);
|
|
53
73
|
const rows = result.rows;
|
|
74
|
+
const allRegulations = rows.map(row => ({
|
|
75
|
+
id: row.id,
|
|
76
|
+
full_name: row.full_name,
|
|
77
|
+
celex_id: row.celex_id,
|
|
78
|
+
effective_date: row.effective_date,
|
|
79
|
+
article_count: Number(row.article_count),
|
|
80
|
+
}));
|
|
81
|
+
// Filter by category if specified
|
|
82
|
+
if (category) {
|
|
83
|
+
const catKey = category.toLowerCase();
|
|
84
|
+
if (!(catKey in REGULATION_CATEGORIES)) {
|
|
85
|
+
const available = Object.keys(REGULATION_CATEGORIES).sort().join(', ');
|
|
86
|
+
return {
|
|
87
|
+
regulations: [],
|
|
88
|
+
category_summary: `Category '${category}' not found. Available categories: ${available}`,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const catIds = new Set(REGULATION_CATEGORIES[catKey]);
|
|
92
|
+
const filtered = allRegulations.filter(r => catIds.has(r.id));
|
|
93
|
+
return {
|
|
94
|
+
regulations: filtered,
|
|
95
|
+
category_summary: `${category} (${filtered.length} regulations)`,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
// No category filter: return grouped by category
|
|
99
|
+
const regById = new Map(allRegulations.map(r => [r.id, r]));
|
|
100
|
+
const categorized = new Set();
|
|
101
|
+
const lines = [];
|
|
102
|
+
lines.push(`${allRegulations.length} regulations in ${Object.keys(REGULATION_CATEGORIES).length} categories\n`);
|
|
103
|
+
for (const [catName, catIds] of Object.entries(REGULATION_CATEGORIES).sort()) {
|
|
104
|
+
const catRegs = catIds
|
|
105
|
+
.filter(id => regById.has(id))
|
|
106
|
+
.map(id => regById.get(id));
|
|
107
|
+
if (catRegs.length === 0)
|
|
108
|
+
continue;
|
|
109
|
+
lines.push(`${catName} (${catRegs.length}):`);
|
|
110
|
+
for (const r of catRegs) {
|
|
111
|
+
lines.push(` ${r.id}: ${r.full_name} (${r.article_count} articles)`);
|
|
112
|
+
categorized.add(r.id);
|
|
113
|
+
}
|
|
114
|
+
lines.push('');
|
|
115
|
+
}
|
|
116
|
+
// List uncategorized regulations
|
|
117
|
+
const uncategorized = allRegulations.filter(r => !categorized.has(r.id));
|
|
118
|
+
if (uncategorized.length > 0) {
|
|
119
|
+
lines.push(`other (${uncategorized.length}):`);
|
|
120
|
+
for (const r of uncategorized) {
|
|
121
|
+
lines.push(` ${r.id}: ${r.full_name} (${r.article_count} articles)`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
54
124
|
return {
|
|
55
|
-
regulations:
|
|
56
|
-
|
|
57
|
-
full_name: row.full_name,
|
|
58
|
-
celex_id: row.celex_id,
|
|
59
|
-
effective_date: row.effective_date,
|
|
60
|
-
article_count: Number(row.article_count),
|
|
61
|
-
})),
|
|
125
|
+
regulations: allRegulations,
|
|
126
|
+
category_summary: lines.join('\n'),
|
|
62
127
|
};
|
|
63
128
|
}
|
|
64
129
|
//# sourceMappingURL=list.js.map
|