@frihet/mcp-server 1.7.0-beta.1 → 1.12.0-beta.1
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 +262 -12
- package/dist/__tests__/banking-tools.test.d.ts +18 -0
- package/dist/__tests__/banking-tools.test.d.ts.map +1 -0
- package/dist/__tests__/banking-tools.test.js +252 -0
- package/dist/__tests__/banking-tools.test.js.map +1 -0
- 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 +21 -0
- package/dist/__tests__/fiscal-tools.test.d.ts.map +1 -0
- package/dist/__tests__/fiscal-tools.test.js +215 -0
- package/dist/__tests__/fiscal-tools.test.js.map +1 -0
- package/dist/__tests__/pos-tools.test.d.ts +16 -0
- package/dist/__tests__/pos-tools.test.d.ts.map +1 -0
- package/dist/__tests__/pos-tools.test.js +244 -0
- package/dist/__tests__/pos-tools.test.js.map +1 -0
- package/dist/__tests__/recurring-tools.test.d.ts +23 -0
- package/dist/__tests__/recurring-tools.test.d.ts.map +1 -0
- package/dist/__tests__/recurring-tools.test.js +352 -0
- package/dist/__tests__/recurring-tools.test.js.map +1 -0
- package/dist/__tests__/stay-tools.test.d.ts +17 -0
- package/dist/__tests__/stay-tools.test.d.ts.map +1 -0
- package/dist/__tests__/stay-tools.test.js +259 -0
- package/dist/__tests__/stay-tools.test.js.map +1 -0
- 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 +19 -0
- package/dist/__tests__/time-tools.test.d.ts.map +1 -0
- package/dist/__tests__/time-tools.test.js +286 -0
- package/dist/__tests__/time-tools.test.js.map +1 -0
- package/dist/client-interface.d.ts +325 -0
- package/dist/client-interface.d.ts.map +1 -1
- package/dist/client.d.ts +325 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +404 -0
- package/dist/client.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.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/banking.d.ts +19 -0
- package/dist/tools/banking.d.ts.map +1 -0
- package/dist/tools/banking.js +155 -0
- package/dist/tools/banking.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 +23 -0
- package/dist/tools/fiscal.d.ts.map +1 -0
- package/dist/tools/fiscal.js +197 -0
- package/dist/tools/fiscal.js.map +1 -0
- 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/pos.d.ts +15 -0
- package/dist/tools/pos.d.ts.map +1 -0
- package/dist/tools/pos.js +156 -0
- package/dist/tools/pos.js.map +1 -0
- package/dist/tools/recurring.d.ts +21 -0
- package/dist/tools/recurring.d.ts.map +1 -0
- package/dist/tools/recurring.js +239 -0
- package/dist/tools/recurring.js.map +1 -0
- 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 +53 -3
- package/dist/tools/register-all.js.map +1 -1
- package/dist/tools/shared.d.ts +481 -0
- package/dist/tools/shared.d.ts.map +1 -1
- package/dist/tools/shared.js +396 -0
- package/dist/tools/shared.js.map +1 -1
- package/dist/tools/stay.d.ts +6 -78
- package/dist/tools/stay.d.ts.map +1 -1
- package/dist/tools/stay.js +121 -343
- package/dist/tools/stay.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 +19 -0
- package/dist/tools/time.d.ts.map +1 -0
- package/dist/tools/time.js +179 -0
- package/dist/tools/time.js.map +1 -0
- 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
package/dist/tools/hr.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HR (Human Resources) tools for the Frihet MCP server — D4-B megasprint (9 tools).
|
|
3
|
+
*
|
|
4
|
+
* Tools:
|
|
5
|
+
* 1. leave_request_create — create a leave/PTO request
|
|
6
|
+
* 2. leave_approve — approve a pending leave (logs decision)
|
|
7
|
+
* 3. leave_reject — reject a pending leave with reason
|
|
8
|
+
* 4. leave_cancel — cancel own leave request
|
|
9
|
+
* 5. leave_list — list leaves (filter: employee, status, period)
|
|
10
|
+
* 6. attendance_clock_in — clock in with optional mood + location
|
|
11
|
+
* 7. attendance_clock_out — close an open time entry
|
|
12
|
+
* 8. overtime_report — aggregated overtime by period
|
|
13
|
+
* 9. anomaly_list — list HR/operational anomalies
|
|
14
|
+
*
|
|
15
|
+
* REST surface: /v1/leaves, /v1/time-entries, /v1/anomalies
|
|
16
|
+
*
|
|
17
|
+
* NOTE: ERP backend endpoints land in parallel D4-A wave. Tools wired —
|
|
18
|
+
* 404s propagate as isError until backend ships. TODO: wire to CF
|
|
19
|
+
* logLeaveDecision callable when REST shell lands.
|
|
20
|
+
*/
|
|
21
|
+
import { z } from "zod/v4";
|
|
22
|
+
import { withToolLogging, formatPaginatedResponse, formatRecord, listContent, getContent, mutateContent, READ_ONLY_ANNOTATIONS, CREATE_ANNOTATIONS, UPDATE_ANNOTATIONS, paginatedOutput, leaveRequestItemOutput, attendanceEntryItemOutput, overtimeReportOutput, anomalyItemOutput, } from "./shared.js";
|
|
23
|
+
export function registerHrTools(server, client) {
|
|
24
|
+
// -- leave_request_create --
|
|
25
|
+
server.registerTool("leave_request_create", {
|
|
26
|
+
title: "Create Leave Request",
|
|
27
|
+
description: "Create a new leave/PTO request for an employee. " +
|
|
28
|
+
"Types: 'vacation', 'sick', 'personal', 'parental', 'unpaid', 'training'. " +
|
|
29
|
+
"Dates must be ISO 8601 (YYYY-MM-DD). Status starts as 'pending' awaiting manager approval. " +
|
|
30
|
+
"/ Crea una nueva solicitud de vacaciones/permiso. Estado inicial 'pending' pendiente aprobacion.",
|
|
31
|
+
annotations: CREATE_ANNOTATIONS,
|
|
32
|
+
inputSchema: {
|
|
33
|
+
employeeId: z.string().describe("Employee ID / ID del empleado"),
|
|
34
|
+
type: z.string().describe("Leave type slug (vacation, sick, personal, parental, unpaid, training) / Tipo de permiso"),
|
|
35
|
+
startDate: z.string().describe("Start date ISO 8601 (YYYY-MM-DD) / Fecha inicio"),
|
|
36
|
+
endDate: z.string().describe("End date ISO 8601 (YYYY-MM-DD) / Fecha fin"),
|
|
37
|
+
reason: z.string().optional().describe("Optional reason / Motivo opcional"),
|
|
38
|
+
},
|
|
39
|
+
outputSchema: leaveRequestItemOutput,
|
|
40
|
+
}, async (input) => withToolLogging("leave_request_create", async () => {
|
|
41
|
+
const result = await client.createLeaveRequest(input);
|
|
42
|
+
return {
|
|
43
|
+
content: [mutateContent(formatRecord("Leave request created", result))],
|
|
44
|
+
structuredContent: result,
|
|
45
|
+
};
|
|
46
|
+
}));
|
|
47
|
+
// -- leave_approve --
|
|
48
|
+
server.registerTool("leave_approve", {
|
|
49
|
+
title: "Approve Leave Request",
|
|
50
|
+
description: "TRUST AREA — HR DECISION. Approve a pending leave request. Logs decision with timestamp and approver. " +
|
|
51
|
+
"Idempotent: re-approving an already approved leave is a no-op. " +
|
|
52
|
+
"/ AREA DE CONFIANZA — DECISION RRHH. Aprueba una solicitud de permiso pendiente. Registra la decision.",
|
|
53
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
54
|
+
inputSchema: {
|
|
55
|
+
leaveId: z.string().describe("Leave request ID / ID de la solicitud"),
|
|
56
|
+
reason: z.string().optional().describe("Optional approval note / Nota de aprobacion opcional"),
|
|
57
|
+
},
|
|
58
|
+
outputSchema: leaveRequestItemOutput,
|
|
59
|
+
}, async ({ leaveId, reason }) => withToolLogging("leave_approve", async () => {
|
|
60
|
+
const result = await client.approveLeave(leaveId, { reason });
|
|
61
|
+
return {
|
|
62
|
+
content: [mutateContent(formatRecord("Leave approved", result))],
|
|
63
|
+
structuredContent: result,
|
|
64
|
+
};
|
|
65
|
+
}));
|
|
66
|
+
// -- leave_reject --
|
|
67
|
+
server.registerTool("leave_reject", {
|
|
68
|
+
title: "Reject Leave Request",
|
|
69
|
+
description: "TRUST AREA — HR DECISION. Reject a pending leave request with a required reason. " +
|
|
70
|
+
"Reason is mandatory for transparency and labor-law compliance. " +
|
|
71
|
+
"/ AREA DE CONFIANZA — DECISION RRHH. Rechaza una solicitud con motivo obligatorio.",
|
|
72
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
73
|
+
inputSchema: {
|
|
74
|
+
leaveId: z.string().describe("Leave request ID / ID de la solicitud"),
|
|
75
|
+
reason: z.string().min(1).describe("Required rejection reason / Motivo obligatorio de rechazo"),
|
|
76
|
+
},
|
|
77
|
+
outputSchema: leaveRequestItemOutput,
|
|
78
|
+
}, async ({ leaveId, reason }) => withToolLogging("leave_reject", async () => {
|
|
79
|
+
const result = await client.rejectLeave(leaveId, { reason });
|
|
80
|
+
return {
|
|
81
|
+
content: [mutateContent(formatRecord("Leave rejected", result))],
|
|
82
|
+
structuredContent: result,
|
|
83
|
+
};
|
|
84
|
+
}));
|
|
85
|
+
// -- leave_cancel --
|
|
86
|
+
server.registerTool("leave_cancel", {
|
|
87
|
+
title: "Cancel Leave Request",
|
|
88
|
+
description: "Cancel a leave request. Typically used by the requesting employee before approval, " +
|
|
89
|
+
"or by HR after approval (which may trigger schedule rollback). " +
|
|
90
|
+
"/ Cancela una solicitud de permiso (por el empleado o RRHH).",
|
|
91
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
92
|
+
inputSchema: {
|
|
93
|
+
leaveId: z.string().describe("Leave request ID / ID de la solicitud"),
|
|
94
|
+
},
|
|
95
|
+
outputSchema: leaveRequestItemOutput,
|
|
96
|
+
}, async ({ leaveId }) => withToolLogging("leave_cancel", async () => {
|
|
97
|
+
const result = await client.cancelLeave(leaveId);
|
|
98
|
+
return {
|
|
99
|
+
content: [mutateContent(formatRecord("Leave cancelled", result))],
|
|
100
|
+
structuredContent: result,
|
|
101
|
+
};
|
|
102
|
+
}));
|
|
103
|
+
// -- leave_list --
|
|
104
|
+
server.registerTool("leave_list", {
|
|
105
|
+
title: "List Leave Requests",
|
|
106
|
+
description: "List leave/PTO requests with optional filters. " +
|
|
107
|
+
"Filter by employee, status (pending/approved/rejected/cancelled), or period (date range). " +
|
|
108
|
+
"Useful for HR dashboards, calendar views, balance tracking. " +
|
|
109
|
+
"/ Lista solicitudes de permisos con filtros opcionales (empleado, estado, periodo).",
|
|
110
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
111
|
+
inputSchema: {
|
|
112
|
+
employeeId: z.string().optional().describe("Filter by employee ID / Filtrar por empleado"),
|
|
113
|
+
status: z
|
|
114
|
+
.enum(["pending", "approved", "rejected", "cancelled"])
|
|
115
|
+
.optional()
|
|
116
|
+
.describe("Filter by status / Filtrar por estado"),
|
|
117
|
+
from: z.string().optional().describe("Period start ISO 8601 (YYYY-MM-DD) / Inicio periodo"),
|
|
118
|
+
to: z.string().optional().describe("Period end ISO 8601 (YYYY-MM-DD) / Fin periodo"),
|
|
119
|
+
limit: z.number().int().min(1).max(100).optional().describe("Max results (1-100) / Resultados maximos"),
|
|
120
|
+
offset: z.number().int().min(0).optional().describe("Offset / Desplazamiento"),
|
|
121
|
+
after: z.string().optional().describe("Cursor for cursor-based pagination / Cursor"),
|
|
122
|
+
},
|
|
123
|
+
outputSchema: paginatedOutput(leaveRequestItemOutput),
|
|
124
|
+
}, async ({ employeeId, status, from, to, limit, offset, after }) => withToolLogging("leave_list", async () => {
|
|
125
|
+
const result = await client.listLeaves({ employeeId, status, from, to, limit, offset, after });
|
|
126
|
+
return {
|
|
127
|
+
content: [listContent(formatPaginatedResponse("leaves", result))],
|
|
128
|
+
structuredContent: result,
|
|
129
|
+
};
|
|
130
|
+
}));
|
|
131
|
+
// -- attendance_clock_in --
|
|
132
|
+
server.registerTool("attendance_clock_in", {
|
|
133
|
+
title: "Clock In (Attendance)",
|
|
134
|
+
description: "Record an employee clock-in. Optionally captures mood (employee well-being tracking) " +
|
|
135
|
+
"and location (remote/office/site). Returns an attendance entry with status='open'. " +
|
|
136
|
+
"Pair with attendance_clock_out to close the entry. " +
|
|
137
|
+
"/ Registra una entrada de fichaje. Captura opcionalmente estado de animo y ubicacion.",
|
|
138
|
+
annotations: CREATE_ANNOTATIONS,
|
|
139
|
+
inputSchema: {
|
|
140
|
+
employeeId: z.string().describe("Employee ID / ID del empleado"),
|
|
141
|
+
mood: z.string().optional().describe("Optional mood slug (e.g. 'great','ok','tired') / Estado de animo"),
|
|
142
|
+
location: z.string().optional().describe("Optional location ('remote','office','site') / Ubicacion"),
|
|
143
|
+
},
|
|
144
|
+
outputSchema: attendanceEntryItemOutput,
|
|
145
|
+
}, async (input) => withToolLogging("attendance_clock_in", async () => {
|
|
146
|
+
const result = await client.attendanceClockIn(input);
|
|
147
|
+
return {
|
|
148
|
+
content: [mutateContent(formatRecord("Clocked in", result))],
|
|
149
|
+
structuredContent: result,
|
|
150
|
+
};
|
|
151
|
+
}));
|
|
152
|
+
// -- attendance_clock_out --
|
|
153
|
+
server.registerTool("attendance_clock_out", {
|
|
154
|
+
title: "Clock Out (Attendance)",
|
|
155
|
+
description: "Close an open attendance entry. Stamps clockOutAt and computes durationMinutes. " +
|
|
156
|
+
"Idempotent: clocking out an already-closed entry is a no-op. " +
|
|
157
|
+
"/ Cierra una entrada de fichaje abierta. Calcula la duracion en minutos.",
|
|
158
|
+
annotations: UPDATE_ANNOTATIONS,
|
|
159
|
+
inputSchema: {
|
|
160
|
+
entryId: z.string().describe("Open attendance entry ID / ID de la entrada abierta"),
|
|
161
|
+
},
|
|
162
|
+
outputSchema: attendanceEntryItemOutput,
|
|
163
|
+
}, async ({ entryId }) => withToolLogging("attendance_clock_out", async () => {
|
|
164
|
+
const result = await client.attendanceClockOut(entryId);
|
|
165
|
+
return {
|
|
166
|
+
content: [mutateContent(formatRecord("Clocked out", result))],
|
|
167
|
+
structuredContent: result,
|
|
168
|
+
};
|
|
169
|
+
}));
|
|
170
|
+
// -- overtime_report --
|
|
171
|
+
server.registerTool("overtime_report", {
|
|
172
|
+
title: "Overtime Report",
|
|
173
|
+
description: "Generate an overtime report for a period. Aggregates regular vs overtime hours " +
|
|
174
|
+
"per employee + total estimated cost in EUR. Useful for payroll prep and labor-law audits. " +
|
|
175
|
+
"Period format: 'YYYY-MM' (monthly) or 'YYYY-QN' (quarterly) or 'YYYY' (annual). " +
|
|
176
|
+
"/ Informe de horas extra por periodo. Agrega horas regulares vs extra por empleado + coste estimado.",
|
|
177
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
178
|
+
inputSchema: {
|
|
179
|
+
period: z.string().describe("Period (YYYY-MM, YYYY-QN, or YYYY) / Periodo"),
|
|
180
|
+
employeeId: z.string().optional().describe("Optional filter by employee / Filtrar por empleado opcional"),
|
|
181
|
+
},
|
|
182
|
+
outputSchema: overtimeReportOutput,
|
|
183
|
+
}, async ({ period, employeeId }) => withToolLogging("overtime_report", async () => {
|
|
184
|
+
const result = await client.getOvertimeReport({ period, employeeId });
|
|
185
|
+
return {
|
|
186
|
+
content: [getContent(formatRecord("Overtime report", result))],
|
|
187
|
+
structuredContent: result,
|
|
188
|
+
};
|
|
189
|
+
}));
|
|
190
|
+
// -- anomaly_list --
|
|
191
|
+
server.registerTool("anomaly_list", {
|
|
192
|
+
title: "List Anomalies",
|
|
193
|
+
description: "List HR / operational / financial anomalies detected by the system. " +
|
|
194
|
+
"Filter by type (duplicate_clock_in, overtime_spike, missing_clock_out, expense_outlier, etc.), " +
|
|
195
|
+
"severity (low/medium/high/critical), or period. " +
|
|
196
|
+
"Useful for daily HR review and compliance audits. " +
|
|
197
|
+
"/ Lista anomalias detectadas (RRHH/operativas/financieras) con filtros opcionales.",
|
|
198
|
+
annotations: READ_ONLY_ANNOTATIONS,
|
|
199
|
+
inputSchema: {
|
|
200
|
+
type: z.string().optional().describe("Filter by anomaly type slug / Tipo"),
|
|
201
|
+
severity: z
|
|
202
|
+
.enum(["low", "medium", "high", "critical"])
|
|
203
|
+
.optional()
|
|
204
|
+
.describe("Filter by severity / Severidad"),
|
|
205
|
+
from: z.string().optional().describe("Period start ISO 8601 / Inicio"),
|
|
206
|
+
to: z.string().optional().describe("Period end ISO 8601 / Fin"),
|
|
207
|
+
limit: z.number().int().min(1).max(100).optional().describe("Max results / Maximos"),
|
|
208
|
+
offset: z.number().int().min(0).optional().describe("Offset / Desplazamiento"),
|
|
209
|
+
},
|
|
210
|
+
outputSchema: paginatedOutput(anomalyItemOutput),
|
|
211
|
+
}, async ({ type, severity, from, to, limit, offset }) => withToolLogging("anomaly_list", async () => {
|
|
212
|
+
const result = await client.listAnomalies({ type, severity, from, to, limit, offset });
|
|
213
|
+
return {
|
|
214
|
+
content: [listContent(formatPaginatedResponse("anomalies", result))],
|
|
215
|
+
structuredContent: result,
|
|
216
|
+
};
|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E,EAAE,CACpD,eAAe,CAAC,cAAc,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QACvF,OAAO;YACL,OAAO,EAAE,CAAC,WAAW,CAAC,uBAAuB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;YACpE,iBAAiB,EAAE,MAA4C;SAChE,CAAC;IACJ,CAAC,CAAC,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -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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ACzI;KACF,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,eAAe,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QAC7F,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;QAC3E,OAAO;YACL,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+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C1D,OAAO;YACL,OAAO,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;YACzD,iBAAiB,EAAE,MAA4C;SAChE,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 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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AW,EAAE,qBAAqB;QAClC,WAAW,EAAE;YACX,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2GAA2G,CAAC;YAC3I,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qGAAqG,CAAC;SAClJ;KACF,EACD,KAAK,EAAE,EAAE,SAAS,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"}
|