@nubiia/mcp-freematica 0.6.2 → 0.6.4

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 CHANGED
@@ -1,6 +1,12 @@
1
1
  # mcp-freematica
2
2
 
3
- MCP server que expone operaciones del API REST de Freemática para ser consumidas por Claude a través de Nubiia.
3
+ [![npm version](https://img.shields.io/npm/v/@nubiia/mcp-freematica)](https://www.npmjs.com/package/@nubiia/mcp-freematica)
4
+ [![license: MIT](https://img.shields.io/npm/l/@nubiia/mcp-freematica)](./LICENSE)
5
+ [![by Nubiia](https://img.shields.io/badge/by-Nubiia-6C4EE3)](https://nubiia.es)
6
+
7
+ MCP server que expone operaciones del API REST de Freemática (ERP: facturación, cartera, proveedores, contabilidad, personal) para ser consumidas por asistentes de IA como Claude.
8
+
9
+ > Built and maintained by **[Nubiia](https://nubiia.es)** — automatización e integraciones con IA para negocios (MCP, Holded, Pipedrive y más). ¿Quieres algo así para tu empresa? Escríbenos en **[nubiia.es](https://nubiia.es)**.
4
10
 
5
11
  ## Stack
6
12
 
@@ -510,6 +516,26 @@ node dist/index.js
510
516
  - API: `apidocs/Freematica API - Complete Collection.postman_collection.json`
511
517
  - CHANGELOG: `CHANGELOG.md`
512
518
 
519
+ ## About Nubiia
520
+
521
+ This MCP server is built and maintained by **[Nubiia](https://nubiia.es)**.
522
+
523
+ [Nubiia](https://nubiia.es) ayuda a empresas a **automatizar procesos e integrar sus herramientas con IA**: servidores MCP a medida, integraciones con ERPs y CRMs (Freemática, Holded, Pipedrive…), y agentes que conectan tus datos de negocio con asistentes como Claude. Este `@nubiia/mcp-freematica` es un ejemplo open source de lo que hacemos.
524
+
525
+ 👉 ¿Quieres una integración o automatización con IA para tu negocio? **[nubiia.es](https://nubiia.es)** · ✉️ [hola@nubiia.es](mailto:hola@nubiia.es)
526
+
527
+ ## Author
528
+
529
+ Built by **[Nubiia](https://nubiia.es)** — [nubiia.es](https://nubiia.es) · [hola@nubiia.es](mailto:hola@nubiia.es)
530
+
531
+ Maintainer: Samuel Fraga — [GitHub](https://github.com/iamsamuelfraga)
532
+
533
+ ## Links
534
+
535
+ - [Nubiia — AI automation & integrations](https://nubiia.es)
536
+ - [npm: @nubiia/mcp-freematica](https://www.npmjs.com/package/@nubiia/mcp-freematica)
537
+ - [GitHub: nubiia-dev/mcp-freematica](https://github.com/nubiia-dev/mcp-freematica)
538
+
513
539
  ## Licencia
514
540
 
515
541
  MIT — ver `LICENSE`.
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
- }, "strip", z.ZodTypeAny, {
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.ZodNumber>;
11
+ MCP_PORT: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
26
12
  MCP_ALLOWED_ORIGINS: z.ZodDefault<z.ZodString>;
27
- }, "strip", z.ZodTypeAny, {
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
- * Timeout por petición HTTP en milisegundos.
43
- * Por defecto: 30000 (30 segundos).
44
- */
45
- FREEMATICA_TIMEOUT_MS: z.ZodDefault<z.ZodNumber>;
46
- /**
47
- * Número máximo de reintentos para errores 5xx y errores de red.
48
- * Los errores 4xx nunca se reintentan.
49
- * Por defecto: 3.
50
- */
51
- FREEMATICA_MAX_RETRIES: z.ZodDefault<z.ZodNumber>;
52
- /**
53
- * Nivel de logging de pino.
54
- * Valores válidos: trace | debug | info | warn | error | fatal.
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<["pendiente", "cancelado", "derivado"]>;
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<["pendiente", "cancelado", "derivado"]>>;
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<["PDF", "XML", "ERROR"]>>;
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
- }, "strip", z.ZodTypeAny, {
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
- }, "strip", z.ZodTypeAny, {
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
- }, "strip", z.ZodTypeAny, {
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<["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"]>;
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<["pendiente", "bloqueado", "recibido"]>;
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<["pendiente", "bloqueado", "recibido"]>>;
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
  };
@@ -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.ZodEffects<z.ZodObject<{
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
- }, "strip", z.ZodTypeAny, {
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.errors.map((e) => e.message).join('; ');
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,7 +1,7 @@
1
1
  {
2
2
  "name": "@nubiia/mcp-freematica",
3
- "version": "0.6.2",
4
- "description": "MCP server for Freemática REST API (consumed by Claude via Nubiia)",
3
+ "version": "0.6.4",
4
+ "description": "MCP server for the Freemática ERP REST API: invoicing, accounts receivable, suppliers, accounting and HR data for AI assistants like Claude. Built by Nubiia.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "bugs": {
34
34
  "url": "https://github.com/nubiia-dev/mcp-freematica/issues"
35
35
  },
36
- "homepage": "https://github.com/nubiia-dev/mcp-freematica#readme",
36
+ "homepage": "https://nubiia.es",
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
@@ -44,9 +44,26 @@
44
44
  "mcp",
45
45
  "model-context-protocol",
46
46
  "freematica",
47
+ "freematica-api",
48
+ "erp",
49
+ "invoicing",
50
+ "facturacion",
51
+ "accounting",
52
+ "contabilidad",
53
+ "cartera",
54
+ "api",
55
+ "claude",
56
+ "anthropic",
57
+ "ai",
58
+ "llm",
59
+ "automation",
47
60
  "nubiia"
48
61
  ],
49
- "author": "Nubiia",
62
+ "author": {
63
+ "name": "Nubiia",
64
+ "email": "hola@nubiia.es",
65
+ "url": "https://nubiia.es"
66
+ },
50
67
  "license": "MIT",
51
68
  "dependencies": {
52
69
  "@modelcontextprotocol/sdk": "^1.27.1",
@@ -56,7 +73,7 @@
56
73
  "express-rate-limit": "^8.3.1",
57
74
  "pino": "^10.3.1",
58
75
  "uuid": "^14.0.0",
59
- "zod": "^3.23.8"
76
+ "zod": "^4.4.3"
60
77
  },
61
78
  "lint-staged": {
62
79
  "*.{ts,js}": [
@@ -69,18 +86,18 @@
69
86
  "devDependencies": {
70
87
  "@types/cors": "^2.8.19",
71
88
  "@types/express": "^4.17.21",
72
- "@types/node": "^20.10.0",
89
+ "@types/node": "^26.0.1",
73
90
  "@types/uuid": "^10.0.0",
74
91
  "@typescript-eslint/eslint-plugin": "^8.0.0",
75
92
  "@typescript-eslint/parser": "^8.0.0",
76
93
  "@vitest/coverage-v8": "^3.2.6",
77
94
  "@vitest/ui": "^3.2.6",
78
95
  "dotenv": "^16.0.0",
79
- "eslint": "^9.0.0",
96
+ "eslint": "^10.6.0",
80
97
  "fast-check": "^4.8.0",
81
98
  "husky": "^9.1.7",
82
99
  "lint-staged": "^16.4.0",
83
- "nock": "^13.5.0",
100
+ "nock": "^14.0.16",
84
101
  "pino-pretty": "^13.1.3",
85
102
  "prettier": "^3.3.0",
86
103
  "tsx": "^4.6.0",