@frihet/mcp-server 1.9.0-beta.1 → 1.12.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/README.md +263 -13
- package/dist/__tests__/d4b-hr-payroll-onboarding-tools.test.d.ts +13 -0
- package/dist/__tests__/d4b-hr-payroll-onboarding-tools.test.d.ts.map +1 -0
- package/dist/__tests__/d4b-hr-payroll-onboarding-tools.test.js +420 -0
- package/dist/__tests__/d4b-hr-payroll-onboarding-tools.test.js.map +1 -0
- package/dist/__tests__/einvoice-day4-tools.test.d.ts +16 -0
- package/dist/__tests__/einvoice-day4-tools.test.d.ts.map +1 -0
- package/dist/__tests__/einvoice-day4-tools.test.js +377 -0
- package/dist/__tests__/einvoice-day4-tools.test.js.map +1 -0
- package/dist/__tests__/einvoice-tools.test.d.ts +1 -1
- package/dist/__tests__/einvoice-tools.test.js +25 -12
- package/dist/__tests__/einvoice-tools.test.js.map +1 -1
- package/dist/__tests__/fiscal-tools.test.d.ts +5 -4
- package/dist/__tests__/fiscal-tools.test.d.ts.map +1 -1
- package/dist/__tests__/fiscal-tools.test.js +8 -26
- package/dist/__tests__/fiscal-tools.test.js.map +1 -1
- package/dist/__tests__/openai-profile.test.d.ts +10 -0
- package/dist/__tests__/openai-profile.test.d.ts.map +1 -0
- package/dist/__tests__/openai-profile.test.js +132 -0
- package/dist/__tests__/openai-profile.test.js.map +1 -0
- package/dist/__tests__/recurring-tools.test.d.ts +14 -7
- package/dist/__tests__/recurring-tools.test.d.ts.map +1 -1
- package/dist/__tests__/recurring-tools.test.js +195 -9
- package/dist/__tests__/recurring-tools.test.js.map +1 -1
- package/dist/__tests__/team-tools.test.d.ts +18 -0
- package/dist/__tests__/team-tools.test.d.ts.map +1 -0
- package/dist/__tests__/team-tools.test.js +228 -0
- package/dist/__tests__/team-tools.test.js.map +1 -0
- package/dist/__tests__/time-tools.test.d.ts +9 -7
- package/dist/__tests__/time-tools.test.d.ts.map +1 -1
- package/dist/__tests__/time-tools.test.js +96 -9
- package/dist/__tests__/time-tools.test.js.map +1 -1
- package/dist/client-interface.d.ts +236 -0
- package/dist/client-interface.d.ts.map +1 -1
- package/dist/client.d.ts +245 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +266 -5
- package/dist/client.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/openai-profile.d.ts +4 -1
- package/dist/openai-profile.d.ts.map +1 -1
- package/dist/openai-profile.js +105 -1
- package/dist/openai-profile.js.map +1 -1
- package/dist/tools/accountingClose.d.ts +20 -0
- package/dist/tools/accountingClose.d.ts.map +1 -0
- package/dist/tools/accountingClose.js +119 -0
- package/dist/tools/accountingClose.js.map +1 -0
- package/dist/tools/audit_gl.d.ts +19 -0
- package/dist/tools/audit_gl.d.ts.map +1 -0
- package/dist/tools/audit_gl.js +86 -0
- package/dist/tools/audit_gl.js.map +1 -0
- package/dist/tools/bank_rules.d.ts +23 -0
- package/dist/tools/bank_rules.d.ts.map +1 -0
- package/dist/tools/bank_rules.js +96 -0
- package/dist/tools/bank_rules.js.map +1 -0
- package/dist/tools/einvoice.d.ts +70 -3
- package/dist/tools/einvoice.d.ts.map +1 -1
- package/dist/tools/einvoice.js +421 -3
- package/dist/tools/einvoice.js.map +1 -1
- package/dist/tools/fiscal.d.ts +3 -2
- package/dist/tools/fiscal.d.ts.map +1 -1
- package/dist/tools/fiscal.js +4 -22
- package/dist/tools/fiscal.js.map +1 -1
- package/dist/tools/gestoria.d.ts +28 -0
- package/dist/tools/gestoria.d.ts.map +1 -0
- package/dist/tools/gestoria.js +248 -0
- package/dist/tools/gestoria.js.map +1 -0
- package/dist/tools/hr.d.ts +24 -0
- package/dist/tools/hr.d.ts.map +1 -0
- package/dist/tools/hr.js +219 -0
- package/dist/tools/hr.js.map +1 -0
- package/dist/tools/igic.d.ts +19 -0
- package/dist/tools/igic.d.ts.map +1 -0
- package/dist/tools/igic.js +102 -0
- package/dist/tools/igic.js.map +1 -0
- package/dist/tools/impuesto_sociedades.d.ts +18 -0
- package/dist/tools/impuesto_sociedades.d.ts.map +1 -0
- package/dist/tools/impuesto_sociedades.js +64 -0
- package/dist/tools/impuesto_sociedades.js.map +1 -0
- package/dist/tools/onboard_vies.d.ts +22 -0
- package/dist/tools/onboard_vies.d.ts.map +1 -0
- package/dist/tools/onboard_vies.js +74 -0
- package/dist/tools/onboard_vies.js.map +1 -0
- package/dist/tools/onboarding.d.ts +19 -0
- package/dist/tools/onboarding.d.ts.map +1 -0
- package/dist/tools/onboarding.js +63 -0
- package/dist/tools/onboarding.js.map +1 -0
- package/dist/tools/payroll.d.ts +20 -0
- package/dist/tools/payroll.d.ts.map +1 -0
- package/dist/tools/payroll.js +73 -0
- package/dist/tools/payroll.js.map +1 -0
- package/dist/tools/permissions.d.ts +19 -0
- package/dist/tools/permissions.d.ts.map +1 -0
- package/dist/tools/permissions.js +52 -0
- package/dist/tools/permissions.js.map +1 -0
- package/dist/tools/portal_domain.d.ts +19 -0
- package/dist/tools/portal_domain.d.ts.map +1 -0
- package/dist/tools/portal_domain.js +85 -0
- package/dist/tools/portal_domain.js.map +1 -0
- package/dist/tools/recurring.d.ts +10 -5
- package/dist/tools/recurring.d.ts.map +1 -1
- package/dist/tools/recurring.js +178 -6
- package/dist/tools/recurring.js.map +1 -1
- package/dist/tools/register-all.d.ts +2 -2
- package/dist/tools/register-all.d.ts.map +1 -1
- package/dist/tools/register-all.js +41 -3
- package/dist/tools/register-all.js.map +1 -1
- package/dist/tools/shared.d.ts +313 -1
- package/dist/tools/shared.d.ts.map +1 -1
- package/dist/tools/shared.js +256 -0
- package/dist/tools/shared.js.map +1 -1
- package/dist/tools/team.d.ts +17 -0
- package/dist/tools/team.d.ts.map +1 -0
- package/dist/tools/team.js +141 -0
- package/dist/tools/team.js.map +1 -0
- package/dist/tools/time.d.ts +9 -8
- package/dist/tools/time.d.ts.map +1 -1
- package/dist/tools/time.js +54 -9
- package/dist/tools/time.js.map +1 -1
- package/dist/tools/webhooks.d.ts.map +1 -1
- package/dist/tools/webhooks.js +27 -1
- package/dist/tools/webhooks.js.map +1 -1
- package/package.json +12 -5
- package/scripts/audit-mcp-refs.mjs +331 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IGIC (Canary Islands indirect tax) tools for the Frihet MCP server — Day 1 Megasprint (4 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. frihet_modelo_415_summary — M415 operations >€3,005 annual (Canarias)
|
|
6
|
+
* 2. frihet_modelo_425_summary — M425 resumen anual IGIC (Canarias)
|
|
7
|
+
* 3. frihet_modelo_418_summary — M418 mensual grandes empresas IGIC (Canarias)
|
|
8
|
+
* 4. frihet_aiem_calculate — Arbitrio sobre Importaciones y Entrega de Mercancías calculation
|
|
9
|
+
*
|
|
10
|
+
* NOTE: ATC SOAP integration skipped — internal infrastructure, not exposed via MCP.
|
|
11
|
+
*
|
|
12
|
+
* REST surface: /v1/igic/* — service-layer reads of workspace fiscal data.
|
|
13
|
+
* Backend callables: #390 IGIC services (Frihet-ERP PR #390).
|
|
14
|
+
* Tools surface 404 until REST shell ships.
|
|
15
|
+
*/
|
|
16
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
|
+
import type { IFrihetClient } from "../client-interface.js";
|
|
18
|
+
export declare function registerIgicTools(server: McpServer, client: IFrihetClient): void;
|
|
19
|
+
//# sourceMappingURL=igic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"igic.d.ts","sourceRoot":"","sources":["../../src/tools/igic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAQ5D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CA8GhF"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IGIC (Canary Islands indirect tax) tools for the Frihet MCP server — Day 1 Megasprint (4 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. frihet_modelo_415_summary — M415 operations >€3,005 annual (Canarias)
|
|
6
|
+
* 2. frihet_modelo_425_summary — M425 resumen anual IGIC (Canarias)
|
|
7
|
+
* 3. frihet_modelo_418_summary — M418 mensual grandes empresas IGIC (Canarias)
|
|
8
|
+
* 4. frihet_aiem_calculate — Arbitrio sobre Importaciones y Entrega de Mercancías calculation
|
|
9
|
+
*
|
|
10
|
+
* NOTE: ATC SOAP integration skipped — internal infrastructure, not exposed via MCP.
|
|
11
|
+
*
|
|
12
|
+
* REST surface: /v1/igic/* — service-layer reads of workspace fiscal data.
|
|
13
|
+
* Backend callables: #390 IGIC services (Frihet-ERP PR #390).
|
|
14
|
+
* Tools surface 404 until REST shell ships.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from "zod/v4";
|
|
17
|
+
import { withToolLogging, formatRecord, getContent, READ_ONLY_ANNOTATIONS, } from "./shared.js";
|
|
18
|
+
export function registerIgicTools(server, client) {
|
|
19
|
+
// -- frihet_modelo_415_summary -------------------------------------------
|
|
20
|
+
server.registerTool("frihet_modelo_415_summary", {
|
|
21
|
+
title: "Get Modelo 415 Summary (IGIC Annual Operations >€3,005)",
|
|
22
|
+
description: "Get IGIC Modelo 415 summary — annual declaration of operations with third parties exceeding €3,005. " +
|
|
23
|
+
"Canary Islands equivalent of Modelo 347 (peninsular Spain). " +
|
|
24
|
+
"Returns counterparty list, operation totals, and filing deadline. " +
|
|
25
|
+
"Example: year='2025'. " +
|
|
26
|
+
"/ Resumen del Modelo 415 IGIC — declaracion anual de operaciones con terceros > €3.005. " +
|
|
27
|
+
"Equivalente canario del Modelo 347. Devuelve listado de contrapartes, totales y plazo.",
|
|
28
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
29
|
+
inputSchema: {
|
|
30
|
+
year: z.string().optional().describe("Tax year (e.g. '2025', defaults to previous year) / Ejercicio fiscal (ej. '2025', por defecto ejercicio anterior)"),
|
|
31
|
+
},
|
|
32
|
+
}, async ({ year }) => withToolLogging("frihet_modelo_415_summary", async () => {
|
|
33
|
+
const result = await client.getIgicModeloSummary("415", { year });
|
|
34
|
+
return {
|
|
35
|
+
content: [getContent(formatRecord("Modelo 415 Summary (IGIC)", result))],
|
|
36
|
+
structuredContent: result,
|
|
37
|
+
};
|
|
38
|
+
}));
|
|
39
|
+
// -- frihet_modelo_425_summary -------------------------------------------
|
|
40
|
+
server.registerTool("frihet_modelo_425_summary", {
|
|
41
|
+
title: "Get Modelo 425 Summary (IGIC Annual Recap)",
|
|
42
|
+
description: "Get IGIC Modelo 425 summary — annual IGIC recap for Canary Islands businesses. " +
|
|
43
|
+
"Returns aggregated IGIC collected, deductible IGIC, net payable, and filing status. " +
|
|
44
|
+
"Example: year='2025'. " +
|
|
45
|
+
"/ Resumen del Modelo 425 IGIC — resumen anual IGIC para empresas canarias. " +
|
|
46
|
+
"Devuelve IGIC repercutido, IGIC soportado, cuota neta y estado de presentacion.",
|
|
47
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
48
|
+
inputSchema: {
|
|
49
|
+
year: z.string().optional().describe("Tax year (e.g. '2025', defaults to previous year) / Ejercicio fiscal (ej. '2025', por defecto ejercicio anterior)"),
|
|
50
|
+
},
|
|
51
|
+
}, async ({ year }) => withToolLogging("frihet_modelo_425_summary", async () => {
|
|
52
|
+
const result = await client.getIgicModeloSummary("425", { year });
|
|
53
|
+
return {
|
|
54
|
+
content: [getContent(formatRecord("Modelo 425 Summary (IGIC)", result))],
|
|
55
|
+
structuredContent: result,
|
|
56
|
+
};
|
|
57
|
+
}));
|
|
58
|
+
// -- frihet_modelo_418_summary -------------------------------------------
|
|
59
|
+
server.registerTool("frihet_modelo_418_summary", {
|
|
60
|
+
title: "Get Modelo 418 Summary (IGIC Monthly Large Enterprises)",
|
|
61
|
+
description: "Get IGIC Modelo 418 summary — monthly IGIC return for large enterprises (grandes empresas) in the Canary Islands. " +
|
|
62
|
+
"Returns monthly IGIC collected, deductible, net due, and any carryover. " +
|
|
63
|
+
"Applicable when annual turnover exceeds the grandes empresas threshold. " +
|
|
64
|
+
"Example: period='2026-04'. " +
|
|
65
|
+
"/ Resumen del Modelo 418 IGIC — declaracion mensual para grandes empresas en Canarias. " +
|
|
66
|
+
"Devuelve IGIC repercutido, soportado, cuota a ingresar y saldo a compensar.",
|
|
67
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
68
|
+
inputSchema: {
|
|
69
|
+
period: z.string().optional().describe("Period in YYYY-MM format (defaults to last month) / Periodo YYYY-MM (por defecto mes anterior)"),
|
|
70
|
+
},
|
|
71
|
+
}, async ({ period }) => withToolLogging("frihet_modelo_418_summary", async () => {
|
|
72
|
+
const result = await client.getIgicModeloSummary("418", { period });
|
|
73
|
+
return {
|
|
74
|
+
content: [getContent(formatRecord("Modelo 418 Summary (IGIC Monthly)", result))],
|
|
75
|
+
structuredContent: result,
|
|
76
|
+
};
|
|
77
|
+
}));
|
|
78
|
+
// -- frihet_aiem_calculate ------------------------------------------------
|
|
79
|
+
server.registerTool("frihet_aiem_calculate", {
|
|
80
|
+
title: "Calculate AIEM (Arbitrio Importación Canarias)",
|
|
81
|
+
description: "Calculate the AIEM (Arbitrio sobre Importaciones y Entrega de Mercancias) for goods imported " +
|
|
82
|
+
"to or produced in the Canary Islands. " +
|
|
83
|
+
"Returns applicable AIEM rate, tax base, and amount due for the given product. " +
|
|
84
|
+
"AIEM is a Canarian surcharge on top of IGIC for protected local industries. " +
|
|
85
|
+
"Example: ncCode='8471', amount=1000, description='Ordenadores portatiles'. " +
|
|
86
|
+
"/ Calcula el AIEM para mercancias importadas o producidas en Canarias. " +
|
|
87
|
+
"Devuelve tipo aplicable, base imponible y cuota. El AIEM protege la industria local canaria.",
|
|
88
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
89
|
+
inputSchema: {
|
|
90
|
+
ncCode: z.string().describe("Nomenclatura Combinada (NC) tariff code / Codigo NC (nomenclatura combinada)"),
|
|
91
|
+
amount: z.number().describe("Taxable base amount in EUR / Base imponible en EUR"),
|
|
92
|
+
description: z.string().optional().describe("Product description for audit reference / Descripcion del producto (referencia auditoria)"),
|
|
93
|
+
},
|
|
94
|
+
}, async ({ ncCode, amount, description }) => withToolLogging("frihet_aiem_calculate", async () => {
|
|
95
|
+
const result = await client.calculateAiem({ ncCode, amount, description });
|
|
96
|
+
return {
|
|
97
|
+
content: [getContent(formatRecord(`AIEM Calculation (NC: ${ncCode})`, result))],
|
|
98
|
+
structuredContent: result,
|
|
99
|
+
};
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=igic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"igic.js","sourceRoot":"","sources":["../../src/tools/igic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,MAAqB;IACxE,2EAA2E;IAE3E,MAAM,CAAC,YAAY,CACjB,2BAA2B,EAC3B;QACE,KAAK,EAAE,yDAAyD;QAChE,WAAW,EACT,sGAAsG;YACtG,8DAA8D;YAC9D,oEAAoE;YACpE,wBAAwB;YACxB,0FAA0F;YAC1F,wFAAwF;QAC1F,WAAW,EAAE,qBAAqB;QAClC,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mHAAmH,CAAC;SAC1J;KACF,EACD,KAAK,EAAE,EAAE,IAAI,EAAE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ACL,OAAO,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,yBAAyB,MAAM,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;YAC/E,iBAAiB,EAAE,MAA4C;SAChE,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Impuesto sobre Sociedades (IS) tools for the Frihet MCP server — Day 1 Megasprint (2 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. frihet_modelo_200_summary — Modelo 200 IS anual (annual corporate tax return)
|
|
6
|
+
* 2. frihet_modelo_202_summary — Modelo 202 IS pagos fraccionados (3 installment payments)
|
|
7
|
+
*
|
|
8
|
+
* REST surface: /v1/is/* — service-layer reads of workspace IS data.
|
|
9
|
+
* Backend callables: #392 Modelo 200/202 IS (Frihet-ERP PR #392).
|
|
10
|
+
* Tools surface 404 until REST shell ships.
|
|
11
|
+
*
|
|
12
|
+
* Scope: Spanish SLs (Sociedad Limitada) and SAs filing corporate tax with AEAT.
|
|
13
|
+
* Canary Islands variant: same models apply; ATC collects IS with territorial adjustments.
|
|
14
|
+
*/
|
|
15
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16
|
+
import type { IFrihetClient } from "../client-interface.js";
|
|
17
|
+
export declare function registerImpuestoSociedadesTools(server: McpServer, client: IFrihetClient): void;
|
|
18
|
+
//# sourceMappingURL=impuesto_sociedades.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impuesto_sociedades.d.ts","sourceRoot":"","sources":["../../src/tools/impuesto_sociedades.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAQ5D,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CA2D9F"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Impuesto sobre Sociedades (IS) tools for the Frihet MCP server — Day 1 Megasprint (2 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. frihet_modelo_200_summary — Modelo 200 IS anual (annual corporate tax return)
|
|
6
|
+
* 2. frihet_modelo_202_summary — Modelo 202 IS pagos fraccionados (3 installment payments)
|
|
7
|
+
*
|
|
8
|
+
* REST surface: /v1/is/* — service-layer reads of workspace IS data.
|
|
9
|
+
* Backend callables: #392 Modelo 200/202 IS (Frihet-ERP PR #392).
|
|
10
|
+
* Tools surface 404 until REST shell ships.
|
|
11
|
+
*
|
|
12
|
+
* Scope: Spanish SLs (Sociedad Limitada) and SAs filing corporate tax with AEAT.
|
|
13
|
+
* Canary Islands variant: same models apply; ATC collects IS with territorial adjustments.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from "zod/v4";
|
|
16
|
+
import { withToolLogging, formatRecord, getContent, READ_ONLY_ANNOTATIONS, } from "./shared.js";
|
|
17
|
+
export function registerImpuestoSociedadesTools(server, client) {
|
|
18
|
+
// -- frihet_modelo_200_summary -------------------------------------------
|
|
19
|
+
server.registerTool("frihet_modelo_200_summary", {
|
|
20
|
+
title: "Get Modelo 200 Summary (Corporate Tax — Annual IS)",
|
|
21
|
+
description: "Get Modelo 200 summary — annual corporate income tax return (Impuesto sobre Sociedades) " +
|
|
22
|
+
"for Spanish SLs and SAs. Returns taxable base, deductions, tax rate, withholdings, " +
|
|
23
|
+
"installment payments made (M202), and net payable/refundable. " +
|
|
24
|
+
"Filing deadline: 25 days after 6 months from fiscal year end (typically 25 July for Dec FY). " +
|
|
25
|
+
"Example: year='2025'. " +
|
|
26
|
+
"/ Resumen Modelo 200 — declaracion anual del Impuesto sobre Sociedades para SL/SA. " +
|
|
27
|
+
"Devuelve base imponible, deducciones, tipo, retenciones, pagos fraccionados y cuota.",
|
|
28
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
29
|
+
inputSchema: {
|
|
30
|
+
year: z.string().optional().describe("Fiscal year (e.g. '2025', defaults to last closed year) / Ejercicio fiscal (ej. '2025', por defecto ultimo ejercicio cerrado)"),
|
|
31
|
+
},
|
|
32
|
+
}, async ({ year }) => withToolLogging("frihet_modelo_200_summary", async () => {
|
|
33
|
+
const result = await client.getISSummary("200", { year });
|
|
34
|
+
return {
|
|
35
|
+
content: [getContent(formatRecord("Modelo 200 Summary (IS Anual)", result))],
|
|
36
|
+
structuredContent: result,
|
|
37
|
+
};
|
|
38
|
+
}));
|
|
39
|
+
// -- frihet_modelo_202_summary -------------------------------------------
|
|
40
|
+
server.registerTool("frihet_modelo_202_summary", {
|
|
41
|
+
title: "Get Modelo 202 Summary (Corporate Tax — Installment Payments)",
|
|
42
|
+
description: "Get Modelo 202 summary — installment payments (pagos fraccionados) for Impuesto sobre Sociedades. " +
|
|
43
|
+
"Three annual payments: April (1P), October (2P), December (3P). " +
|
|
44
|
+
"Returns each installment amount, due date, payment status, and cumulative total vs M200 projection. " +
|
|
45
|
+
"Example: year='2026', installment='1P'. " +
|
|
46
|
+
"/ Resumen Modelo 202 — pagos fraccionados del Impuesto sobre Sociedades. " +
|
|
47
|
+
"Tres plazos: abril (1P), octubre (2P), diciembre (3P). Devuelve importes, plazos y estado de pago.",
|
|
48
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
49
|
+
inputSchema: {
|
|
50
|
+
year: z.string().optional().describe("Fiscal year of the installments (e.g. '2026') / Ejercicio de los pagos fraccionados (ej. '2026')"),
|
|
51
|
+
installment: z.enum(["1P", "2P", "3P"]).optional().describe("Specific installment (1P=April, 2P=October, 3P=December) or omit for all three / Plazo especifico (1P=abril, 2P=octubre, 3P=diciembre) u omitir para los tres"),
|
|
52
|
+
},
|
|
53
|
+
}, async ({ year, installment }) => withToolLogging("frihet_modelo_202_summary", async () => {
|
|
54
|
+
const result = await client.getISSummary("202", { year, installment });
|
|
55
|
+
const label = installment
|
|
56
|
+
? `Modelo 202 Summary (${installment} ${year ?? ""})`
|
|
57
|
+
: `Modelo 202 Summary (all installments ${year ?? ""})`;
|
|
58
|
+
return {
|
|
59
|
+
content: [getContent(formatRecord(label.trim(), result))],
|
|
60
|
+
structuredContent: result,
|
|
61
|
+
};
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=impuesto_sociedades.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impuesto_sociedades.js","sourceRoot":"","sources":["../../src/tools/impuesto_sociedades.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,+BAA+B,CAAC,MAAiB,EAAE,MAAqB;IACtF,2EAA2E;IAE3E,MAAM,CAAC,YAAY,CACjB,2BAA2B,EAC3B;QACE,KAAK,EAAE,oDAAoD;QAC3D,WAAW,EACT,0FAA0F;YAC1F,qFAAqF;YACrF,gEAAgE;YAChE,+FAA+F;YAC/F,wBAAwB;YACxB,qFAAqF;YACrF,sFAAsF;QACxF,WAAW,EAAE,qBAAqB;QAClC,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+HAA+H,CAAC;SACtK;KACF,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,eAAe,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;QAC1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,OAAO;YACL,OAAO,EAAE,CAAC,UAAU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board & VIES tools for the Frihet MCP server — Day 1 Megasprint (2 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. frihet_portal_onboard_link_generate — generate a self-onboard link (gestor admin side)
|
|
6
|
+
* 2. frihet_tax_id_vies_lookup — validate an EU tax ID via VIES
|
|
7
|
+
*
|
|
8
|
+
* Skipped (public portal flows, not appropriate for MCP):
|
|
9
|
+
* - validatePortalOnboardToken — public token validation
|
|
10
|
+
* - selfOnboardClient — self-service client registration (browser flow)
|
|
11
|
+
*
|
|
12
|
+
* REST surface: /v1/portal/onboard/* proxies Firebase callables:
|
|
13
|
+
* generatePortalOnboardLink, lookupTaxIdViaVIES (eu-west1)
|
|
14
|
+
*
|
|
15
|
+
* Backend status (post-Day 1 Megasprint, May 2026):
|
|
16
|
+
* Frihet-ERP PR #398 — Self-onboard VIES MERGED.
|
|
17
|
+
* Tools will surface 404 errors until backend REST shell ships.
|
|
18
|
+
*/
|
|
19
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
20
|
+
import type { IFrihetClient } from "../client-interface.js";
|
|
21
|
+
export declare function registerOnboardViesTools(server: McpServer, client: IFrihetClient): void;
|
|
22
|
+
//# sourceMappingURL=onboard_vies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboard_vies.d.ts","sourceRoot":"","sources":["../../src/tools/onboard_vies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAmEvF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-onboard & VIES tools for the Frihet MCP server — Day 1 Megasprint (2 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. frihet_portal_onboard_link_generate — generate a self-onboard link (gestor admin side)
|
|
6
|
+
* 2. frihet_tax_id_vies_lookup — validate an EU tax ID via VIES
|
|
7
|
+
*
|
|
8
|
+
* Skipped (public portal flows, not appropriate for MCP):
|
|
9
|
+
* - validatePortalOnboardToken — public token validation
|
|
10
|
+
* - selfOnboardClient — self-service client registration (browser flow)
|
|
11
|
+
*
|
|
12
|
+
* REST surface: /v1/portal/onboard/* proxies Firebase callables:
|
|
13
|
+
* generatePortalOnboardLink, lookupTaxIdViaVIES (eu-west1)
|
|
14
|
+
*
|
|
15
|
+
* Backend status (post-Day 1 Megasprint, May 2026):
|
|
16
|
+
* Frihet-ERP PR #398 — Self-onboard VIES MERGED.
|
|
17
|
+
* Tools will surface 404 errors until backend REST shell ships.
|
|
18
|
+
*/
|
|
19
|
+
import { z } from "zod/v4";
|
|
20
|
+
import { withToolLogging, formatRecord, getContent, mutateContent, READ_ONLY_ANNOTATIONS, CREATE_ANNOTATIONS, } from "./shared.js";
|
|
21
|
+
export function registerOnboardViesTools(server, client) {
|
|
22
|
+
// -- frihet_portal_onboard_link_generate ----------------------------------
|
|
23
|
+
server.registerTool("frihet_portal_onboard_link_generate", {
|
|
24
|
+
title: "Generate Portal Self-Onboard Link",
|
|
25
|
+
description: "Generate a time-limited, single-use self-onboard invitation link for a prospective client. " +
|
|
26
|
+
"The client follows the link to register their company details (CIF, address, contact) " +
|
|
27
|
+
"without requiring manual data entry by the gestor. " +
|
|
28
|
+
"Requires gestor/admin role. " +
|
|
29
|
+
"Example: email='cliente@empresa.com', expiresInHours=72. " +
|
|
30
|
+
"/ Genera un enlace de auto-registro para un cliente potencial. " +
|
|
31
|
+
"El cliente completa sus datos sin que el gestor tenga que introducirlos manualmente. " +
|
|
32
|
+
"Requiere rol gestor/admin.",
|
|
33
|
+
annotations: CREATE_ANNOTATIONS,
|
|
34
|
+
inputSchema: {
|
|
35
|
+
email: z.string().describe("Prospective client email address / Email del cliente potencial"),
|
|
36
|
+
name: z.string().optional().describe("Prospective client name (pre-fills the form) / Nombre del cliente (pre-rellena el formulario)"),
|
|
37
|
+
expiresInHours: z.number().int().min(1).max(168).optional()
|
|
38
|
+
.describe("Link expiry in hours, 1-168 (default 72h) / Caducidad del enlace en horas (por defecto 72h)"),
|
|
39
|
+
workspaceId: z.string().optional().describe("Target gestor workspace ID / ID del workspace del gestor"),
|
|
40
|
+
},
|
|
41
|
+
}, async ({ email, name, expiresInHours, workspaceId }) => withToolLogging("frihet_portal_onboard_link_generate", async () => {
|
|
42
|
+
const result = await client.generatePortalOnboardLink({ email, name, expiresInHours, workspaceId });
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
mutateContent(formatRecord(`Self-onboard link generated for ${email}`, result) +
|
|
46
|
+
"\n\nSend this link to the client via email or chat. It is single-use and time-limited." +
|
|
47
|
+
"\nEnvia este enlace al cliente por email o chat. Es de uso único y tiene caducidad."),
|
|
48
|
+
],
|
|
49
|
+
structuredContent: result,
|
|
50
|
+
};
|
|
51
|
+
}));
|
|
52
|
+
// -- frihet_tax_id_vies_lookup --------------------------------------------
|
|
53
|
+
server.registerTool("frihet_tax_id_vies_lookup", {
|
|
54
|
+
title: "Lookup Tax ID via VIES (EU VAT Validation)",
|
|
55
|
+
description: "Validate an EU VAT number (CIF intracomunitario) via the VIES (VAT Information Exchange System). " +
|
|
56
|
+
"Returns company name, address, and validity status from the official EU registry. " +
|
|
57
|
+
"Essential for intra-EU invoicing compliance — always validate before adding a EU client. " +
|
|
58
|
+
"Example: vatNumber='ES12345678A', countryCode='ES'. " +
|
|
59
|
+
"/ Valida un numero de IVA intracomunitario (CIF) via el sistema VIES de la UE. " +
|
|
60
|
+
"Devuelve nombre, direccion y validez desde el registro oficial europeo.",
|
|
61
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
62
|
+
inputSchema: {
|
|
63
|
+
vatNumber: z.string().describe("EU VAT number to validate (without country prefix) / Numero de IVA intracomunitario (sin prefijo de pais)"),
|
|
64
|
+
countryCode: z.string().length(2).describe("ISO 3166-1 alpha-2 country code (e.g. 'ES', 'DE', 'FR') / Codigo de pais ISO (ej. 'ES', 'DE', 'FR')"),
|
|
65
|
+
},
|
|
66
|
+
}, async ({ vatNumber, countryCode }) => withToolLogging("frihet_tax_id_vies_lookup", async () => {
|
|
67
|
+
const result = await client.lookupTaxIdViaVIES({ vatNumber, countryCode });
|
|
68
|
+
return {
|
|
69
|
+
content: [getContent(formatRecord(`VIES lookup: ${countryCode}${vatNumber}`, result))],
|
|
70
|
+
structuredContent: result,
|
|
71
|
+
};
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=onboard_vies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboard_vies.js","sourceRoot":"","sources":["../../src/tools/onboard_vies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,MAAqB;IAC/E,4EAA4E;IAE5E,MAAM,CAAC,YAAY,CACjB,qCAAqC,EACrC;QACE,KAAK,EAAE,mCAAmC;QAC1C,WAAW,EACT,6FAA6F;YAC7F,wFAAwF;YACxF,qDAAqD;YACrD,8BAA8B;YAC9B,2DAA2D;YAC3D,iEAAiE;YACjE,uFAAuF;YACvF,4BAA4B;QAC9B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gEAAgE,CAAC;YAC5F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,E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AS,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,eAAe,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;QAC5F,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;QAC3E,OAAO;YACL,OAAO,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,gBAAgB,WAAW,GAAG,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;YACtF,iBAAiB,EAAE,MAA4C;SAChE,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Onboarding tools for the Frihet MCP server — D4-B megasprint (2 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. onboarding_status — current workspace onboarding state (completed/pending steps)
|
|
6
|
+
* 2. onboarding_persona_set — set workspace persona (autonomo/empresa/agencia/gestoria)
|
|
7
|
+
*
|
|
8
|
+
* REST surface: /v1/onboarding/status, /v1/onboarding/persona
|
|
9
|
+
*
|
|
10
|
+
* Persona drives module visibility + default chart-of-accounts + onboarding checklist.
|
|
11
|
+
* Persona can only be set once during onboarding; later changes require workspace admin.
|
|
12
|
+
*
|
|
13
|
+
* NOTE: ERP backend endpoints land in parallel D4-A wave. 404s propagate as isError
|
|
14
|
+
* until backend ships.
|
|
15
|
+
*/
|
|
16
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
|
+
import type { IFrihetClient } from "../client-interface.js";
|
|
18
|
+
export declare function registerOnboardingTools(server: McpServer, client: IFrihetClient): void;
|
|
19
|
+
//# sourceMappingURL=onboarding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../src/tools/onboarding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAY5D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAyDtF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Onboarding tools for the Frihet MCP server — D4-B megasprint (2 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. onboarding_status — current workspace onboarding state (completed/pending steps)
|
|
6
|
+
* 2. onboarding_persona_set — set workspace persona (autonomo/empresa/agencia/gestoria)
|
|
7
|
+
*
|
|
8
|
+
* REST surface: /v1/onboarding/status, /v1/onboarding/persona
|
|
9
|
+
*
|
|
10
|
+
* Persona drives module visibility + default chart-of-accounts + onboarding checklist.
|
|
11
|
+
* Persona can only be set once during onboarding; later changes require workspace admin.
|
|
12
|
+
*
|
|
13
|
+
* NOTE: ERP backend endpoints land in parallel D4-A wave. 404s propagate as isError
|
|
14
|
+
* until backend ships.
|
|
15
|
+
*/
|
|
16
|
+
import { z } from "zod/v4";
|
|
17
|
+
import { withToolLogging, formatRecord, getContent, mutateContent, READ_ONLY_ANNOTATIONS, UPDATE_ANNOTATIONS, onboardingStatusOutput, onboardingPersonaResultOutput, } from "./shared.js";
|
|
18
|
+
export function registerOnboardingTools(server, client) {
|
|
19
|
+
// -- onboarding_status --
|
|
20
|
+
server.registerTool("onboarding_status", {
|
|
21
|
+
title: "Onboarding Status",
|
|
22
|
+
description: "Return the current workspace onboarding state — persona, completed steps, pending steps, " +
|
|
23
|
+
"percent complete. Useful to drive in-app guidance, sales follow-up triggers, " +
|
|
24
|
+
"and partner program tracking. " +
|
|
25
|
+
"/ Devuelve el estado actual del onboarding del workspace (persona, pasos completados/pendientes).",
|
|
26
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
27
|
+
inputSchema: {},
|
|
28
|
+
outputSchema: onboardingStatusOutput,
|
|
29
|
+
}, async () => withToolLogging("onboarding_status", async () => {
|
|
30
|
+
const result = await client.getOnboardingStatus();
|
|
31
|
+
return {
|
|
32
|
+
content: [getContent(formatRecord("Onboarding status", result))],
|
|
33
|
+
structuredContent: result,
|
|
34
|
+
};
|
|
35
|
+
}));
|
|
36
|
+
// -- onboarding_persona_set --
|
|
37
|
+
server.registerTool("onboarding_persona_set", {
|
|
38
|
+
title: "Set Onboarding Persona",
|
|
39
|
+
description: "Set the workspace persona. Drives module visibility, default chart-of-accounts, " +
|
|
40
|
+
"and onboarding checklist. Personas:\n" +
|
|
41
|
+
" - 'autonomo' — self-employed (autonomo Spain)\n" +
|
|
42
|
+
" - 'empresa' — small/medium business\n" +
|
|
43
|
+
" - 'agencia' — agency / consultancy\n" +
|
|
44
|
+
" - 'gestoria' — accounting firm (manages multiple client workspaces)\n" +
|
|
45
|
+
"\n" +
|
|
46
|
+
"Idempotent: setting the same persona again is a no-op. " +
|
|
47
|
+
"/ Define la persona del workspace. Determina modulos visibles, plan contable y checklist.",
|
|
48
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
49
|
+
inputSchema: {
|
|
50
|
+
persona: z
|
|
51
|
+
.enum(["autonomo", "empresa", "agencia", "gestoria"])
|
|
52
|
+
.describe("Workspace persona / Persona del workspace"),
|
|
53
|
+
},
|
|
54
|
+
outputSchema: onboardingPersonaResultOutput,
|
|
55
|
+
}, async ({ persona }) => withToolLogging("onboarding_persona_set", async () => {
|
|
56
|
+
const result = await client.setOnboardingPersona({ persona });
|
|
57
|
+
return {
|
|
58
|
+
content: [mutateContent(formatRecord("Persona set", result))],
|
|
59
|
+
structuredContent: result,
|
|
60
|
+
};
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=onboarding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../../src/tools/onboarding.ts"],"names":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SACzD;QACD,YAAY,EAAE,6BAA6B;KAC5C,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,eAAe,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;QAC1E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9D,OAAO;YACL,OAAO,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;YAC7D,iBAAiB,EAAE,MAA4C;SAChE,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payroll preparation tools for the Frihet MCP server — D4-B megasprint (2 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. payroll_export — export payroll for a month in gestoria format (A3, Contasol, Sage, Holded, Siltra)
|
|
6
|
+
* 2. payroll_checklist — list employees with status (ready / missing_data / blocked) for a month
|
|
7
|
+
*
|
|
8
|
+
* REST surface: /v1/payroll/prep/export, /v1/payroll/prep/employees
|
|
9
|
+
*
|
|
10
|
+
* Frihet does NOT process payroll. It exports to gestoria-compatible formats so
|
|
11
|
+
* the asesoria handles SS/IRPF/contracts. Output formats track the most common
|
|
12
|
+
* Spanish payroll software clusters.
|
|
13
|
+
*
|
|
14
|
+
* NOTE: ERP backend endpoints land in parallel D4-A wave. 404s propagate as isError
|
|
15
|
+
* until backend ships. TODO: confirm A3 columns + SILTRA file extension.
|
|
16
|
+
*/
|
|
17
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
18
|
+
import type { IFrihetClient } from "../client-interface.js";
|
|
19
|
+
export declare function registerPayrollTools(server: McpServer, client: IFrihetClient): void;
|
|
20
|
+
//# sourceMappingURL=payroll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payroll.d.ts","sourceRoot":"","sources":["../../src/tools/payroll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAkEnF"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payroll preparation tools for the Frihet MCP server — D4-B megasprint (2 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. payroll_export — export payroll for a month in gestoria format (A3, Contasol, Sage, Holded, Siltra)
|
|
6
|
+
* 2. payroll_checklist — list employees with status (ready / missing_data / blocked) for a month
|
|
7
|
+
*
|
|
8
|
+
* REST surface: /v1/payroll/prep/export, /v1/payroll/prep/employees
|
|
9
|
+
*
|
|
10
|
+
* Frihet does NOT process payroll. It exports to gestoria-compatible formats so
|
|
11
|
+
* the asesoria handles SS/IRPF/contracts. Output formats track the most common
|
|
12
|
+
* Spanish payroll software clusters.
|
|
13
|
+
*
|
|
14
|
+
* NOTE: ERP backend endpoints land in parallel D4-A wave. 404s propagate as isError
|
|
15
|
+
* until backend ships. TODO: confirm A3 columns + SILTRA file extension.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from "zod/v4";
|
|
18
|
+
import { withToolLogging, formatRecord, getContent, READ_ONLY_ANNOTATIONS, payrollExportOutput, payrollChecklistOutput, } from "./shared.js";
|
|
19
|
+
export function registerPayrollTools(server, client) {
|
|
20
|
+
// -- payroll_export --
|
|
21
|
+
server.registerTool("payroll_export", {
|
|
22
|
+
title: "Export Payroll (Gestoria Format)",
|
|
23
|
+
description: "Export payroll data for a month in gestoria-compatible format. " +
|
|
24
|
+
"Supported formats:\n" +
|
|
25
|
+
" - 'a3' — Wolters Kluwer A3 (CSV with Spanish payroll columns)\n" +
|
|
26
|
+
" - 'contasol' — Sage Contasol\n" +
|
|
27
|
+
" - 'sage' — Sage 50/200\n" +
|
|
28
|
+
" - 'holded' — Holded import format\n" +
|
|
29
|
+
" - 'siltra' — SILTRA Seguridad Social XML\n" +
|
|
30
|
+
"\n" +
|
|
31
|
+
"Frihet does NOT calculate payroll — it exports staged data for the gestoria. " +
|
|
32
|
+
"Month format: 'YYYY-MM'. " +
|
|
33
|
+
"/ Exporta datos de nominas en formato compatible con gestoria. Mes en formato 'YYYY-MM'.",
|
|
34
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
35
|
+
inputSchema: {
|
|
36
|
+
format: z
|
|
37
|
+
.enum(["a3", "contasol", "sage", "holded", "siltra"])
|
|
38
|
+
.describe("Gestoria payroll software format / Formato del software de gestoria"),
|
|
39
|
+
month: z.string().regex(/^\d{4}-\d{2}$/).describe("Month in 'YYYY-MM' format / Mes formato 'YYYY-MM'"),
|
|
40
|
+
},
|
|
41
|
+
outputSchema: payrollExportOutput,
|
|
42
|
+
}, async ({ format, month }) => withToolLogging("payroll_export", async () => {
|
|
43
|
+
const result = await client.exportPayroll({ format, month });
|
|
44
|
+
return {
|
|
45
|
+
content: [getContent(formatRecord("Payroll export", result))],
|
|
46
|
+
structuredContent: result,
|
|
47
|
+
};
|
|
48
|
+
}));
|
|
49
|
+
// -- payroll_checklist --
|
|
50
|
+
server.registerTool("payroll_checklist", {
|
|
51
|
+
title: "Payroll Readiness Checklist",
|
|
52
|
+
description: "List all employees for a given month with their payroll readiness status. " +
|
|
53
|
+
"Status values:\n" +
|
|
54
|
+
" - 'ready' — all required data present, ready to export\n" +
|
|
55
|
+
" - 'missing_data' — some required fields missing (see missingFields[])\n" +
|
|
56
|
+
" - 'blocked' — manually blocked or data inconsistency detected\n" +
|
|
57
|
+
"\n" +
|
|
58
|
+
"Use BEFORE payroll_export to identify gaps. Month format: 'YYYY-MM'. " +
|
|
59
|
+
"/ Lista empleados con estado de preparacion para nomina. Usar antes de payroll_export.",
|
|
60
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
61
|
+
inputSchema: {
|
|
62
|
+
month: z.string().regex(/^\d{4}-\d{2}$/).describe("Month in 'YYYY-MM' format / Mes formato 'YYYY-MM'"),
|
|
63
|
+
},
|
|
64
|
+
outputSchema: payrollChecklistOutput,
|
|
65
|
+
}, async ({ month }) => withToolLogging("payroll_checklist", async () => {
|
|
66
|
+
const result = await client.getPayrollChecklist({ month });
|
|
67
|
+
return {
|
|
68
|
+
content: [getContent(formatRecord("Payroll checklist", result))],
|
|
69
|
+
structuredContent: result,
|
|
70
|
+
};
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=payroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payroll.js","sourceRoot":"","sources":["../../src/tools/payroll.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,MAAqB;IAC3E,uBAAuB;IAEvB,MAAM,CAAC,YAAY,CACjB,gBAAgB,EAChB;QACE,KAAK,EAAE,kCAAkC;QACzC,WAAW,EACT,iEAAiE;YACjE,sBAAsB;YACtB,yEAAyE;YACzE,kCAAkC;YAClC,gCAAgC;YAChC,yCAAyC;YACzC,gDAAgD;YAChD,IAAI;YACJ,+EAA+E;YAC/E,2BAA2B;YAC3B,0FAA0F;QAC5F,WAAW,EAAE,qBAAqB;QAClC,WAAW,EAAE;YACX,MAAM,EAAE,CAAC;iBACN,IAAI,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;iBACpD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E,iBAAiB,EAAE,MAA4C;SAChE,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Permissions tools for the Frihet MCP server — D4-B megasprint (2 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. permissions_matrix — full role/permission matrix for the workspace
|
|
6
|
+
* 2. permissions_me — caller's own role + permissions
|
|
7
|
+
*
|
|
8
|
+
* REST surface: /v1/permissions/matrix, /v1/permissions/me
|
|
9
|
+
*
|
|
10
|
+
* Permissions are derived from role + workspace overrides. Tools are read-only —
|
|
11
|
+
* mutating roles is done via team_invite / team_role_update (existing).
|
|
12
|
+
*
|
|
13
|
+
* NOTE: ERP backend endpoints land in parallel D4-A wave. 404s propagate as isError
|
|
14
|
+
* until backend ships.
|
|
15
|
+
*/
|
|
16
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
|
+
import type { IFrihetClient } from "../client-interface.js";
|
|
18
|
+
export declare function registerPermissionsTools(server: McpServer, client: IFrihetClient): void;
|
|
19
|
+
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/tools/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CA+CvF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Permissions tools for the Frihet MCP server — D4-B megasprint (2 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. permissions_matrix — full role/permission matrix for the workspace
|
|
6
|
+
* 2. permissions_me — caller's own role + permissions
|
|
7
|
+
*
|
|
8
|
+
* REST surface: /v1/permissions/matrix, /v1/permissions/me
|
|
9
|
+
*
|
|
10
|
+
* Permissions are derived from role + workspace overrides. Tools are read-only —
|
|
11
|
+
* mutating roles is done via team_invite / team_role_update (existing).
|
|
12
|
+
*
|
|
13
|
+
* NOTE: ERP backend endpoints land in parallel D4-A wave. 404s propagate as isError
|
|
14
|
+
* until backend ships.
|
|
15
|
+
*/
|
|
16
|
+
import { withToolLogging, formatRecord, getContent, READ_ONLY_ANNOTATIONS, permissionsMatrixOutput, permissionsMeOutput, } from "./shared.js";
|
|
17
|
+
export function registerPermissionsTools(server, client) {
|
|
18
|
+
// -- permissions_matrix --
|
|
19
|
+
server.registerTool("permissions_matrix", {
|
|
20
|
+
title: "Permissions Matrix",
|
|
21
|
+
description: "Return the full role-to-permission matrix for the workspace. " +
|
|
22
|
+
"Lists every role with the permissions it grants and every protected resource. " +
|
|
23
|
+
"Useful for security audits, role design, and compliance reporting. " +
|
|
24
|
+
"/ Devuelve la matriz completa de roles y permisos del workspace.",
|
|
25
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
26
|
+
inputSchema: {},
|
|
27
|
+
outputSchema: permissionsMatrixOutput,
|
|
28
|
+
}, async () => withToolLogging("permissions_matrix", async () => {
|
|
29
|
+
const result = await client.getPermissionsMatrix();
|
|
30
|
+
return {
|
|
31
|
+
content: [getContent(formatRecord("Permissions matrix", result))],
|
|
32
|
+
structuredContent: result,
|
|
33
|
+
};
|
|
34
|
+
}));
|
|
35
|
+
// -- permissions_me --
|
|
36
|
+
server.registerTool("permissions_me", {
|
|
37
|
+
title: "My Permissions",
|
|
38
|
+
description: "Return the caller's effective role + permissions in the current workspace. " +
|
|
39
|
+
"Useful for client-side UI gating, debugging access errors, and capability discovery. " +
|
|
40
|
+
"/ Devuelve el rol efectivo y los permisos del llamante en el workspace actual.",
|
|
41
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
42
|
+
inputSchema: {},
|
|
43
|
+
outputSchema: permissionsMeOutput,
|
|
44
|
+
}, async () => withToolLogging("permissions_me", async () => {
|
|
45
|
+
const result = await client.getMyPermissions();
|
|
46
|
+
return {
|
|
47
|
+
content: [getContent(formatRecord("My permissions", result))],
|
|
48
|
+
structuredContent: result,
|
|
49
|
+
};
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../src/tools/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,MAAqB;IAC/E,2BAA2B;IAE3B,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,+DAA+D;YAC/D,gFAAgF;YAChF,qEAAqE;YACrE,kEAAkE;QACpE,WAAW,EAAE,qBAAqB;QAClC,WAAW,EAAE,EAAE;QACf,YAAY,EAAE,uBAAuB;KACtC,EACD,KAAK,IAAI,EAAE,CAAC,eAAe,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;QAC3D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACnD,OAAO;YACL,OAAO,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAAC;YACjE,iBAAiB,EAAE,MAA4C;SAChE,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IAEF,uBAAuB;IAEvB,MAAM,CAAC,YAAY,CACjB,gBAAgB,EAChB;QACE,KAAK,EAAE,gBAAgB;QACvB,W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