@ignfab/geocontext 0.8.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/LICENSE +21 -0
- package/README.md +195 -0
- package/dist/gpf/adminexpress.d.ts +15 -0
- package/dist/gpf/adminexpress.js +50 -0
- package/dist/gpf/adminexpress.js.map +1 -0
- package/dist/gpf/altitude.d.ts +16 -0
- package/dist/gpf/altitude.js +35 -0
- package/dist/gpf/altitude.js.map +1 -0
- package/dist/gpf/geocode.d.ts +10 -0
- package/dist/gpf/geocode.js +27 -0
- package/dist/gpf/geocode.js.map +1 -0
- package/dist/gpf/parcellaire-express.d.ts +12 -0
- package/dist/gpf/parcellaire-express.js +74 -0
- package/dist/gpf/parcellaire-express.js.map +1 -0
- package/dist/gpf/urbanisme.d.ts +18 -0
- package/dist/gpf/urbanisme.js +95 -0
- package/dist/gpf/urbanisme.js.map +1 -0
- package/dist/gpf/wfs.d.ts +22 -0
- package/dist/gpf/wfs.js +65 -0
- package/dist/gpf/wfs.js.map +1 -0
- package/dist/helpers/distance.d.ts +7 -0
- package/dist/helpers/distance.js +17 -0
- package/dist/helpers/distance.js.map +1 -0
- package/dist/helpers/http.d.ts +6 -0
- package/dist/helpers/http.js +24 -0
- package/dist/helpers/http.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +25 -0
- package/dist/logger.js.map +1 -0
- package/dist/tools/AdminexpressTool.d.ts +22 -0
- package/dist/tools/AdminexpressTool.js +23 -0
- package/dist/tools/AdminexpressTool.js.map +1 -0
- package/dist/tools/AltitudeTool.d.ts +27 -0
- package/dist/tools/AltitudeTool.js +24 -0
- package/dist/tools/AltitudeTool.js.map +1 -0
- package/dist/tools/AssietteSupTool.d.ts +22 -0
- package/dist/tools/AssietteSupTool.js +23 -0
- package/dist/tools/AssietteSupTool.js.map +1 -0
- package/dist/tools/CadastreTool.d.ts +22 -0
- package/dist/tools/CadastreTool.js +23 -0
- package/dist/tools/CadastreTool.js.map +1 -0
- package/dist/tools/GeocodeTool.d.ts +17 -0
- package/dist/tools/GeocodeTool.js +20 -0
- package/dist/tools/GeocodeTool.js.map +1 -0
- package/dist/tools/GpfWfsDescribeTypeTool.d.ts +32 -0
- package/dist/tools/GpfWfsDescribeTypeTool.js +32 -0
- package/dist/tools/GpfWfsDescribeTypeTool.js.map +1 -0
- package/dist/tools/GpfWfsGetFeaturesTool.d.ts +42 -0
- package/dist/tools/GpfWfsGetFeaturesTool.js +89 -0
- package/dist/tools/GpfWfsGetFeaturesTool.js.map +1 -0
- package/dist/tools/GpfWfsListTypesTool.d.ts +10 -0
- package/dist/tools/GpfWfsListTypesTool.js +18 -0
- package/dist/tools/GpfWfsListTypesTool.js.map +1 -0
- package/dist/tools/GpfWfsSearchTypesTool.d.ts +22 -0
- package/dist/tools/GpfWfsSearchTypesTool.js +31 -0
- package/dist/tools/GpfWfsSearchTypesTool.js.map +1 -0
- package/dist/tools/UrbanismeTool.d.ts +22 -0
- package/dist/tools/UrbanismeTool.js +23 -0
- package/dist/tools/UrbanismeTool.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { logger, MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { GPF_WFS_URL } from "../gpf/wfs.js";
|
|
4
|
+
import { fetchJSON } from "../helpers/http.js";
|
|
5
|
+
class GpfWfsGetFeaturesTool extends MCPTool {
|
|
6
|
+
name = "gpf_wfs_get_features";
|
|
7
|
+
description = "Permet de récupérer les objets pour un type WFS.";
|
|
8
|
+
schema = {
|
|
9
|
+
typename: {
|
|
10
|
+
type: z.string(),
|
|
11
|
+
description: "Le nom du type (ex : BDTOPO_V3:batiment). Important : Utiliser gpf_wfs_search_types pour trouver les types disponibles."
|
|
12
|
+
},
|
|
13
|
+
property_names: {
|
|
14
|
+
type: z.string().optional(),
|
|
15
|
+
description: 'La liste des propriétés séparées par des virgules (ex : "code_insee,nom_officiel,geometrie"). NB : adapter geometrie avec geometryName au niveau du type WFS. '
|
|
16
|
+
},
|
|
17
|
+
sort_by: {
|
|
18
|
+
type: z.string().optional(),
|
|
19
|
+
description: 'Trier selon une propriété (syntaxe : field1 [A|D], field2 [A|D], ... , fieldN [A|D])'
|
|
20
|
+
},
|
|
21
|
+
count: {
|
|
22
|
+
type: z.number().optional(),
|
|
23
|
+
description: "Le nombre d'objets à récupérer (ex : 10)"
|
|
24
|
+
},
|
|
25
|
+
cql_filter: {
|
|
26
|
+
type: z.string().optional(),
|
|
27
|
+
description: "Le filtre au format cql_filter de GeoServer. ATTENTION : il faut permuter les coordonnées pour EPSG:4326 (ex : 'DWITHIN(geom,Point(${lat} ${lon}),10,meters)')"
|
|
28
|
+
},
|
|
29
|
+
result_type: {
|
|
30
|
+
type: z.enum(['results', 'hits', 'url']).optional(),
|
|
31
|
+
description: [
|
|
32
|
+
"Type de résultat : ",
|
|
33
|
+
"- 'results' pour les données complètes (défaut)",
|
|
34
|
+
"- 'hits' pour le comptage uniquement",
|
|
35
|
+
"- 'url' pour récupérer l'URL de la requête (ex : affichage des données côté client dans une carte)"
|
|
36
|
+
].join("\r\n")
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
async execute(input) {
|
|
40
|
+
const params = {
|
|
41
|
+
service: 'WFS',
|
|
42
|
+
request: 'GetFeature',
|
|
43
|
+
typeName: input.typename,
|
|
44
|
+
outputFormat: 'application/json'
|
|
45
|
+
};
|
|
46
|
+
// Only add optional parameters if they are defined
|
|
47
|
+
if (input.cql_filter) {
|
|
48
|
+
params.cql_filter = input.cql_filter;
|
|
49
|
+
}
|
|
50
|
+
if (input.count) {
|
|
51
|
+
params.count = input.count;
|
|
52
|
+
}
|
|
53
|
+
if (input.sort_by) {
|
|
54
|
+
params.sortBy = input.sort_by;
|
|
55
|
+
}
|
|
56
|
+
if (input.property_names && input.property_names.length > 0) {
|
|
57
|
+
params.propertyName = input.property_names;
|
|
58
|
+
}
|
|
59
|
+
// Si result_type est 'hits', on utilise count=1 pour récupérer juste le totalFeatures
|
|
60
|
+
if (input.result_type === 'hits') {
|
|
61
|
+
params.count = 1;
|
|
62
|
+
// On n'a pas besoin des propriétés détaillées pour un comptage
|
|
63
|
+
delete params.propertyName;
|
|
64
|
+
}
|
|
65
|
+
const url = `${GPF_WFS_URL}?` + new URLSearchParams(params).toString();
|
|
66
|
+
logger.info(`[gpf_wfs_get_features] ${url}`);
|
|
67
|
+
if (input.result_type === 'url') {
|
|
68
|
+
return url;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const featureCollection = await fetchJSON(url);
|
|
72
|
+
// Si result_type est 'hits', on retourne juste le comptage
|
|
73
|
+
if (input.result_type === 'hits') {
|
|
74
|
+
return featureCollection.totalFeatures;
|
|
75
|
+
}
|
|
76
|
+
return featureCollection;
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
logger.error(`[gpf_wfs_get_features] ${e}`);
|
|
80
|
+
return {
|
|
81
|
+
type: "error",
|
|
82
|
+
message: "Une erreur est survenue lors de la récupération des objets (utiliser gpf_wfs_describe_type pour lister les types disponibles avant d'appeler gpf_wfs_get_features)",
|
|
83
|
+
details: `${e}`
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export default GpfWfsGetFeaturesTool;
|
|
89
|
+
//# sourceMappingURL=GpfWfsGetFeaturesTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GpfWfsGetFeaturesTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsGetFeaturesTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC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,oKAAoK;gBAC7K,OAAO,EAAE,GAAG,CAAC,EAAE;aAChB,CAAA;QACH,CAAC;IACH,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
interface WfsTypesInput {
|
|
3
|
+
}
|
|
4
|
+
declare class GpfWfsListTypesTools extends MCPTool<WfsTypesInput> {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
schema: {};
|
|
8
|
+
execute(input: WfsTypesInput): Promise<string[]>;
|
|
9
|
+
}
|
|
10
|
+
export default GpfWfsListTypesTools;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { wfsClient } from "../gpf/wfs.js";
|
|
3
|
+
class GpfWfsListTypesTools extends MCPTool {
|
|
4
|
+
name = "gpf_wfs_list_types";
|
|
5
|
+
description = [
|
|
6
|
+
"Renvoie la liste des types WFS de la Géoplateforme (GPF). ATTENTION :",
|
|
7
|
+
"- Il y a plus de 700 résultats possibles",
|
|
8
|
+
"- Il est conseillé d'utiliser de préférence gpf_wfs_search_types pour filtrer les résultats.",
|
|
9
|
+
].join("\r\n");
|
|
10
|
+
schema = {};
|
|
11
|
+
async execute(input) {
|
|
12
|
+
const featureTypes = await wfsClient.getFeatureTypes();
|
|
13
|
+
const featureTypeNames = featureTypes.map((featureType) => featureType.name);
|
|
14
|
+
return featureTypeNames;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export default GpfWfsListTypesTools;
|
|
18
|
+
//# sourceMappingURL=GpfWfsListTypesTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GpfWfsListTypesTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsListTypesTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK1C,MAAM,oBAAqB,SAAQ,OAAsB;IACvD,IAAI,GAAG,oBAAoB,CAAC;IAC5B,WAAW,GAAG;QACZ,uEAAuE;QACvE,0CAA0C;QAC1C,8FAA8F;KAC/F,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,MAAM,GAAG,EAER,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAAoB;QAChC,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,eAAe,EAAE,CAAC;QACvD,MAAM,gBAAgB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC7E,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
interface GpfWfsSearchTypesInput {
|
|
4
|
+
query: string;
|
|
5
|
+
max_results: number;
|
|
6
|
+
}
|
|
7
|
+
declare class GpfWfsSearchTypesTool extends MCPTool<GpfWfsSearchTypesInput> {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
schema: {
|
|
11
|
+
query: {
|
|
12
|
+
type: z.ZodString;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
max_results: {
|
|
16
|
+
type: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
execute(input: GpfWfsSearchTypesInput): Promise<string[]>;
|
|
21
|
+
}
|
|
22
|
+
export default GpfWfsSearchTypesTool;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { wfsClient } from "../gpf/wfs.js";
|
|
4
|
+
class GpfWfsSearchTypesTool extends MCPTool {
|
|
5
|
+
name = "gpf_wfs_search_types";
|
|
6
|
+
description = [
|
|
7
|
+
"Recherche par mot clé dans la liste des types WFS de la Géoplateforme (GPF). Remarques :",
|
|
8
|
+
"- La recherche est une recherche textuelle simple (mini-search).",
|
|
9
|
+
"- Un LLM peut enrichir la recherche avec des mots clés supplémentaires.",
|
|
10
|
+
"- La recherche est limitée par défaut à 10 résultats",
|
|
11
|
+
"- Le paramètre max_results permet de changer le nombre de résultats (par exemple pour trouver toutes les tables BDTOPO ou toutes les tables communes)",
|
|
12
|
+
].join("\r\n");
|
|
13
|
+
schema = {
|
|
14
|
+
query: {
|
|
15
|
+
type: z.string(),
|
|
16
|
+
description: "La requête de recherche",
|
|
17
|
+
},
|
|
18
|
+
max_results: {
|
|
19
|
+
type: z.number().optional(),
|
|
20
|
+
description: "Le nombre de résultats (10 par défaut)",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
async execute(input) {
|
|
24
|
+
const maxResults = input.max_results || 10;
|
|
25
|
+
const featureTypes = await wfsClient.searchFeatureTypes(input.query, maxResults);
|
|
26
|
+
const featureTypeNames = featureTypes.map((featureType) => featureType.name);
|
|
27
|
+
return featureTypeNames;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export default GpfWfsSearchTypesTool;
|
|
31
|
+
//# sourceMappingURL=GpfWfsSearchTypesTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GpfWfsSearchTypesTool.js","sourceRoot":"","sources":["../../src/tools/GpfWfsSearchTypesTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAO1C,MAAM,qBAAsB,SAAQ,OAA+B;IACjE,IAAI,GAAG,sBAAsB,CAAC;IAC9B,WAAW,GAAG;QACZ,0FAA0F;QAC1F,kEAAkE;QAClE,yEAAyE;QACzE,sDAAsD;QACtD,uJAAuJ;KACxJ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,MAAM,GAAG;QACP,KAAK,EAAE;YACL,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,yBAAyB;SACvC;QACD,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC3B,WAAW,EAAE,wCAAwC;SACtD;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAA6B;QACzC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC;QAC3C,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,kBAAkB,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACjF,MAAM,gBAAgB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC7E,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
interface UrbanismeInput {
|
|
4
|
+
lon: number;
|
|
5
|
+
lat: number;
|
|
6
|
+
}
|
|
7
|
+
declare class UrbanismeTool extends MCPTool<UrbanismeInput> {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
schema: {
|
|
11
|
+
lon: {
|
|
12
|
+
type: z.ZodNumber;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
lat: {
|
|
16
|
+
type: z.ZodNumber;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
execute(input: UrbanismeInput): Promise<any>;
|
|
21
|
+
}
|
|
22
|
+
export default UrbanismeTool;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { logger, MCPTool } from "mcp-framework";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { getUrbanisme, URBANISME_SOURCE } from "../gpf/urbanisme.js";
|
|
4
|
+
class UrbanismeTool extends MCPTool {
|
|
5
|
+
name = "urbanisme";
|
|
6
|
+
description = `Renvoie les informations du document d'urbanisme (PLU, PLUi, POS, CC, PSMV) pour une position donnée par sa longitude et sa latitude (source: ${URBANISME_SOURCE}).`;
|
|
7
|
+
schema = {
|
|
8
|
+
lon: {
|
|
9
|
+
type: z.number(),
|
|
10
|
+
description: "La longitude du point",
|
|
11
|
+
},
|
|
12
|
+
lat: {
|
|
13
|
+
type: z.number(),
|
|
14
|
+
description: "La latitude du point",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
async execute(input) {
|
|
18
|
+
logger.info(`urbanisme(${input.lon},${input.lat})...`);
|
|
19
|
+
return getUrbanisme(input.lon, input.lat);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export default UrbanismeTool;
|
|
23
|
+
//# sourceMappingURL=UrbanismeTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UrbanismeTool.js","sourceRoot":"","sources":["../../src/tools/UrbanismeTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAOrE,MAAM,aAAc,SAAQ,OAAuB;IACjD,IAAI,GAAG,WAAW,CAAC;IACnB,WAAW,GAAG,iJAAiJ,gBAAgB,IAAI,CAAC;IAEpL,MAAM,GAAG;QACP,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,uBAAuB;SACrC;QACD,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,WAAW,EAAE,sBAAsB;SACpC;KACF,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,KAAqB;QACjC,MAAM,CAAC,IAAI,CAAC,aAAa,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;QACvD,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC;CACF;AAED,eAAe,aAAa,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ignfab/geocontext",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "An experimental MCP server providing spatial context for LLM.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"geocontext": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/ignfab/geocontext.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"llm",
|
|
18
|
+
"rag",
|
|
19
|
+
"action",
|
|
20
|
+
"spatial",
|
|
21
|
+
"context"
|
|
22
|
+
],
|
|
23
|
+
"author": "MBorne <mborne@users.noreply.github.com>",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/ignfab/geocontext/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/ignfab/geocontext#readme",
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc && npx mcp-build",
|
|
31
|
+
"watch": "tsc --watch",
|
|
32
|
+
"start": "node dist/index.js",
|
|
33
|
+
"test": "node --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js",
|
|
34
|
+
"coverage": "node --no-warnings --experimental-vm-modules ./node_modules/jest/bin/jest.js --coverage"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@camptocamp/ogc-client": "^1.3.0",
|
|
38
|
+
"https-proxy-agent": "^7.0.6",
|
|
39
|
+
"jsts": "^2.12.1",
|
|
40
|
+
"mcp-framework": "^0.2.15",
|
|
41
|
+
"minisearch": "^7.2.0",
|
|
42
|
+
"node-fetch": "^3.3.2",
|
|
43
|
+
"winston": "^3.17.0",
|
|
44
|
+
"lodash": "^4.17.21"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/cors": "^2.8.19",
|
|
48
|
+
"@types/geojson": "^7946.0.16",
|
|
49
|
+
"@types/jest": "^30.0.0",
|
|
50
|
+
"@types/lodash": "^4.17.20",
|
|
51
|
+
"@types/node": "^24.5.2",
|
|
52
|
+
"@types/supertest": "^6.0.3",
|
|
53
|
+
"geojson": "^0.5.0",
|
|
54
|
+
"jest": "^30.2.0",
|
|
55
|
+
"supertest": "^7.1.4",
|
|
56
|
+
"ts-jest": "^29.4.4",
|
|
57
|
+
"ts-node": "^10.9.2",
|
|
58
|
+
"typescript": "^5.9.2"
|
|
59
|
+
},
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=18.19.0"
|
|
62
|
+
}
|
|
63
|
+
}
|