@zincapp/mcp-server 1.9.0 → 1.10.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.
@@ -17,6 +17,7 @@ import { registerLinkGestorAuthorizations } from './link-gestor-authorizations.j
17
17
  import { registerProposeNt } from './propose-nt.js';
18
18
  import { registerLookupAuthorization } from './lookup-authorization.js';
19
19
  import { registerNtFinalGestor } from './nt-final-gestor.js';
20
+ import { registerUpsertGestor } from './upsert-gestor.js';
20
21
  export function registerAllTools(server, client) {
21
22
  registerSearchDocs(server, client);
22
23
  registerReadDoc(server, client);
@@ -37,4 +38,5 @@ export function registerAllTools(server, client) {
37
38
  registerProposeNt(server, client);
38
39
  registerLookupAuthorization(server, client);
39
40
  registerNtFinalGestor(server, client);
41
+ registerUpsertGestor(server, client);
40
42
  }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { ZincAppClient } from '../client.js';
3
+ export declare function registerUpsertGestor(server: McpServer, client: ZincAppClient): void;
@@ -0,0 +1,59 @@
1
+ import { z } from 'zod';
2
+ import { resolveElevation } from './elevation.js';
3
+ export function registerUpsertGestor(server, client) {
4
+ server.tool('upsert_entidad', 'Alta o completado (best-effort) de una entidad gestor/transportista por CIF, bajo la elevación del ' +
5
+ 'operador. Idempotente: si el CIF ya existe la completa (solo los campos aportados), si no la crea. ' +
6
+ 'No valida E3L: rellena lo disponible.', {
7
+ cif: z.string().describe('CIF de la entidad (identidad; requerido).'),
8
+ nombre: z.string().optional(),
9
+ entityType: z.number().int().optional().describe('tipo_entidad (E3L lo exige a nivel entidad).'),
10
+ telefono: z.string().optional(),
11
+ mail: z.string().optional(),
12
+ gestor: z.boolean().optional(),
13
+ transportista: z.boolean().optional(),
14
+ }, async (args) => {
15
+ const elev = await resolveElevation(client);
16
+ if ('content' in elev)
17
+ return elev;
18
+ const res = await client.post('/mwm/retirada/upsert-entidad', { confirm: true, ...args });
19
+ const verbo = res.outcome === 'created' ? 'creada' : 'actualizada';
20
+ return {
21
+ content: [{
22
+ type: 'text',
23
+ text: `Entidad **${verbo}** (CIF \`${args.cif}\`) — clientId \`${res.clientId}\`.`,
24
+ }],
25
+ };
26
+ });
27
+ server.tool('upsert_centro', 'Alta o completado (best-effort) de un centro de un gestor, bajo la elevación del operador. Identidad ' +
28
+ 'por centerId o por nima inequívoco (varios con la misma nima → 409, aporta centerId). Valida un id de ' +
29
+ 'catálogo solo si se aporta. Si aportas authId+autorizacion, hace también el upsert de la autorización.', {
30
+ clientId: z.number().int().describe('clientId de la entidad padre (requerido; debe existir).'),
31
+ centerId: z.number().int().optional().describe('Identidad explícita del centro (si se conoce).'),
32
+ nima: z.number().int().optional().describe('NIMA para identificar el centro si no hay centerId.'),
33
+ nombre: z.string().optional(),
34
+ direccion: z.string().optional(),
35
+ ciudad: z.string().optional(),
36
+ cp: z.string().optional(),
37
+ regionId: z.number().int().optional(),
38
+ provinceId: z.number().int().optional(),
39
+ localityId: z.number().int().optional(),
40
+ vialId: z.number().int().optional(),
41
+ codigoCnae: z.string().optional().describe('Código CNAE (varchar(4), PK de IneCnae).'),
42
+ telefono: z.string().optional(),
43
+ mail: z.string().optional(),
44
+ authId: z.string().optional().describe('Tipo de autorización (T01/G0x) — con autorizacion, hace el upsert.'),
45
+ autorizacion: z.string().optional().describe('Número de registro de la autorización (lo aporta el humano).'),
46
+ }, async (args) => {
47
+ const elev = await resolveElevation(client);
48
+ if ('content' in elev)
49
+ return elev;
50
+ const res = await client.post('/mwm/retirada/upsert-centro', { confirm: true, ...args });
51
+ const verbo = res.outcome === 'created' ? 'creado' : 'actualizado';
52
+ return {
53
+ content: [{
54
+ type: 'text',
55
+ text: `Centro **${verbo}** — clientId \`${res.clientId}\`, centerId \`${res.centerId}\`.`,
56
+ }],
57
+ };
58
+ });
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zincapp/mcp-server",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "MCP server for ZincApp — search docs, read API reference, execute sandbox calls, and audit/complete waste removals (retiradas)",
5
5
  "type": "module",
6
6
  "bin": {