@lexapi/mcp 0.1.0 → 0.1.2
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 +1 -1
- package/dist/index.js +3 -2
- package/dist/tools.d.ts +7 -0
- package/dist/tools.js +21 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ Any client that supports stdio MCP servers can run this. The command is `npx -y
|
|
|
73
73
|
## Local development
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
git clone https://github.com/
|
|
76
|
+
git clone https://github.com/Lex-API/lexapi-mcp.git
|
|
77
77
|
cd lexapi-mcp
|
|
78
78
|
npm install
|
|
79
79
|
npm run build
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextpro
|
|
|
5
5
|
import { LexAPIClient, LexAPIError } from './client.js';
|
|
6
6
|
import { tools, toolsByName } from './tools.js';
|
|
7
7
|
const PACKAGE_NAME = 'lexapi-mcp';
|
|
8
|
-
const PACKAGE_VERSION = '0.1.
|
|
8
|
+
const PACKAGE_VERSION = '0.1.2';
|
|
9
9
|
const apiKey = process.env.LEXAPI_API_KEY;
|
|
10
10
|
if (!apiKey) {
|
|
11
11
|
console.error(`[${PACKAGE_NAME}] LEXAPI_API_KEY is not set. Get a key at https://lex-api.com/dashboard and pass it in your MCP client config.`);
|
|
@@ -18,10 +18,11 @@ const client = new LexAPIClient({
|
|
|
18
18
|
});
|
|
19
19
|
const server = new Server({ name: PACKAGE_NAME, version: PACKAGE_VERSION }, { capabilities: { tools: {} } });
|
|
20
20
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
21
|
-
tools: tools.map(({ name, description, inputSchema }) => ({
|
|
21
|
+
tools: tools.map(({ name, description, inputSchema, annotations }) => ({
|
|
22
22
|
name,
|
|
23
23
|
description,
|
|
24
24
|
inputSchema,
|
|
25
|
+
annotations,
|
|
25
26
|
})),
|
|
26
27
|
}));
|
|
27
28
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { LexAPIClient } from './client.js';
|
|
2
|
+
interface ToolAnnotations {
|
|
3
|
+
title: string;
|
|
4
|
+
readOnlyHint: boolean;
|
|
5
|
+
openWorldHint: boolean;
|
|
6
|
+
idempotentHint?: boolean;
|
|
7
|
+
}
|
|
2
8
|
interface ToolDef {
|
|
3
9
|
name: string;
|
|
4
10
|
description: string;
|
|
5
11
|
inputSchema: Record<string, unknown>;
|
|
12
|
+
annotations: ToolAnnotations;
|
|
6
13
|
handler: (args: Record<string, unknown>, client: LexAPIClient) => Promise<unknown>;
|
|
7
14
|
}
|
|
8
15
|
export declare const tools: ToolDef[];
|
package/dist/tools.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
const READ_ONLY = {
|
|
2
|
+
readOnlyHint: true,
|
|
3
|
+
openWorldHint: true,
|
|
4
|
+
idempotentHint: true,
|
|
5
|
+
};
|
|
1
6
|
const LANGUAGES = [
|
|
2
7
|
'en', 'fr', 'de', 'es', 'it', 'pl', 'nl', 'pt', 'ro', 'bg',
|
|
3
8
|
'cs', 'da', 'el', 'et', 'fi', 'ga', 'hr', 'hu', 'lt', 'lv',
|
|
@@ -63,6 +68,7 @@ export const tools = [
|
|
|
63
68
|
},
|
|
64
69
|
additionalProperties: false,
|
|
65
70
|
},
|
|
71
|
+
annotations: { title: 'Search EUR-Lex', ...READ_ONLY },
|
|
66
72
|
handler: (args, client) => client.search(args),
|
|
67
73
|
},
|
|
68
74
|
// ── Document fetch ────────────────────────────────────────────────
|
|
@@ -85,6 +91,7 @@ export const tools = [
|
|
|
85
91
|
},
|
|
86
92
|
additionalProperties: false,
|
|
87
93
|
},
|
|
94
|
+
annotations: { title: 'Fetch EU document by CELEX', ...READ_ONLY },
|
|
88
95
|
handler: (args, client) => client.getDocument(args),
|
|
89
96
|
},
|
|
90
97
|
{
|
|
@@ -102,6 +109,7 @@ export const tools = [
|
|
|
102
109
|
},
|
|
103
110
|
additionalProperties: false,
|
|
104
111
|
},
|
|
112
|
+
annotations: { title: 'Fetch EU document metadata', ...READ_ONLY },
|
|
105
113
|
handler: (args, client) => client.getMetadata(args),
|
|
106
114
|
},
|
|
107
115
|
{
|
|
@@ -119,6 +127,7 @@ export const tools = [
|
|
|
119
127
|
},
|
|
120
128
|
additionalProperties: false,
|
|
121
129
|
},
|
|
130
|
+
annotations: { title: 'Fetch EU document by EUR-Lex URL', ...READ_ONLY },
|
|
122
131
|
handler: (args, client) => client.getDocumentByUrl(args),
|
|
123
132
|
},
|
|
124
133
|
{
|
|
@@ -140,6 +149,7 @@ export const tools = [
|
|
|
140
149
|
},
|
|
141
150
|
additionalProperties: false,
|
|
142
151
|
},
|
|
152
|
+
annotations: { title: 'List recent Official Journal documents', ...READ_ONLY, idempotentHint: false },
|
|
143
153
|
handler: (args, client) => client.recentDocuments(args),
|
|
144
154
|
},
|
|
145
155
|
// ── Citation graph ────────────────────────────────────────────────
|
|
@@ -161,6 +171,7 @@ export const tools = [
|
|
|
161
171
|
},
|
|
162
172
|
additionalProperties: false,
|
|
163
173
|
},
|
|
174
|
+
annotations: { title: 'Find documents citing a CELEX', ...READ_ONLY },
|
|
164
175
|
handler: (args, client) => {
|
|
165
176
|
const { celexNumber, ...query } = args;
|
|
166
177
|
return client.citedBy(celexNumber, query);
|
|
@@ -180,6 +191,7 @@ export const tools = [
|
|
|
180
191
|
},
|
|
181
192
|
additionalProperties: false,
|
|
182
193
|
},
|
|
194
|
+
annotations: { title: 'Find documents a CELEX cites', ...READ_ONLY },
|
|
183
195
|
handler: (args, client) => {
|
|
184
196
|
const { celexNumber, ...query } = args;
|
|
185
197
|
return client.cites(celexNumber, query);
|
|
@@ -196,6 +208,7 @@ export const tools = [
|
|
|
196
208
|
},
|
|
197
209
|
additionalProperties: false,
|
|
198
210
|
},
|
|
211
|
+
annotations: { title: 'Fetch full citation network for a CELEX', ...READ_ONLY },
|
|
199
212
|
handler: (args, client) => client.citationNetwork(args.celexNumber),
|
|
200
213
|
},
|
|
201
214
|
// ── Semantic ──────────────────────────────────────────────────────
|
|
@@ -217,11 +230,12 @@ export const tools = [
|
|
|
217
230
|
filters: {
|
|
218
231
|
type: 'object',
|
|
219
232
|
additionalProperties: true,
|
|
220
|
-
description: 'Optional
|
|
233
|
+
description: 'Optional filters passed through to the LexAPI semantic backend. See the LexAPI docs at https://lex-api.com/docs for accepted filter keys (e.g. court, dateFrom, dateTo, ecli).',
|
|
221
234
|
},
|
|
222
235
|
},
|
|
223
236
|
additionalProperties: false,
|
|
224
237
|
},
|
|
238
|
+
annotations: { title: 'Semantic search over EU case law', ...READ_ONLY },
|
|
225
239
|
handler: (args, client) => client.semanticCaseLaw(args),
|
|
226
240
|
},
|
|
227
241
|
{
|
|
@@ -234,10 +248,15 @@ export const tools = [
|
|
|
234
248
|
query: { type: 'string', minLength: 1 },
|
|
235
249
|
limit: { type: 'integer', minimum: 1, maximum: 50, default: 10 },
|
|
236
250
|
min_score: { type: 'number', minimum: 0, maximum: 1 },
|
|
237
|
-
filters: {
|
|
251
|
+
filters: {
|
|
252
|
+
type: 'object',
|
|
253
|
+
additionalProperties: true,
|
|
254
|
+
description: 'Optional filters passed through to the LexAPI semantic backend. See the LexAPI docs at https://lex-api.com/docs for accepted filter keys (e.g. documentType, author, language, dateFrom, dateTo).',
|
|
255
|
+
},
|
|
238
256
|
},
|
|
239
257
|
additionalProperties: false,
|
|
240
258
|
},
|
|
259
|
+
annotations: { title: 'Semantic search over EU legislation', ...READ_ONLY },
|
|
241
260
|
handler: (args, client) => client.semanticLegislation(args),
|
|
242
261
|
},
|
|
243
262
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexapi/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Model Context Protocol server for LexAPI — query EUR-Lex and EU case law from Claude, Cursor, and other MCP-enabled clients.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"homepage": "https://lex-api.com",
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/
|
|
39
|
+
"url": "git+https://github.com/Lex-API/lexapi-mcp.git"
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=20"
|