@hasna/microservices 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +70 -0
- package/bin/mcp.js +71 -1
- package/dist/index.js +70 -0
- package/microservices/microservice-ads/package.json +27 -0
- package/microservices/microservice-ads/src/cli/index.ts +407 -0
- package/microservices/microservice-ads/src/db/campaigns.ts +493 -0
- package/microservices/microservice-ads/src/db/database.ts +93 -0
- package/microservices/microservice-ads/src/db/migrations.ts +60 -0
- package/microservices/microservice-ads/src/index.ts +39 -0
- package/microservices/microservice-ads/src/mcp/index.ts +320 -0
- package/microservices/microservice-contracts/package.json +27 -0
- package/microservices/microservice-contracts/src/cli/index.ts +383 -0
- package/microservices/microservice-contracts/src/db/contracts.ts +496 -0
- package/microservices/microservice-contracts/src/db/database.ts +93 -0
- package/microservices/microservice-contracts/src/db/migrations.ts +58 -0
- package/microservices/microservice-contracts/src/index.ts +43 -0
- package/microservices/microservice-contracts/src/mcp/index.ts +308 -0
- package/microservices/microservice-domains/package.json +27 -0
- package/microservices/microservice-domains/src/cli/index.ts +438 -0
- package/microservices/microservice-domains/src/db/database.ts +93 -0
- package/microservices/microservice-domains/src/db/domains.ts +551 -0
- package/microservices/microservice-domains/src/db/migrations.ts +60 -0
- package/microservices/microservice-domains/src/index.ts +44 -0
- package/microservices/microservice-domains/src/mcp/index.ts +368 -0
- package/microservices/microservice-hiring/package.json +27 -0
- package/microservices/microservice-hiring/src/cli/index.ts +431 -0
- package/microservices/microservice-hiring/src/db/database.ts +93 -0
- package/microservices/microservice-hiring/src/db/hiring.ts +582 -0
- package/microservices/microservice-hiring/src/db/migrations.ts +68 -0
- package/microservices/microservice-hiring/src/index.ts +51 -0
- package/microservices/microservice-hiring/src/mcp/index.ts +464 -0
- package/microservices/microservice-payments/package.json +27 -0
- package/microservices/microservice-payments/src/cli/index.ts +357 -0
- package/microservices/microservice-payments/src/db/database.ts +93 -0
- package/microservices/microservice-payments/src/db/migrations.ts +63 -0
- package/microservices/microservice-payments/src/db/payments.ts +652 -0
- package/microservices/microservice-payments/src/index.ts +51 -0
- package/microservices/microservice-payments/src/mcp/index.ts +460 -0
- package/microservices/microservice-payroll/package.json +27 -0
- package/microservices/microservice-payroll/src/cli/index.ts +374 -0
- package/microservices/microservice-payroll/src/db/database.ts +93 -0
- package/microservices/microservice-payroll/src/db/migrations.ts +69 -0
- package/microservices/microservice-payroll/src/db/payroll.ts +741 -0
- package/microservices/microservice-payroll/src/index.ts +48 -0
- package/microservices/microservice-payroll/src/mcp/index.ts +420 -0
- package/microservices/microservice-shipping/package.json +27 -0
- package/microservices/microservice-shipping/src/cli/index.ts +398 -0
- package/microservices/microservice-shipping/src/db/database.ts +93 -0
- package/microservices/microservice-shipping/src/db/migrations.ts +61 -0
- package/microservices/microservice-shipping/src/db/shipping.ts +643 -0
- package/microservices/microservice-shipping/src/index.ts +53 -0
- package/microservices/microservice-shipping/src/mcp/index.ts +385 -0
- package/microservices/microservice-social/package.json +27 -0
- package/microservices/microservice-social/src/cli/index.ts +447 -0
- package/microservices/microservice-social/src/db/database.ts +93 -0
- package/microservices/microservice-social/src/db/migrations.ts +55 -0
- package/microservices/microservice-social/src/db/social.ts +672 -0
- package/microservices/microservice-social/src/index.ts +46 -0
- package/microservices/microservice-social/src/mcp/index.ts +435 -0
- package/microservices/microservice-subscriptions/package.json +27 -0
- package/microservices/microservice-subscriptions/src/cli/index.ts +400 -0
- package/microservices/microservice-subscriptions/src/db/database.ts +93 -0
- package/microservices/microservice-subscriptions/src/db/migrations.ts +57 -0
- package/microservices/microservice-subscriptions/src/db/subscriptions.ts +692 -0
- package/microservices/microservice-subscriptions/src/index.ts +41 -0
- package/microservices/microservice-subscriptions/src/mcp/index.ts +365 -0
- package/microservices/microservice-transcriber/package.json +28 -0
- package/microservices/microservice-transcriber/src/cli/index.ts +1347 -0
- package/microservices/microservice-transcriber/src/db/annotations.ts +37 -0
- package/microservices/microservice-transcriber/src/db/database.ts +82 -0
- package/microservices/microservice-transcriber/src/db/migrations.ts +72 -0
- package/microservices/microservice-transcriber/src/db/transcripts.ts +395 -0
- package/microservices/microservice-transcriber/src/index.ts +43 -0
- package/microservices/microservice-transcriber/src/lib/config.ts +77 -0
- package/microservices/microservice-transcriber/src/lib/diff.ts +91 -0
- package/microservices/microservice-transcriber/src/lib/downloader.ts +570 -0
- package/microservices/microservice-transcriber/src/lib/feeds.ts +62 -0
- package/microservices/microservice-transcriber/src/lib/live.ts +94 -0
- package/microservices/microservice-transcriber/src/lib/notion.ts +129 -0
- package/microservices/microservice-transcriber/src/lib/providers.ts +713 -0
- package/microservices/microservice-transcriber/src/lib/summarizer.ts +147 -0
- package/microservices/microservice-transcriber/src/lib/translator.ts +75 -0
- package/microservices/microservice-transcriber/src/lib/webhook.ts +37 -0
- package/microservices/microservice-transcriber/src/mcp/index.ts +1070 -0
- package/microservices/microservice-transcriber/src/server/index.ts +199 -0
- package/package.json +1 -1
- package/microservices/microservice-invoices/dashboard/dist/assets/index-Bngq7FNM.css +0 -1
- package/microservices/microservice-invoices/dashboard/dist/assets/index-aHW4ARZR.js +0 -124
- package/microservices/microservice-invoices/dashboard/dist/index.html +0 -13
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* microservice-payroll — Payroll management microservice
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
createEmployee,
|
|
7
|
+
getEmployee,
|
|
8
|
+
listEmployees,
|
|
9
|
+
updateEmployee,
|
|
10
|
+
deleteEmployee,
|
|
11
|
+
terminateEmployee,
|
|
12
|
+
countEmployees,
|
|
13
|
+
type Employee,
|
|
14
|
+
type CreateEmployeeInput,
|
|
15
|
+
type UpdateEmployeeInput,
|
|
16
|
+
type ListEmployeesOptions,
|
|
17
|
+
createPayPeriod,
|
|
18
|
+
getPayPeriod,
|
|
19
|
+
listPayPeriods,
|
|
20
|
+
updatePayPeriodStatus,
|
|
21
|
+
deletePayPeriod,
|
|
22
|
+
type PayPeriod,
|
|
23
|
+
type CreatePayPeriodInput,
|
|
24
|
+
createPayStub,
|
|
25
|
+
getPayStub,
|
|
26
|
+
listPayStubs,
|
|
27
|
+
deletePayStub,
|
|
28
|
+
type PayStub,
|
|
29
|
+
type CreatePayStubInput,
|
|
30
|
+
createPayment,
|
|
31
|
+
getPayment,
|
|
32
|
+
listPayments,
|
|
33
|
+
updatePaymentStatus,
|
|
34
|
+
deletePayment,
|
|
35
|
+
type Payment,
|
|
36
|
+
type CreatePaymentInput,
|
|
37
|
+
calculateDeductions,
|
|
38
|
+
calculateGrossPay,
|
|
39
|
+
processPayroll,
|
|
40
|
+
getPayrollReport,
|
|
41
|
+
getYtdReport,
|
|
42
|
+
getTaxSummary,
|
|
43
|
+
type PayrollReport,
|
|
44
|
+
type YtdReport,
|
|
45
|
+
type TaxSummaryEntry,
|
|
46
|
+
} from "./db/payroll.js";
|
|
47
|
+
|
|
48
|
+
export { getDatabase, closeDatabase } from "./db/database.js";
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import {
|
|
7
|
+
createEmployee,
|
|
8
|
+
getEmployee,
|
|
9
|
+
listEmployees,
|
|
10
|
+
updateEmployee,
|
|
11
|
+
terminateEmployee,
|
|
12
|
+
createPayPeriod,
|
|
13
|
+
getPayPeriod,
|
|
14
|
+
listPayPeriods,
|
|
15
|
+
updatePayPeriodStatus,
|
|
16
|
+
processPayroll,
|
|
17
|
+
listPayStubs,
|
|
18
|
+
getPayStub,
|
|
19
|
+
createPayment,
|
|
20
|
+
getPayment,
|
|
21
|
+
listPayments,
|
|
22
|
+
updatePaymentStatus,
|
|
23
|
+
getPayrollReport,
|
|
24
|
+
getYtdReport,
|
|
25
|
+
getTaxSummary,
|
|
26
|
+
} from "../db/payroll.js";
|
|
27
|
+
|
|
28
|
+
const server = new McpServer({
|
|
29
|
+
name: "microservice-payroll",
|
|
30
|
+
version: "0.0.1",
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// --- Employees ---
|
|
34
|
+
|
|
35
|
+
server.registerTool(
|
|
36
|
+
"create_employee",
|
|
37
|
+
{
|
|
38
|
+
title: "Create Employee",
|
|
39
|
+
description: "Create a new employee.",
|
|
40
|
+
inputSchema: {
|
|
41
|
+
name: z.string(),
|
|
42
|
+
email: z.string().optional(),
|
|
43
|
+
type: z.enum(["employee", "contractor"]).optional(),
|
|
44
|
+
department: z.string().optional(),
|
|
45
|
+
title: z.string().optional(),
|
|
46
|
+
pay_rate: z.number(),
|
|
47
|
+
pay_type: z.enum(["salary", "hourly"]).optional(),
|
|
48
|
+
currency: z.string().optional(),
|
|
49
|
+
tax_info: z.record(z.unknown()).optional(),
|
|
50
|
+
start_date: z.string().optional(),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
async (params) => {
|
|
54
|
+
const employee = createEmployee(params);
|
|
55
|
+
return { content: [{ type: "text", text: JSON.stringify(employee, null, 2) }] };
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
server.registerTool(
|
|
60
|
+
"get_employee",
|
|
61
|
+
{
|
|
62
|
+
title: "Get Employee",
|
|
63
|
+
description: "Get an employee by ID.",
|
|
64
|
+
inputSchema: { id: z.string() },
|
|
65
|
+
},
|
|
66
|
+
async ({ id }) => {
|
|
67
|
+
const employee = getEmployee(id);
|
|
68
|
+
if (!employee) {
|
|
69
|
+
return { content: [{ type: "text", text: `Employee '${id}' not found.` }], isError: true };
|
|
70
|
+
}
|
|
71
|
+
return { content: [{ type: "text", text: JSON.stringify(employee, null, 2) }] };
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
server.registerTool(
|
|
76
|
+
"list_employees",
|
|
77
|
+
{
|
|
78
|
+
title: "List Employees",
|
|
79
|
+
description: "List employees with optional filters.",
|
|
80
|
+
inputSchema: {
|
|
81
|
+
search: z.string().optional(),
|
|
82
|
+
status: z.string().optional(),
|
|
83
|
+
department: z.string().optional(),
|
|
84
|
+
type: z.string().optional(),
|
|
85
|
+
limit: z.number().optional(),
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
async (params) => {
|
|
89
|
+
const employees = listEmployees(params);
|
|
90
|
+
return {
|
|
91
|
+
content: [
|
|
92
|
+
{ type: "text", text: JSON.stringify({ employees, count: employees.length }, null, 2) },
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
server.registerTool(
|
|
99
|
+
"update_employee",
|
|
100
|
+
{
|
|
101
|
+
title: "Update Employee",
|
|
102
|
+
description: "Update an existing employee.",
|
|
103
|
+
inputSchema: {
|
|
104
|
+
id: z.string(),
|
|
105
|
+
name: z.string().optional(),
|
|
106
|
+
email: z.string().optional(),
|
|
107
|
+
type: z.enum(["employee", "contractor"]).optional(),
|
|
108
|
+
department: z.string().optional(),
|
|
109
|
+
title: z.string().optional(),
|
|
110
|
+
pay_rate: z.number().optional(),
|
|
111
|
+
pay_type: z.enum(["salary", "hourly"]).optional(),
|
|
112
|
+
currency: z.string().optional(),
|
|
113
|
+
tax_info: z.record(z.unknown()).optional(),
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
async ({ id, ...input }) => {
|
|
117
|
+
const employee = updateEmployee(id, input);
|
|
118
|
+
if (!employee) {
|
|
119
|
+
return { content: [{ type: "text", text: `Employee '${id}' not found.` }], isError: true };
|
|
120
|
+
}
|
|
121
|
+
return { content: [{ type: "text", text: JSON.stringify(employee, null, 2) }] };
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
server.registerTool(
|
|
126
|
+
"terminate_employee",
|
|
127
|
+
{
|
|
128
|
+
title: "Terminate Employee",
|
|
129
|
+
description: "Terminate an employee.",
|
|
130
|
+
inputSchema: {
|
|
131
|
+
id: z.string(),
|
|
132
|
+
end_date: z.string().optional(),
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
async ({ id, end_date }) => {
|
|
136
|
+
const employee = terminateEmployee(id, end_date);
|
|
137
|
+
if (!employee) {
|
|
138
|
+
return { content: [{ type: "text", text: `Employee '${id}' not found.` }], isError: true };
|
|
139
|
+
}
|
|
140
|
+
return { content: [{ type: "text", text: JSON.stringify(employee, null, 2) }] };
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
// --- Pay Periods ---
|
|
145
|
+
|
|
146
|
+
server.registerTool(
|
|
147
|
+
"create_pay_period",
|
|
148
|
+
{
|
|
149
|
+
title: "Create Pay Period",
|
|
150
|
+
description: "Create a new pay period.",
|
|
151
|
+
inputSchema: {
|
|
152
|
+
start_date: z.string(),
|
|
153
|
+
end_date: z.string(),
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
async (params) => {
|
|
157
|
+
const period = createPayPeriod(params);
|
|
158
|
+
return { content: [{ type: "text", text: JSON.stringify(period, null, 2) }] };
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
server.registerTool(
|
|
163
|
+
"get_pay_period",
|
|
164
|
+
{
|
|
165
|
+
title: "Get Pay Period",
|
|
166
|
+
description: "Get a pay period by ID.",
|
|
167
|
+
inputSchema: { id: z.string() },
|
|
168
|
+
},
|
|
169
|
+
async ({ id }) => {
|
|
170
|
+
const period = getPayPeriod(id);
|
|
171
|
+
if (!period) {
|
|
172
|
+
return { content: [{ type: "text", text: `Pay period '${id}' not found.` }], isError: true };
|
|
173
|
+
}
|
|
174
|
+
return { content: [{ type: "text", text: JSON.stringify(period, null, 2) }] };
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
server.registerTool(
|
|
179
|
+
"list_pay_periods",
|
|
180
|
+
{
|
|
181
|
+
title: "List Pay Periods",
|
|
182
|
+
description: "List pay periods with optional status filter.",
|
|
183
|
+
inputSchema: {
|
|
184
|
+
status: z.string().optional(),
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
async ({ status }) => {
|
|
188
|
+
const periods = listPayPeriods(status);
|
|
189
|
+
return {
|
|
190
|
+
content: [
|
|
191
|
+
{ type: "text", text: JSON.stringify({ periods, count: periods.length }, null, 2) },
|
|
192
|
+
],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
server.registerTool(
|
|
198
|
+
"update_pay_period_status",
|
|
199
|
+
{
|
|
200
|
+
title: "Update Pay Period Status",
|
|
201
|
+
description: "Update the status of a pay period.",
|
|
202
|
+
inputSchema: {
|
|
203
|
+
id: z.string(),
|
|
204
|
+
status: z.enum(["draft", "processing", "completed"]),
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
async ({ id, status }) => {
|
|
208
|
+
const period = updatePayPeriodStatus(id, status);
|
|
209
|
+
if (!period) {
|
|
210
|
+
return { content: [{ type: "text", text: `Pay period '${id}' not found.` }], isError: true };
|
|
211
|
+
}
|
|
212
|
+
return { content: [{ type: "text", text: JSON.stringify(period, null, 2) }] };
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
// --- Payroll Processing ---
|
|
217
|
+
|
|
218
|
+
server.registerTool(
|
|
219
|
+
"process_payroll",
|
|
220
|
+
{
|
|
221
|
+
title: "Process Payroll",
|
|
222
|
+
description: "Process payroll for a pay period, auto-generating pay stubs for all active employees.",
|
|
223
|
+
inputSchema: {
|
|
224
|
+
period_id: z.string(),
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
async ({ period_id }) => {
|
|
228
|
+
try {
|
|
229
|
+
const stubs = processPayroll(period_id);
|
|
230
|
+
return {
|
|
231
|
+
content: [
|
|
232
|
+
{ type: "text", text: JSON.stringify({ stubs, count: stubs.length }, null, 2) },
|
|
233
|
+
],
|
|
234
|
+
};
|
|
235
|
+
} catch (error) {
|
|
236
|
+
return {
|
|
237
|
+
content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }],
|
|
238
|
+
isError: true,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
// --- Pay Stubs ---
|
|
245
|
+
|
|
246
|
+
server.registerTool(
|
|
247
|
+
"list_pay_stubs",
|
|
248
|
+
{
|
|
249
|
+
title: "List Pay Stubs",
|
|
250
|
+
description: "List pay stubs with optional filters.",
|
|
251
|
+
inputSchema: {
|
|
252
|
+
employee_id: z.string().optional(),
|
|
253
|
+
pay_period_id: z.string().optional(),
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
async (params) => {
|
|
257
|
+
const stubs = listPayStubs(params);
|
|
258
|
+
return {
|
|
259
|
+
content: [
|
|
260
|
+
{ type: "text", text: JSON.stringify({ stubs, count: stubs.length }, null, 2) },
|
|
261
|
+
],
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
server.registerTool(
|
|
267
|
+
"get_pay_stub",
|
|
268
|
+
{
|
|
269
|
+
title: "Get Pay Stub",
|
|
270
|
+
description: "Get a pay stub by ID.",
|
|
271
|
+
inputSchema: { id: z.string() },
|
|
272
|
+
},
|
|
273
|
+
async ({ id }) => {
|
|
274
|
+
const stub = getPayStub(id);
|
|
275
|
+
if (!stub) {
|
|
276
|
+
return { content: [{ type: "text", text: `Pay stub '${id}' not found.` }], isError: true };
|
|
277
|
+
}
|
|
278
|
+
return { content: [{ type: "text", text: JSON.stringify(stub, null, 2) }] };
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
// --- Payments ---
|
|
283
|
+
|
|
284
|
+
server.registerTool(
|
|
285
|
+
"create_payment",
|
|
286
|
+
{
|
|
287
|
+
title: "Create Payment",
|
|
288
|
+
description: "Create a payment for a pay stub.",
|
|
289
|
+
inputSchema: {
|
|
290
|
+
pay_stub_id: z.string(),
|
|
291
|
+
method: z.enum(["direct_deposit", "check", "wire"]).optional(),
|
|
292
|
+
reference: z.string().optional(),
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
async (params) => {
|
|
296
|
+
const payment = createPayment(params);
|
|
297
|
+
return { content: [{ type: "text", text: JSON.stringify(payment, null, 2) }] };
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
server.registerTool(
|
|
302
|
+
"get_payment",
|
|
303
|
+
{
|
|
304
|
+
title: "Get Payment",
|
|
305
|
+
description: "Get a payment by ID.",
|
|
306
|
+
inputSchema: { id: z.string() },
|
|
307
|
+
},
|
|
308
|
+
async ({ id }) => {
|
|
309
|
+
const payment = getPayment(id);
|
|
310
|
+
if (!payment) {
|
|
311
|
+
return { content: [{ type: "text", text: `Payment '${id}' not found.` }], isError: true };
|
|
312
|
+
}
|
|
313
|
+
return { content: [{ type: "text", text: JSON.stringify(payment, null, 2) }] };
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
server.registerTool(
|
|
318
|
+
"list_payments",
|
|
319
|
+
{
|
|
320
|
+
title: "List Payments",
|
|
321
|
+
description: "List payments with optional filters.",
|
|
322
|
+
inputSchema: {
|
|
323
|
+
pay_stub_id: z.string().optional(),
|
|
324
|
+
status: z.string().optional(),
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
async (params) => {
|
|
328
|
+
const payments = listPayments(params);
|
|
329
|
+
return {
|
|
330
|
+
content: [
|
|
331
|
+
{ type: "text", text: JSON.stringify({ payments, count: payments.length }, null, 2) },
|
|
332
|
+
],
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
server.registerTool(
|
|
338
|
+
"update_payment_status",
|
|
339
|
+
{
|
|
340
|
+
title: "Update Payment Status",
|
|
341
|
+
description: "Update the status of a payment.",
|
|
342
|
+
inputSchema: {
|
|
343
|
+
id: z.string(),
|
|
344
|
+
status: z.enum(["pending", "paid", "failed"]),
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
async ({ id, status }) => {
|
|
348
|
+
const payment = updatePaymentStatus(id, status);
|
|
349
|
+
if (!payment) {
|
|
350
|
+
return { content: [{ type: "text", text: `Payment '${id}' not found.` }], isError: true };
|
|
351
|
+
}
|
|
352
|
+
return { content: [{ type: "text", text: JSON.stringify(payment, null, 2) }] };
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
// --- Reports ---
|
|
357
|
+
|
|
358
|
+
server.registerTool(
|
|
359
|
+
"payroll_report",
|
|
360
|
+
{
|
|
361
|
+
title: "Payroll Report",
|
|
362
|
+
description: "Get a payroll report for a pay period.",
|
|
363
|
+
inputSchema: { period_id: z.string() },
|
|
364
|
+
},
|
|
365
|
+
async ({ period_id }) => {
|
|
366
|
+
const report = getPayrollReport(period_id);
|
|
367
|
+
if (!report) {
|
|
368
|
+
return { content: [{ type: "text", text: `Pay period '${period_id}' not found.` }], isError: true };
|
|
369
|
+
}
|
|
370
|
+
return { content: [{ type: "text", text: JSON.stringify(report, null, 2) }] };
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
server.registerTool(
|
|
375
|
+
"ytd_report",
|
|
376
|
+
{
|
|
377
|
+
title: "YTD Report",
|
|
378
|
+
description: "Get year-to-date report for an employee.",
|
|
379
|
+
inputSchema: {
|
|
380
|
+
employee_id: z.string(),
|
|
381
|
+
year: z.number().optional(),
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
async ({ employee_id, year }) => {
|
|
385
|
+
const report = getYtdReport(employee_id, year);
|
|
386
|
+
if (!report) {
|
|
387
|
+
return { content: [{ type: "text", text: `Employee '${employee_id}' not found.` }], isError: true };
|
|
388
|
+
}
|
|
389
|
+
return { content: [{ type: "text", text: JSON.stringify(report, null, 2) }] };
|
|
390
|
+
}
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
server.registerTool(
|
|
394
|
+
"tax_summary",
|
|
395
|
+
{
|
|
396
|
+
title: "Tax Summary",
|
|
397
|
+
description: "Get tax summary for all employees for a given year.",
|
|
398
|
+
inputSchema: { year: z.number() },
|
|
399
|
+
},
|
|
400
|
+
async ({ year }) => {
|
|
401
|
+
const summary = getTaxSummary(year);
|
|
402
|
+
return {
|
|
403
|
+
content: [
|
|
404
|
+
{ type: "text", text: JSON.stringify({ summary, count: summary.length }, null, 2) },
|
|
405
|
+
],
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
|
|
410
|
+
// --- Start ---
|
|
411
|
+
async function main() {
|
|
412
|
+
const transport = new StdioServerTransport();
|
|
413
|
+
await server.connect(transport);
|
|
414
|
+
console.error("microservice-payroll MCP server running on stdio");
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
main().catch((error) => {
|
|
418
|
+
console.error("Fatal error:", error);
|
|
419
|
+
process.exit(1);
|
|
420
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hasna/microservice-shipping",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Shipping and order management microservice with SQLite — manage orders, shipments, tracking, and returns",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"microservice-shipping": "./src/cli/index.ts",
|
|
8
|
+
"microservice-shipping-mcp": "./src/mcp/index.ts"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./src/index.ts"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "bun run ./src/cli/index.ts",
|
|
15
|
+
"test": "bun test"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
19
|
+
"commander": "^12.1.0",
|
|
20
|
+
"zod": "^3.24.0"
|
|
21
|
+
},
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"registry": "https://registry.npmjs.org",
|
|
25
|
+
"access": "public"
|
|
26
|
+
}
|
|
27
|
+
}
|