@cyanheads/eur-lex-mcp-server 0.1.1

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.
Files changed (81) hide show
  1. package/AGENTS.md +383 -0
  2. package/CLAUDE.md +383 -0
  3. package/Dockerfile +99 -0
  4. package/LICENSE +201 -0
  5. package/README.md +343 -0
  6. package/changelog/0.1.x/0.1.1.md +31 -0
  7. package/changelog/template.md +127 -0
  8. package/dist/config/server-config.d.ts +16 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +43 -0
  11. package/dist/config/server-config.js.map +1 -0
  12. package/dist/index.d.ts +8 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +30 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/prompts/definitions/eurlex-comparative-analysis.prompt.d.ts +10 -0
  17. package/dist/mcp-server/prompts/definitions/eurlex-comparative-analysis.prompt.d.ts.map +1 -0
  18. package/dist/mcp-server/prompts/definitions/eurlex-comparative-analysis.prompt.js +60 -0
  19. package/dist/mcp-server/prompts/definitions/eurlex-comparative-analysis.prompt.js.map +1 -0
  20. package/dist/mcp-server/prompts/definitions/index.d.ts +9 -0
  21. package/dist/mcp-server/prompts/definitions/index.d.ts.map +1 -0
  22. package/dist/mcp-server/prompts/definitions/index.js +7 -0
  23. package/dist/mcp-server/prompts/definitions/index.js.map +1 -0
  24. package/dist/mcp-server/resources/definitions/eurlex-document-relations.resource.d.ts +9 -0
  25. package/dist/mcp-server/resources/definitions/eurlex-document-relations.resource.d.ts.map +1 -0
  26. package/dist/mcp-server/resources/definitions/eurlex-document-relations.resource.js +91 -0
  27. package/dist/mcp-server/resources/definitions/eurlex-document-relations.resource.js.map +1 -0
  28. package/dist/mcp-server/resources/definitions/eurlex-document.resource.d.ts +9 -0
  29. package/dist/mcp-server/resources/definitions/eurlex-document.resource.d.ts.map +1 -0
  30. package/dist/mcp-server/resources/definitions/eurlex-document.resource.js +61 -0
  31. package/dist/mcp-server/resources/definitions/eurlex-document.resource.js.map +1 -0
  32. package/dist/mcp-server/resources/definitions/index.d.ts +8 -0
  33. package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
  34. package/dist/mcp-server/resources/definitions/index.js +11 -0
  35. package/dist/mcp-server/resources/definitions/index.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/eurlex-browse-subjects.tool.d.ts +25 -0
  37. package/dist/mcp-server/tools/definitions/eurlex-browse-subjects.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/eurlex-browse-subjects.tool.js +121 -0
  39. package/dist/mcp-server/tools/definitions/eurlex-browse-subjects.tool.js.map +1 -0
  40. package/dist/mcp-server/tools/definitions/eurlex-get-cases.tool.d.ts +44 -0
  41. package/dist/mcp-server/tools/definitions/eurlex-get-cases.tool.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/eurlex-get-cases.tool.js +189 -0
  43. package/dist/mcp-server/tools/definitions/eurlex-get-cases.tool.js.map +1 -0
  44. package/dist/mcp-server/tools/definitions/eurlex-get-document.tool.d.ts +46 -0
  45. package/dist/mcp-server/tools/definitions/eurlex-get-document.tool.d.ts.map +1 -0
  46. package/dist/mcp-server/tools/definitions/eurlex-get-document.tool.js +222 -0
  47. package/dist/mcp-server/tools/definitions/eurlex-get-document.tool.js.map +1 -0
  48. package/dist/mcp-server/tools/definitions/eurlex-get-relations.tool.d.ts +38 -0
  49. package/dist/mcp-server/tools/definitions/eurlex-get-relations.tool.d.ts.map +1 -0
  50. package/dist/mcp-server/tools/definitions/eurlex-get-relations.tool.js +203 -0
  51. package/dist/mcp-server/tools/definitions/eurlex-get-relations.tool.js.map +1 -0
  52. package/dist/mcp-server/tools/definitions/eurlex-lookup-celex.tool.d.ts +32 -0
  53. package/dist/mcp-server/tools/definitions/eurlex-lookup-celex.tool.d.ts.map +1 -0
  54. package/dist/mcp-server/tools/definitions/eurlex-lookup-celex.tool.js +152 -0
  55. package/dist/mcp-server/tools/definitions/eurlex-lookup-celex.tool.js.map +1 -0
  56. package/dist/mcp-server/tools/definitions/eurlex-query-sparql.tool.d.ts +25 -0
  57. package/dist/mcp-server/tools/definitions/eurlex-query-sparql.tool.d.ts.map +1 -0
  58. package/dist/mcp-server/tools/definitions/eurlex-query-sparql.tool.js +104 -0
  59. package/dist/mcp-server/tools/definitions/eurlex-query-sparql.tool.js.map +1 -0
  60. package/dist/mcp-server/tools/definitions/eurlex-search-documents.tool.d.ts +47 -0
  61. package/dist/mcp-server/tools/definitions/eurlex-search-documents.tool.d.ts.map +1 -0
  62. package/dist/mcp-server/tools/definitions/eurlex-search-documents.tool.js +203 -0
  63. package/dist/mcp-server/tools/definitions/eurlex-search-documents.tool.js.map +1 -0
  64. package/dist/mcp-server/tools/definitions/index.d.ts +207 -0
  65. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  66. package/dist/mcp-server/tools/definitions/index.js +21 -0
  67. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  68. package/dist/services/cellar-sparql/cellar-sparql-service.d.ts +27 -0
  69. package/dist/services/cellar-sparql/cellar-sparql-service.d.ts.map +1 -0
  70. package/dist/services/cellar-sparql/cellar-sparql-service.js +123 -0
  71. package/dist/services/cellar-sparql/cellar-sparql-service.js.map +1 -0
  72. package/dist/services/cellar-sparql/types.d.ts +62 -0
  73. package/dist/services/cellar-sparql/types.d.ts.map +1 -0
  74. package/dist/services/cellar-sparql/types.js +6 -0
  75. package/dist/services/cellar-sparql/types.js.map +1 -0
  76. package/dist/services/eurlex-content/eurlex-content-service.d.ts +45 -0
  77. package/dist/services/eurlex-content/eurlex-content-service.d.ts.map +1 -0
  78. package/dist/services/eurlex-content/eurlex-content-service.js +93 -0
  79. package/dist/services/eurlex-content/eurlex-content-service.js.map +1 -0
  80. package/package.json +105 -0
  81. package/server.json +161 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Casey Hand @cyanheads
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,343 @@
1
+ <div align="center">
2
+ <h1>@cyanheads/eur-lex-mcp-server</h1>
3
+ <p><b>Search EU legislation, CJEU case law, and treaties; traverse the CELLAR relationship graph; resolve EuroVoc concepts via MCP. STDIO or Streamable HTTP.</b>
4
+ <div>7 Tools • 2 Resources • 1 Prompt</div>
5
+ </p>
6
+ </div>
7
+
8
+ <div align="center">
9
+
10
+ [![Version](https://img.shields.io/badge/Version-0.1.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/eur-lex-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/eur-lex-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/eur-lex-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^6.0.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.11-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
+
12
+ </div>
13
+
14
+ <div align="center">
15
+
16
+ [![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/eur-lex-mcp-server/releases/latest/download/eur-lex-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=eur-lex-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvZXVyLWxleC1tY3Atc2VydmVyIl19) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22eur-lex-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Feur-lex-mcp-server%22%5D%7D)
17
+
18
+ [![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ ## Tools
25
+
26
+ Seven tools covering EU legal research — document discovery, content retrieval, citation resolution, case law, relationship graph traversal, EuroVoc thesaurus lookup, and raw SPARQL access:
27
+
28
+ | Tool | Description |
29
+ |:-----|:------------|
30
+ | `eurlex_search_documents` | Search EU legislation, treaties, and preparatory acts across the CELLAR corpus. Filters by document type, date range, EuroVoc concept, author institution, and in-force status. |
31
+ | `eurlex_get_document` | Fetch structured metadata and full text (HTML or Formex4 XML) for a work by CELEX number or ELI URI. |
32
+ | `eurlex_lookup_celex` | Resolve any EU legal citation — CELEX number, ELI URI, or Official Journal reference — to the canonical CELLAR work. |
33
+ | `eurlex_get_cases` | Search CJEU and General Court case law — judgments, orders, and Advocate General opinions — by case number, party name, subject, or date range. |
34
+ | `eurlex_get_relations` | Traverse the CELLAR relationship graph: amendment chain, consolidated versions, legal basis, citation network, and national transposition measures. |
35
+ | `eurlex_browse_subjects` | Search the EuroVoc multilingual thesaurus to resolve human-readable terms to EuroVoc concept IDs — required before using the `eurovoc_concept` filter in `eurlex_search_documents`. |
36
+ | `eurlex_query_sparql` | Execute a raw SPARQL SELECT query against the CELLAR Virtuoso endpoint. Results capped at 100; use only when curated tools don't cover the needed CDM ontology traversal. |
37
+
38
+ ### `eurlex_search_documents`
39
+
40
+ Search EU legislation, treaties, preparatory acts, and more across the 2.7M+ work CELLAR corpus.
41
+
42
+ - Keyword search across work titles and CELEX string patterns
43
+ - Filter by document type (`REG`, `DIR`, `DEC`, `TREATY`, and more)
44
+ - Date range filtering (`date_from`, `date_to`)
45
+ - EuroVoc concept filtering — use `eurlex_browse_subjects` first to resolve concept IDs
46
+ - Filter to in-force acts only
47
+ - Pagination via `offset` and configurable `limit` (max 100)
48
+ - Returns CELEX numbers, work URIs, document types, and dates for chaining into `eurlex_get_document`
49
+
50
+ ---
51
+
52
+ ### `eurlex_get_document`
53
+
54
+ Fetch the notice and full text of an EU legal act.
55
+
56
+ - Accepts CELEX numbers (e.g., `32016R0679`) or ELI URIs
57
+ - Returns structured metadata: title, date, document type, author institution, legal basis, EuroVoc subjects, in-force flag
58
+ - Full text in HTML (default) or Formex4 XML
59
+ - Supports all 24 official EU languages; defaults to English with automatic fallback when a translation is unavailable
60
+ - Older acts and some CJEU judgments may lack English translations
61
+
62
+ ---
63
+
64
+ ### `eurlex_lookup_celex`
65
+
66
+ Resolve EU legal identifiers to canonical CELLAR works.
67
+
68
+ - Accepts CELEX numbers, ELI URIs, and Official Journal references
69
+ - Auto-detects format with `identifier_type: "auto"` (default); set explicitly when auto-detection fails
70
+ - Returns work URI, confirmed CELEX number, document type, and date — the prerequisite step before `eurlex_get_document` or `eurlex_get_relations`
71
+
72
+ ---
73
+
74
+ ### `eurlex_get_cases`
75
+
76
+ Search CJEU and General Court case law.
77
+
78
+ - Case-specific search: case number, keyword, court (`CJEU` or `GC`), and case type (`judgment`, `order`, `ag_opinion`)
79
+ - Date range filtering
80
+ - Returns case identifier, court, date, document type, and parties
81
+ - Distinct from `eurlex_search_documents` — case law (CELEX sector 6) has its own search parameters and practitioner workflows
82
+
83
+ ---
84
+
85
+ ### `eurlex_get_relations`
86
+
87
+ Traverse the CELLAR relationship graph for a given work.
88
+
89
+ - Amendment chain (what amends it, what it amends)
90
+ - Consolidated versions (the current in-force text)
91
+ - Legal basis
92
+ - Citation network (`cdm:work_cites_work` in both directions)
93
+ - National transposition measures
94
+ - Filter to specific relation types or retrieve all at once
95
+ - Returns one-hop relations; multi-hop traversal requires multiple calls or `eurlex_query_sparql`
96
+
97
+ ---
98
+
99
+ ### `eurlex_browse_subjects`
100
+
101
+ Resolve human-readable terms to EuroVoc concept IDs.
102
+
103
+ - Full-text search across the multilingual EuroVoc thesaurus
104
+ - Returns concept URI, preferred label, concept code, and broader/narrower hierarchy hints
105
+ - Supports all EU official languages; defaults to English
106
+ - Required before using the `eurovoc_concept` filter in `eurlex_search_documents`
107
+
108
+ ---
109
+
110
+ ## Resources and prompts
111
+
112
+ | Type | Name | Description |
113
+ |:-----|:-----|:------------|
114
+ | Resource | `eurlex://document/{celexNumber}` | Metadata snapshot for a CELLAR work — type, date, title, author institution, in-force flag |
115
+ | Resource | `eurlex://document/{celexNumber}/relations` | Relationship summary for a work: amendment chain, consolidations, legal basis, cited-by count |
116
+ | Prompt | `eurlex_comparative_analysis` | Frames a comparative legal analysis across EU and US law for a given policy domain |
117
+
118
+ All resource data is also reachable via tools. Resources provide stable-URI injectable context for agents that support MCP resources.
119
+
120
+ ---
121
+
122
+ ## Features
123
+
124
+ Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):
125
+
126
+ - Declarative tool, resource, and prompt definitions — single file per primitive, framework handles registration and validation
127
+ - Unified error handling — handlers throw, framework catches, classifies, and formats
128
+ - Pluggable auth: `none`, `jwt`, `oauth`
129
+ - Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`
130
+ - Structured logging with optional OpenTelemetry tracing
131
+ - STDIO and Streamable HTTP transports
132
+
133
+ EUR-Lex-specific:
134
+
135
+ - No API key required — both CELLAR SPARQL and EUR-Lex REST content endpoints are publicly accessible
136
+ - `CellarSparqlService` POSTs `application/x-www-form-urlencoded` SPARQL with CDM prefix declarations built in; server-side LIMIT enforcement (max 100) prevents Virtuoso timeout abuse
137
+ - `EurLexContentService` fetches full HTML or Formex4 XML via the canonical `legal-content/{LANG}/TXT/` URL pattern (CELLAR work URIs return 400 on direct GET — this avoids that)
138
+ - Virtuoso error classification: HTTP 200 with `Virtuoso 37000 Error` body is parsed and re-raised as `ServiceUnavailable` (transient/timeout) or `InvalidParams` (syntax error)
139
+ - Language fallback on document fetch: if the requested language is unavailable, retries with English; returns metadata-only with a note when English also fails
140
+ - Typed error contracts on every tool — structured `reason` codes let agents branch on outcomes without parsing text
141
+
142
+ Agent-friendly output:
143
+
144
+ - EuroVoc prerequisite guidance in server-level instructions — agents are directed to `eurlex_browse_subjects` before attempting concept-filtered searches
145
+ - `eurlex_lookup_celex` surfaces CELEX confirmation and work existence upfront, preventing downstream errors in document or relation fetches
146
+ - Typed `unavailable` reasons and `language_unavailable` signals let agents retry or explain to users with structured data, not string parsing
147
+ - Relationship graph output carries relation type labels alongside CELLAR URIs and resolved CELEX numbers for human-readable downstream use
148
+
149
+ ---
150
+
151
+ ## Getting started
152
+
153
+ Add the following to your MCP client configuration file. No API key is required.
154
+
155
+ ```json
156
+ {
157
+ "mcpServers": {
158
+ "eur-lex-mcp-server": {
159
+ "type": "stdio",
160
+ "command": "bunx",
161
+ "args": ["@cyanheads/eur-lex-mcp-server@latest"],
162
+ "env": {
163
+ "MCP_TRANSPORT_TYPE": "stdio",
164
+ "MCP_LOG_LEVEL": "info"
165
+ }
166
+ }
167
+ }
168
+ }
169
+ ```
170
+
171
+ Or with npx (no Bun required):
172
+
173
+ ```json
174
+ {
175
+ "mcpServers": {
176
+ "eur-lex-mcp-server": {
177
+ "type": "stdio",
178
+ "command": "npx",
179
+ "args": ["-y", "@cyanheads/eur-lex-mcp-server@latest"],
180
+ "env": {
181
+ "MCP_TRANSPORT_TYPE": "stdio",
182
+ "MCP_LOG_LEVEL": "info"
183
+ }
184
+ }
185
+ }
186
+ }
187
+ ```
188
+
189
+ Or with Docker:
190
+
191
+ ```json
192
+ {
193
+ "mcpServers": {
194
+ "eur-lex-mcp-server": {
195
+ "type": "stdio",
196
+ "command": "docker",
197
+ "args": [
198
+ "run", "-i", "--rm",
199
+ "-e", "MCP_TRANSPORT_TYPE=stdio",
200
+ "ghcr.io/cyanheads/eur-lex-mcp-server:latest"
201
+ ]
202
+ }
203
+ }
204
+ }
205
+ ```
206
+
207
+ For Streamable HTTP, set the transport and start the server:
208
+
209
+ ```sh
210
+ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
211
+ # Server listens at http://localhost:3010/mcp
212
+ ```
213
+
214
+ ### Prerequisites
215
+
216
+ - [Bun v1.3.11](https://bun.sh/) or higher (or Node.js v24+).
217
+ - No API key needed — EUR-Lex and CELLAR are publicly accessible.
218
+
219
+ ### Installation
220
+
221
+ 1. **Clone the repository:**
222
+
223
+ ```sh
224
+ git clone https://github.com/cyanheads/eur-lex-mcp-server.git
225
+ ```
226
+
227
+ 2. **Navigate into the directory:**
228
+
229
+ ```sh
230
+ cd eur-lex-mcp-server
231
+ ```
232
+
233
+ 3. **Install dependencies:**
234
+
235
+ ```sh
236
+ bun install
237
+ ```
238
+
239
+ 4. **Configure environment (optional):**
240
+
241
+ ```sh
242
+ cp .env.example .env
243
+ # All server-specific vars have sensible defaults — no required vars
244
+ ```
245
+
246
+ ---
247
+
248
+ ## Configuration
249
+
250
+ All configuration is validated at startup via Zod schemas in `src/config/server-config.ts`.
251
+
252
+ | Variable | Description | Default |
253
+ |:---------|:------------|:--------|
254
+ | `CELLAR_SPARQL_ENDPOINT` | CELLAR SPARQL endpoint URL override (e.g., for a local Virtuoso mirror). | `http://publications.europa.eu/webapi/rdf/sparql` |
255
+ | `EURLEX_CONTENT_BASE_URL` | EUR-Lex content API base URL override. | `https://eur-lex.europa.eu` |
256
+ | `SPARQL_QUERY_TIMEOUT_MS` | Client-side timeout for SPARQL requests in milliseconds. | `55000` |
257
+ | `MAX_SPARQL_RESULTS` | Enforced ceiling on LIMIT in all generated SPARQL queries. | `100` |
258
+ | `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |
259
+ | `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |
260
+ | `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |
261
+ | `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |
262
+ | `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |
263
+ | `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |
264
+
265
+ See [`.env.example`](./.env.example) for the full list of optional overrides.
266
+
267
+ ---
268
+
269
+ ## Running the server
270
+
271
+ ### Local development
272
+
273
+ - **Build and run:**
274
+
275
+ ```sh
276
+ # One-time build
277
+ bun run rebuild
278
+
279
+ # Run the built server
280
+ bun run start:stdio
281
+ # or
282
+ bun run start:http
283
+ ```
284
+
285
+ - **Run checks and tests:**
286
+
287
+ ```sh
288
+ bun run devcheck # Lint, format, typecheck, security
289
+ bun run test # Vitest test suite
290
+ bun run lint:mcp # Validate MCP definitions against spec
291
+ ```
292
+
293
+ ### Docker
294
+
295
+ ```sh
296
+ docker build -t eur-lex-mcp-server .
297
+ docker run --rm -p 3010:3010 eur-lex-mcp-server
298
+ ```
299
+
300
+ The Dockerfile defaults to HTTP transport, stateless session mode, and logs to `/var/log/eur-lex-mcp-server`. OpenTelemetry peer dependencies are installed by default — build with `--build-arg OTEL_ENABLED=false` to omit them.
301
+
302
+ ---
303
+
304
+ ## Project structure
305
+
306
+ | Directory | Purpose |
307
+ |:----------|:--------|
308
+ | `src/index.ts` | `createApp()` entry point — registers tools, resources, and prompts; initializes services. |
309
+ | `src/config` | Server-specific environment variable parsing and validation with Zod. |
310
+ | `src/services/cellar-sparql` | CELLAR SPARQL service — POST client, binding mapper, LIMIT enforcement, CDM PREFIX declarations. |
311
+ | `src/services/eurlex-content` | EUR-Lex content API service — GET client for `legal-content/{LANG}/TXT/` URL pattern with language fallback. |
312
+ | `src/mcp-server/tools` | Tool definitions (`*.tool.ts`). Seven tools across document search, retrieval, resolution, case law, relations, EuroVoc, and raw SPARQL. |
313
+ | `src/mcp-server/resources` | Resource definitions (`*.resource.ts`). Metadata and relations resources. |
314
+ | `src/mcp-server/prompts` | Prompt definitions (`*.prompt.ts`). Comparative analysis prompt. |
315
+ | `tests/` | Unit and integration tests mirroring `src/`. |
316
+
317
+ ---
318
+
319
+ ## Development guide
320
+
321
+ See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
322
+
323
+ - Handlers throw, framework catches — no `try/catch` in tool logic
324
+ - Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage
325
+ - Register new tools and resources via the barrels in `src/mcp-server/*/definitions/index.ts`
326
+ - Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
327
+
328
+ ---
329
+
330
+ ## Contributing
331
+
332
+ Issues and pull requests are welcome. Run checks and tests before submitting:
333
+
334
+ ```sh
335
+ bun run devcheck
336
+ bun run test
337
+ ```
338
+
339
+ ---
340
+
341
+ ## License
342
+
343
+ Apache-2.0 — see [LICENSE](LICENSE) for details.
@@ -0,0 +1,31 @@
1
+ ---
2
+ summary: "Initial public release — 7 tools, 2 resources, 1 prompt over CELLAR SPARQL + EUR-Lex content API; SPARQL-injection hardening across all user-controlled inputs"
3
+ breaking: false
4
+ security: true
5
+ ---
6
+
7
+ # 0.1.1 — 2026-06-05
8
+
9
+ Initial public release of `@cyanheads/eur-lex-mcp-server`. Provides 7 MCP tools, 2 resources, and 1 prompt over the [CELLAR SPARQL endpoint](http://publications.europa.eu/webapi/rdf/sparql) and the [EUR-Lex content API](https://eur-lex.europa.eu):
10
+
11
+ - **`eurlex_browse_subjects`** — search the EuroVoc multilingual thesaurus to resolve a human-readable term to EuroVoc concept IDs and URIs
12
+ - **`eurlex_get_cases`** — search CJEU and General Court case law by subject, party, date range, or case type
13
+ - **`eurlex_get_document`** — fetch CELLAR metadata and full-text content for a document by CELEX number; supports HTML, plain text, and PDF formats via the EUR-Lex content API
14
+ - **`eurlex_get_relations`** — traverse the CELLAR relationship graph for a document: amendment chain, consolidated versions, legal basis, citation network, and national transposition measures
15
+ - **`eurlex_lookup_celex`** — resolve a CELEX number, ELI URI, or Official Journal reference to a CELLAR work URI
16
+ - **`eurlex_query_sparql`** — execute raw SPARQL SELECT against the CELLAR Virtuoso endpoint for advanced CDM ontology traversal
17
+ - **`eurlex_search_documents`** — search EU legislation, treaties, and preparatory acts by keyword, EuroVoc concept, document type, and date range
18
+ - **`eurlex://document/{celexNumber}`** — resource: CELLAR metadata snapshot for a work (type, date, title, author institution, in-force flag)
19
+ - **`eurlex://document/{celexNumber}/relations`** — resource: relationship graph entries for a work
20
+ - **`eurlex_comparative_analysis`** — prompt: structured EU/US comparative legal analysis template
21
+
22
+ ## Added
23
+
24
+ - **7 tools, 2 resources, 1 prompt** — full initial surface over CELLAR SPARQL and EUR-Lex REST content
25
+ - **CELLAR SPARQL service** (`src/services/cellar-sparql/`) — POST client with binding mapper, `STR()` type coercion for CELEX lookups, and enforced `LIMIT` ceiling via `MAX_SPARQL_RESULTS`
26
+ - **EUR-Lex content service** (`src/services/eurlex-content/`) — GET client with language fallback for document full-text retrieval
27
+
28
+ ## Security
29
+
30
+ - **SPARQL-injection hardening** — all user-controlled values interpolated into SPARQL `FILTER` literals now escape double-quotes (`"` → `\"`) before interpolation; applies to CELEX numbers across `eurlex_get_document`, `eurlex_get_relations`, `eurlex_lookup_celex`, `eurlex://document/{celexNumber}`, and `eurlex://document/{celexNumber}/relations`
31
+ - **Regex validators on freeform inputs** — `language` fields constrained to `/^[a-z]{2,3}$/` / `/^[A-Za-z]{2,3}$/`; `date_from`/`date_to` constrained to `/^\d{4}-\d{2}-\d{2}$/` across all tools; `eurovoc_concept` validated as an `http` URI with no angle brackets, quotes, or spaces