@nubiia/mcp-freematica 0.6.2 → 0.6.3
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/dist/config.d.ts +17 -78
- package/dist/schemas/cartera.d.ts +10 -2
- package/dist/schemas/facturas-electronicas.d.ts +5 -1
- package/dist/schemas/filters.d.ts +3 -37
- package/dist/schemas/master-data.d.ts +26 -1
- package/dist/schemas/pedidos-compras.d.ts +10 -2
- package/dist/tools/prl.d.ts +2 -22
- package/dist/tools/prl.js +1 -1
- package/package.json +5 -5
package/dist/config.d.ts
CHANGED
|
@@ -6,31 +6,11 @@ declare const AuthConfigSchema: z.ZodObject<{
|
|
|
6
6
|
FREEMATICA_AUTH_ORGANIZATION: z.ZodString;
|
|
7
7
|
FREEMATICA_AUTH_APP: z.ZodString;
|
|
8
8
|
FREEMATICA_AUTH_SESSION: z.ZodString;
|
|
9
|
-
},
|
|
10
|
-
FREEMATICA_BASE_URL: string;
|
|
11
|
-
FREEMATICA_AUTH_TOKEN: string;
|
|
12
|
-
FREEMATICA_AUTH_COMPANY: string;
|
|
13
|
-
FREEMATICA_AUTH_ORGANIZATION: string;
|
|
14
|
-
FREEMATICA_AUTH_APP: string;
|
|
15
|
-
FREEMATICA_AUTH_SESSION: string;
|
|
16
|
-
}, {
|
|
17
|
-
FREEMATICA_AUTH_TOKEN: string;
|
|
18
|
-
FREEMATICA_AUTH_COMPANY: string;
|
|
19
|
-
FREEMATICA_AUTH_ORGANIZATION: string;
|
|
20
|
-
FREEMATICA_AUTH_APP: string;
|
|
21
|
-
FREEMATICA_AUTH_SESSION: string;
|
|
22
|
-
FREEMATICA_BASE_URL?: string | undefined;
|
|
23
|
-
}>;
|
|
9
|
+
}, z.core.$strip>;
|
|
24
10
|
declare const HttpConfigSchema: z.ZodObject<{
|
|
25
|
-
MCP_PORT: z.ZodDefault<z.
|
|
11
|
+
MCP_PORT: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
26
12
|
MCP_ALLOWED_ORIGINS: z.ZodDefault<z.ZodString>;
|
|
27
|
-
},
|
|
28
|
-
MCP_PORT: number;
|
|
29
|
-
MCP_ALLOWED_ORIGINS: string;
|
|
30
|
-
}, {
|
|
31
|
-
MCP_PORT?: number | undefined;
|
|
32
|
-
MCP_ALLOWED_ORIGINS?: string | undefined;
|
|
33
|
-
}>;
|
|
13
|
+
}, z.core.$strip>;
|
|
34
14
|
/**
|
|
35
15
|
* Configuración de hardening del cliente HTTP.
|
|
36
16
|
*
|
|
@@ -38,61 +18,20 @@ declare const HttpConfigSchema: z.ZodObject<{
|
|
|
38
18
|
* configuración explícita en la mayoría de los entornos.
|
|
39
19
|
*/
|
|
40
20
|
declare const HardeningConfigSchema: z.ZodObject<{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
* Por defecto: info.
|
|
56
|
-
*/
|
|
57
|
-
LOG_LEVEL: z.ZodDefault<z.ZodEnum<["trace", "debug", "info", "warn", "error", "fatal"]>>;
|
|
58
|
-
/**
|
|
59
|
-
* Número de fallos consecutivos antes de abrir el circuit breaker.
|
|
60
|
-
* Por defecto: 5.
|
|
61
|
-
*/
|
|
62
|
-
FREEMATICA_CIRCUIT_BREAKER_THRESHOLD: z.ZodDefault<z.ZodNumber>;
|
|
63
|
-
/**
|
|
64
|
-
* Tiempo en ms que el circuit breaker permanece abierto antes de pasar
|
|
65
|
-
* a half-open para intentar recuperarse.
|
|
66
|
-
* Por defecto: 30000 (30 segundos).
|
|
67
|
-
*/
|
|
68
|
-
FREEMATICA_CIRCUIT_BREAKER_TIMEOUT_MS: z.ZodDefault<z.ZodNumber>;
|
|
69
|
-
/**
|
|
70
|
-
* Tamaño máximo de respuesta aceptado por freematica_export_asientos en
|
|
71
|
-
* megabytes. Si la respuesta del API supera este umbral, los datos se
|
|
72
|
-
* truncan y se añade un campo `warning` a la respuesta de la tool.
|
|
73
|
-
*
|
|
74
|
-
* Se recomienda usar rangos de fecha cortos (max. 1 mes) para evitar
|
|
75
|
-
* alcanzar este límite.
|
|
76
|
-
*
|
|
77
|
-
* Por defecto: 10 (10 MB).
|
|
78
|
-
* Mínimo: 1 MB. Máximo: 500 MB.
|
|
79
|
-
*/
|
|
80
|
-
FREEMATICA_MAX_RESPONSE_SIZE_MB: z.ZodDefault<z.ZodNumber>;
|
|
81
|
-
}, "strip", z.ZodTypeAny, {
|
|
82
|
-
FREEMATICA_TIMEOUT_MS: number;
|
|
83
|
-
FREEMATICA_MAX_RETRIES: number;
|
|
84
|
-
LOG_LEVEL: "trace" | "debug" | "info" | "warn" | "error" | "fatal";
|
|
85
|
-
FREEMATICA_CIRCUIT_BREAKER_THRESHOLD: number;
|
|
86
|
-
FREEMATICA_CIRCUIT_BREAKER_TIMEOUT_MS: number;
|
|
87
|
-
FREEMATICA_MAX_RESPONSE_SIZE_MB: number;
|
|
88
|
-
}, {
|
|
89
|
-
FREEMATICA_TIMEOUT_MS?: number | undefined;
|
|
90
|
-
FREEMATICA_MAX_RETRIES?: number | undefined;
|
|
91
|
-
LOG_LEVEL?: "trace" | "debug" | "info" | "warn" | "error" | "fatal" | undefined;
|
|
92
|
-
FREEMATICA_CIRCUIT_BREAKER_THRESHOLD?: number | undefined;
|
|
93
|
-
FREEMATICA_CIRCUIT_BREAKER_TIMEOUT_MS?: number | undefined;
|
|
94
|
-
FREEMATICA_MAX_RESPONSE_SIZE_MB?: number | undefined;
|
|
95
|
-
}>;
|
|
21
|
+
FREEMATICA_TIMEOUT_MS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
22
|
+
FREEMATICA_MAX_RETRIES: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
23
|
+
LOG_LEVEL: z.ZodDefault<z.ZodEnum<{
|
|
24
|
+
error: "error";
|
|
25
|
+
trace: "trace";
|
|
26
|
+
debug: "debug";
|
|
27
|
+
info: "info";
|
|
28
|
+
warn: "warn";
|
|
29
|
+
fatal: "fatal";
|
|
30
|
+
}>>;
|
|
31
|
+
FREEMATICA_CIRCUIT_BREAKER_THRESHOLD: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
32
|
+
FREEMATICA_CIRCUIT_BREAKER_TIMEOUT_MS: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
33
|
+
FREEMATICA_MAX_RESPONSE_SIZE_MB: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
96
35
|
export type AuthConfig = z.infer<typeof AuthConfigSchema>;
|
|
97
36
|
export type HttpConfig = z.infer<typeof HttpConfigSchema>;
|
|
98
37
|
export type HardeningConfig = z.infer<typeof HardeningConfigSchema>;
|
|
@@ -7,7 +7,11 @@ import { z } from 'zod';
|
|
|
7
7
|
* - `cancelado` → `CARCL_SITCAR==2`
|
|
8
8
|
* - `derivado` → `CARCL_SITCAR==3`
|
|
9
9
|
*/
|
|
10
|
-
export declare const EstadoCarteraEnum: z.ZodEnum<
|
|
10
|
+
export declare const EstadoCarteraEnum: z.ZodEnum<{
|
|
11
|
+
pendiente: "pendiente";
|
|
12
|
+
cancelado: "cancelado";
|
|
13
|
+
derivado: "derivado";
|
|
14
|
+
}>;
|
|
11
15
|
export type EstadoCartera = z.infer<typeof EstadoCarteraEnum>;
|
|
12
16
|
/** Mapa de enum lógico → valor numérico FIQL en `CARCL_SITCAR`. */
|
|
13
17
|
export declare const ESTADO_CARTERA_FIQL_MAP: Record<EstadoCartera, string>;
|
|
@@ -45,7 +49,11 @@ export declare const ListCarteraFiltersSchema: {
|
|
|
45
49
|
fechaDocHasta: z.ZodOptional<z.ZodString>;
|
|
46
50
|
fechaVencimientoDesde: z.ZodOptional<z.ZodString>;
|
|
47
51
|
fechaVencimientoHasta: z.ZodOptional<z.ZodString>;
|
|
48
|
-
estado: z.ZodOptional<z.ZodEnum<
|
|
52
|
+
estado: z.ZodOptional<z.ZodEnum<{
|
|
53
|
+
pendiente: "pendiente";
|
|
54
|
+
cancelado: "cancelado";
|
|
55
|
+
derivado: "derivado";
|
|
56
|
+
}>>;
|
|
49
57
|
soloImpagados: z.ZodOptional<z.ZodBoolean>;
|
|
50
58
|
referencia: z.ZodOptional<z.ZodString>;
|
|
51
59
|
page: z.ZodDefault<z.ZodNumber>;
|
|
@@ -52,7 +52,11 @@ export type ListFacturasElectronicasFilters = {
|
|
|
52
52
|
*/
|
|
53
53
|
export declare const ListFacturasDocumentosFiltersSchema: {
|
|
54
54
|
documents: z.ZodOptional<z.ZodString>;
|
|
55
|
-
documentType: z.ZodOptional<z.ZodEnum<
|
|
55
|
+
documentType: z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
PDF: "PDF";
|
|
57
|
+
XML: "XML";
|
|
58
|
+
ERROR: "ERROR";
|
|
59
|
+
}>>;
|
|
56
60
|
};
|
|
57
61
|
export type ListFacturasDocumentosFilters = {
|
|
58
62
|
documents?: string;
|
|
@@ -14,13 +14,7 @@ import { z } from 'zod';
|
|
|
14
14
|
export declare const DateRangeSchema: z.ZodObject<{
|
|
15
15
|
fechaDesde: z.ZodOptional<z.ZodString>;
|
|
16
16
|
fechaHasta: z.ZodOptional<z.ZodString>;
|
|
17
|
-
},
|
|
18
|
-
fechaDesde?: string | undefined;
|
|
19
|
-
fechaHasta?: string | undefined;
|
|
20
|
-
}, {
|
|
21
|
-
fechaDesde?: string | undefined;
|
|
22
|
-
fechaHasta?: string | undefined;
|
|
23
|
-
}>;
|
|
17
|
+
}, z.core.$strip>;
|
|
24
18
|
export type DateRange = z.infer<typeof DateRangeSchema>;
|
|
25
19
|
/**
|
|
26
20
|
* Filtros de identidad para entidades de Freemática.
|
|
@@ -37,17 +31,7 @@ export declare const IdentityFiltersSchema: z.ZodObject<{
|
|
|
37
31
|
grupoCliente: z.ZodOptional<z.ZodString>;
|
|
38
32
|
codProveedor: z.ZodOptional<z.ZodString>;
|
|
39
33
|
grupoProveedor: z.ZodOptional<z.ZodString>;
|
|
40
|
-
},
|
|
41
|
-
codProveedor?: string | undefined;
|
|
42
|
-
codCliente?: string | undefined;
|
|
43
|
-
grupoCliente?: string | undefined;
|
|
44
|
-
grupoProveedor?: string | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
codProveedor?: string | undefined;
|
|
47
|
-
codCliente?: string | undefined;
|
|
48
|
-
grupoCliente?: string | undefined;
|
|
49
|
-
grupoProveedor?: string | undefined;
|
|
50
|
-
}>;
|
|
34
|
+
}, z.core.$strip>;
|
|
51
35
|
export type IdentityFilters = z.infer<typeof IdentityFiltersSchema>;
|
|
52
36
|
/**
|
|
53
37
|
* Schema base para tools que necesitan paginación + rango de fechas + filtros
|
|
@@ -70,23 +54,5 @@ export declare const BaseFiltersSchema: z.ZodObject<{
|
|
|
70
54
|
fechaHasta: z.ZodOptional<z.ZodString>;
|
|
71
55
|
page: z.ZodDefault<z.ZodNumber>;
|
|
72
56
|
items: z.ZodDefault<z.ZodNumber>;
|
|
73
|
-
},
|
|
74
|
-
page: number;
|
|
75
|
-
items: number;
|
|
76
|
-
codProveedor?: string | undefined;
|
|
77
|
-
codCliente?: string | undefined;
|
|
78
|
-
fechaDesde?: string | undefined;
|
|
79
|
-
fechaHasta?: string | undefined;
|
|
80
|
-
grupoCliente?: string | undefined;
|
|
81
|
-
grupoProveedor?: string | undefined;
|
|
82
|
-
}, {
|
|
83
|
-
codProveedor?: string | undefined;
|
|
84
|
-
codCliente?: string | undefined;
|
|
85
|
-
page?: number | undefined;
|
|
86
|
-
items?: number | undefined;
|
|
87
|
-
fechaDesde?: string | undefined;
|
|
88
|
-
fechaHasta?: string | undefined;
|
|
89
|
-
grupoCliente?: string | undefined;
|
|
90
|
-
grupoProveedor?: string | undefined;
|
|
91
|
-
}>;
|
|
57
|
+
}, z.core.$strip>;
|
|
92
58
|
export type BaseFilters = z.infer<typeof BaseFiltersSchema>;
|
|
@@ -15,7 +15,32 @@ import { z } from 'zod';
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const MASTER_DATA_CATALOGS: readonly ["tipos-contrato", "tipo-instalacion", "clases-servicios", "tipos-casos", "subtipos-casos", "tipos-oportunidad-negocio", "tipos-impuestos", "naturalezas-abono", "incidencecode", "claves-facturacion", "paises", "nacionalidades", "provincias", "poblaciones", "empresas", "delegaciones", "lineas-negocio", "cargos-clientes", "calendarios", "series", "familias", "subfamilias", "lineas", "bancos"];
|
|
17
17
|
export type MasterDataCatalog = typeof MASTER_DATA_CATALOGS[number];
|
|
18
|
-
export declare const MasterDataCatalogSchema: z.ZodEnum<
|
|
18
|
+
export declare const MasterDataCatalogSchema: z.ZodEnum<{
|
|
19
|
+
"tipos-contrato": "tipos-contrato";
|
|
20
|
+
"tipo-instalacion": "tipo-instalacion";
|
|
21
|
+
"clases-servicios": "clases-servicios";
|
|
22
|
+
"tipos-casos": "tipos-casos";
|
|
23
|
+
"subtipos-casos": "subtipos-casos";
|
|
24
|
+
"tipos-oportunidad-negocio": "tipos-oportunidad-negocio";
|
|
25
|
+
"tipos-impuestos": "tipos-impuestos";
|
|
26
|
+
"naturalezas-abono": "naturalezas-abono";
|
|
27
|
+
incidencecode: "incidencecode";
|
|
28
|
+
"claves-facturacion": "claves-facturacion";
|
|
29
|
+
paises: "paises";
|
|
30
|
+
nacionalidades: "nacionalidades";
|
|
31
|
+
provincias: "provincias";
|
|
32
|
+
poblaciones: "poblaciones";
|
|
33
|
+
empresas: "empresas";
|
|
34
|
+
delegaciones: "delegaciones";
|
|
35
|
+
"lineas-negocio": "lineas-negocio";
|
|
36
|
+
"cargos-clientes": "cargos-clientes";
|
|
37
|
+
calendarios: "calendarios";
|
|
38
|
+
series: "series";
|
|
39
|
+
familias: "familias";
|
|
40
|
+
subfamilias: "subfamilias";
|
|
41
|
+
lineas: "lineas";
|
|
42
|
+
bancos: "bancos";
|
|
43
|
+
}>;
|
|
19
44
|
/**
|
|
20
45
|
* Mapeo catálogo → endpoint REST de Freemática.
|
|
21
46
|
*
|
|
@@ -27,7 +27,11 @@ import { z } from 'zod';
|
|
|
27
27
|
*
|
|
28
28
|
* TODO(TD-152): verificar contra API real cuando esté disponible.
|
|
29
29
|
*/
|
|
30
|
-
export declare const EstadoPedidoEnum: z.ZodEnum<
|
|
30
|
+
export declare const EstadoPedidoEnum: z.ZodEnum<{
|
|
31
|
+
pendiente: "pendiente";
|
|
32
|
+
bloqueado: "bloqueado";
|
|
33
|
+
recibido: "recibido";
|
|
34
|
+
}>;
|
|
31
35
|
export type EstadoPedido = z.infer<typeof EstadoPedidoEnum>;
|
|
32
36
|
/**
|
|
33
37
|
* Genera la expresión FIQL para el filtro de estado de pedido de compra.
|
|
@@ -82,7 +86,11 @@ export declare const ListPedidosCompraFiltersSchema: {
|
|
|
82
86
|
fechaEntregaDesde: z.ZodOptional<z.ZodString>;
|
|
83
87
|
fechaEntregaHasta: z.ZodOptional<z.ZodString>;
|
|
84
88
|
referencia: z.ZodOptional<z.ZodString>;
|
|
85
|
-
estado: z.ZodOptional<z.ZodEnum<
|
|
89
|
+
estado: z.ZodOptional<z.ZodEnum<{
|
|
90
|
+
pendiente: "pendiente";
|
|
91
|
+
bloqueado: "bloqueado";
|
|
92
|
+
recibido: "recibido";
|
|
93
|
+
}>>;
|
|
86
94
|
page: z.ZodDefault<z.ZodNumber>;
|
|
87
95
|
items: z.ZodDefault<z.ZodNumber>;
|
|
88
96
|
};
|
package/dist/tools/prl.d.ts
CHANGED
|
@@ -7,32 +7,12 @@ import type { FreematicaClient } from '../clients/freematica-client.js';
|
|
|
7
7
|
* Se usa en los tests y dentro del handler. NO se pasa directamente a server.tool
|
|
8
8
|
* porque ZodEffects no es ZodRawShapeCompat.
|
|
9
9
|
*/
|
|
10
|
-
export declare const FichaPrevClienteRefinedSchema: z.
|
|
10
|
+
export declare const FichaPrevClienteRefinedSchema: z.ZodObject<{
|
|
11
11
|
codCliente: z.ZodOptional<z.ZodString>;
|
|
12
12
|
grupoCliente: z.ZodOptional<z.ZodNumber>;
|
|
13
13
|
codLocalizacionServicio: z.ZodOptional<z.ZodNumber>;
|
|
14
14
|
codigoFicha: z.ZodOptional<z.ZodString>;
|
|
15
|
-
},
|
|
16
|
-
codCliente?: string | undefined;
|
|
17
|
-
grupoCliente?: number | undefined;
|
|
18
|
-
codLocalizacionServicio?: number | undefined;
|
|
19
|
-
codigoFicha?: string | undefined;
|
|
20
|
-
}, {
|
|
21
|
-
codCliente?: string | undefined;
|
|
22
|
-
grupoCliente?: number | undefined;
|
|
23
|
-
codLocalizacionServicio?: number | undefined;
|
|
24
|
-
codigoFicha?: string | undefined;
|
|
25
|
-
}>, {
|
|
26
|
-
codCliente?: string | undefined;
|
|
27
|
-
grupoCliente?: number | undefined;
|
|
28
|
-
codLocalizacionServicio?: number | undefined;
|
|
29
|
-
codigoFicha?: string | undefined;
|
|
30
|
-
}, {
|
|
31
|
-
codCliente?: string | undefined;
|
|
32
|
-
grupoCliente?: number | undefined;
|
|
33
|
-
codLocalizacionServicio?: number | undefined;
|
|
34
|
-
codigoFicha?: string | undefined;
|
|
35
|
-
}>;
|
|
15
|
+
}, z.core.$strip>;
|
|
36
16
|
/**
|
|
37
17
|
* Registra las tools MCP del dominio PRL (Prevención de Riesgos Laborales).
|
|
38
18
|
*
|
package/dist/tools/prl.js
CHANGED
|
@@ -176,7 +176,7 @@ export function registerPrlTools(server, client) {
|
|
|
176
176
|
codigoFicha,
|
|
177
177
|
});
|
|
178
178
|
if (!validation.success) {
|
|
179
|
-
const msg = validation.error.
|
|
179
|
+
const msg = validation.error.issues.map((e) => e.message).join('; ');
|
|
180
180
|
return error(new Error(msg));
|
|
181
181
|
}
|
|
182
182
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubiia/mcp-freematica",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "MCP server for Freemática REST API (consumed by Claude via Nubiia)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"express-rate-limit": "^8.3.1",
|
|
57
57
|
"pino": "^10.3.1",
|
|
58
58
|
"uuid": "^14.0.0",
|
|
59
|
-
"zod": "^
|
|
59
|
+
"zod": "^4.4.3"
|
|
60
60
|
},
|
|
61
61
|
"lint-staged": {
|
|
62
62
|
"*.{ts,js}": [
|
|
@@ -69,18 +69,18 @@
|
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/cors": "^2.8.19",
|
|
71
71
|
"@types/express": "^4.17.21",
|
|
72
|
-
"@types/node": "^
|
|
72
|
+
"@types/node": "^26.0.1",
|
|
73
73
|
"@types/uuid": "^10.0.0",
|
|
74
74
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
75
75
|
"@typescript-eslint/parser": "^8.0.0",
|
|
76
76
|
"@vitest/coverage-v8": "^3.2.6",
|
|
77
77
|
"@vitest/ui": "^3.2.6",
|
|
78
78
|
"dotenv": "^16.0.0",
|
|
79
|
-
"eslint": "^
|
|
79
|
+
"eslint": "^10.6.0",
|
|
80
80
|
"fast-check": "^4.8.0",
|
|
81
81
|
"husky": "^9.1.7",
|
|
82
82
|
"lint-staged": "^16.4.0",
|
|
83
|
-
"nock": "^
|
|
83
|
+
"nock": "^14.0.16",
|
|
84
84
|
"pino-pretty": "^13.1.3",
|
|
85
85
|
"prettier": "^3.3.0",
|
|
86
86
|
"tsx": "^4.6.0",
|