@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.
Files changed (89) hide show
  1. package/bin/index.js +70 -0
  2. package/bin/mcp.js +71 -1
  3. package/dist/index.js +70 -0
  4. package/microservices/microservice-ads/package.json +27 -0
  5. package/microservices/microservice-ads/src/cli/index.ts +407 -0
  6. package/microservices/microservice-ads/src/db/campaigns.ts +493 -0
  7. package/microservices/microservice-ads/src/db/database.ts +93 -0
  8. package/microservices/microservice-ads/src/db/migrations.ts +60 -0
  9. package/microservices/microservice-ads/src/index.ts +39 -0
  10. package/microservices/microservice-ads/src/mcp/index.ts +320 -0
  11. package/microservices/microservice-contracts/package.json +27 -0
  12. package/microservices/microservice-contracts/src/cli/index.ts +383 -0
  13. package/microservices/microservice-contracts/src/db/contracts.ts +496 -0
  14. package/microservices/microservice-contracts/src/db/database.ts +93 -0
  15. package/microservices/microservice-contracts/src/db/migrations.ts +58 -0
  16. package/microservices/microservice-contracts/src/index.ts +43 -0
  17. package/microservices/microservice-contracts/src/mcp/index.ts +308 -0
  18. package/microservices/microservice-domains/package.json +27 -0
  19. package/microservices/microservice-domains/src/cli/index.ts +438 -0
  20. package/microservices/microservice-domains/src/db/database.ts +93 -0
  21. package/microservices/microservice-domains/src/db/domains.ts +551 -0
  22. package/microservices/microservice-domains/src/db/migrations.ts +60 -0
  23. package/microservices/microservice-domains/src/index.ts +44 -0
  24. package/microservices/microservice-domains/src/mcp/index.ts +368 -0
  25. package/microservices/microservice-hiring/package.json +27 -0
  26. package/microservices/microservice-hiring/src/cli/index.ts +431 -0
  27. package/microservices/microservice-hiring/src/db/database.ts +93 -0
  28. package/microservices/microservice-hiring/src/db/hiring.ts +582 -0
  29. package/microservices/microservice-hiring/src/db/migrations.ts +68 -0
  30. package/microservices/microservice-hiring/src/index.ts +51 -0
  31. package/microservices/microservice-hiring/src/mcp/index.ts +464 -0
  32. package/microservices/microservice-payments/package.json +27 -0
  33. package/microservices/microservice-payments/src/cli/index.ts +357 -0
  34. package/microservices/microservice-payments/src/db/database.ts +93 -0
  35. package/microservices/microservice-payments/src/db/migrations.ts +63 -0
  36. package/microservices/microservice-payments/src/db/payments.ts +652 -0
  37. package/microservices/microservice-payments/src/index.ts +51 -0
  38. package/microservices/microservice-payments/src/mcp/index.ts +460 -0
  39. package/microservices/microservice-payroll/package.json +27 -0
  40. package/microservices/microservice-payroll/src/cli/index.ts +374 -0
  41. package/microservices/microservice-payroll/src/db/database.ts +93 -0
  42. package/microservices/microservice-payroll/src/db/migrations.ts +69 -0
  43. package/microservices/microservice-payroll/src/db/payroll.ts +741 -0
  44. package/microservices/microservice-payroll/src/index.ts +48 -0
  45. package/microservices/microservice-payroll/src/mcp/index.ts +420 -0
  46. package/microservices/microservice-shipping/package.json +27 -0
  47. package/microservices/microservice-shipping/src/cli/index.ts +398 -0
  48. package/microservices/microservice-shipping/src/db/database.ts +93 -0
  49. package/microservices/microservice-shipping/src/db/migrations.ts +61 -0
  50. package/microservices/microservice-shipping/src/db/shipping.ts +643 -0
  51. package/microservices/microservice-shipping/src/index.ts +53 -0
  52. package/microservices/microservice-shipping/src/mcp/index.ts +385 -0
  53. package/microservices/microservice-social/package.json +27 -0
  54. package/microservices/microservice-social/src/cli/index.ts +447 -0
  55. package/microservices/microservice-social/src/db/database.ts +93 -0
  56. package/microservices/microservice-social/src/db/migrations.ts +55 -0
  57. package/microservices/microservice-social/src/db/social.ts +672 -0
  58. package/microservices/microservice-social/src/index.ts +46 -0
  59. package/microservices/microservice-social/src/mcp/index.ts +435 -0
  60. package/microservices/microservice-subscriptions/package.json +27 -0
  61. package/microservices/microservice-subscriptions/src/cli/index.ts +400 -0
  62. package/microservices/microservice-subscriptions/src/db/database.ts +93 -0
  63. package/microservices/microservice-subscriptions/src/db/migrations.ts +57 -0
  64. package/microservices/microservice-subscriptions/src/db/subscriptions.ts +692 -0
  65. package/microservices/microservice-subscriptions/src/index.ts +41 -0
  66. package/microservices/microservice-subscriptions/src/mcp/index.ts +365 -0
  67. package/microservices/microservice-transcriber/package.json +28 -0
  68. package/microservices/microservice-transcriber/src/cli/index.ts +1347 -0
  69. package/microservices/microservice-transcriber/src/db/annotations.ts +37 -0
  70. package/microservices/microservice-transcriber/src/db/database.ts +82 -0
  71. package/microservices/microservice-transcriber/src/db/migrations.ts +72 -0
  72. package/microservices/microservice-transcriber/src/db/transcripts.ts +395 -0
  73. package/microservices/microservice-transcriber/src/index.ts +43 -0
  74. package/microservices/microservice-transcriber/src/lib/config.ts +77 -0
  75. package/microservices/microservice-transcriber/src/lib/diff.ts +91 -0
  76. package/microservices/microservice-transcriber/src/lib/downloader.ts +570 -0
  77. package/microservices/microservice-transcriber/src/lib/feeds.ts +62 -0
  78. package/microservices/microservice-transcriber/src/lib/live.ts +94 -0
  79. package/microservices/microservice-transcriber/src/lib/notion.ts +129 -0
  80. package/microservices/microservice-transcriber/src/lib/providers.ts +713 -0
  81. package/microservices/microservice-transcriber/src/lib/summarizer.ts +147 -0
  82. package/microservices/microservice-transcriber/src/lib/translator.ts +75 -0
  83. package/microservices/microservice-transcriber/src/lib/webhook.ts +37 -0
  84. package/microservices/microservice-transcriber/src/mcp/index.ts +1070 -0
  85. package/microservices/microservice-transcriber/src/server/index.ts +199 -0
  86. package/package.json +1 -1
  87. package/microservices/microservice-invoices/dashboard/dist/assets/index-Bngq7FNM.css +0 -1
  88. package/microservices/microservice-invoices/dashboard/dist/assets/index-aHW4ARZR.js +0 -124
  89. package/microservices/microservice-invoices/dashboard/dist/index.html +0 -13
@@ -0,0 +1,308 @@
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
+ createContract,
8
+ getContract,
9
+ listContracts,
10
+ updateContract,
11
+ deleteContract,
12
+ searchContracts,
13
+ listExpiring,
14
+ renewContract,
15
+ getContractStats,
16
+ } from "../db/contracts.js";
17
+ import {
18
+ createClause,
19
+ listClauses,
20
+ deleteClause,
21
+ } from "../db/contracts.js";
22
+ import {
23
+ createReminder,
24
+ listReminders,
25
+ deleteReminder,
26
+ } from "../db/contracts.js";
27
+
28
+ const server = new McpServer({
29
+ name: "microservice-contracts",
30
+ version: "0.0.1",
31
+ });
32
+
33
+ // --- Contracts ---
34
+
35
+ server.registerTool(
36
+ "create_contract",
37
+ {
38
+ title: "Create Contract",
39
+ description: "Create a new contract or agreement.",
40
+ inputSchema: {
41
+ title: z.string(),
42
+ type: z.enum(["nda", "service", "employment", "license", "other"]).optional(),
43
+ status: z.enum(["draft", "pending_signature", "active", "expired", "terminated"]).optional(),
44
+ counterparty: z.string().optional(),
45
+ counterparty_email: z.string().optional(),
46
+ start_date: z.string().optional(),
47
+ end_date: z.string().optional(),
48
+ auto_renew: z.boolean().optional(),
49
+ renewal_period: z.string().optional(),
50
+ value: z.number().optional(),
51
+ currency: z.string().optional(),
52
+ file_path: z.string().optional(),
53
+ },
54
+ },
55
+ async (params) => {
56
+ const contract = createContract(params);
57
+ return { content: [{ type: "text", text: JSON.stringify(contract, null, 2) }] };
58
+ }
59
+ );
60
+
61
+ server.registerTool(
62
+ "get_contract",
63
+ {
64
+ title: "Get Contract",
65
+ description: "Get a contract by ID.",
66
+ inputSchema: { id: z.string() },
67
+ },
68
+ async ({ id }) => {
69
+ const contract = getContract(id);
70
+ if (!contract) {
71
+ return { content: [{ type: "text", text: `Contract '${id}' not found.` }], isError: true };
72
+ }
73
+ return { content: [{ type: "text", text: JSON.stringify(contract, null, 2) }] };
74
+ }
75
+ );
76
+
77
+ server.registerTool(
78
+ "list_contracts",
79
+ {
80
+ title: "List Contracts",
81
+ description: "List contracts with optional filters.",
82
+ inputSchema: {
83
+ search: z.string().optional(),
84
+ type: z.enum(["nda", "service", "employment", "license", "other"]).optional(),
85
+ status: z.enum(["draft", "pending_signature", "active", "expired", "terminated"]).optional(),
86
+ counterparty: z.string().optional(),
87
+ limit: z.number().optional(),
88
+ },
89
+ },
90
+ async (params) => {
91
+ const contracts = listContracts(params);
92
+ return {
93
+ content: [
94
+ {
95
+ type: "text",
96
+ text: JSON.stringify({ contracts, count: contracts.length }, null, 2),
97
+ },
98
+ ],
99
+ };
100
+ }
101
+ );
102
+
103
+ server.registerTool(
104
+ "update_contract",
105
+ {
106
+ title: "Update Contract",
107
+ description: "Update an existing contract.",
108
+ inputSchema: {
109
+ id: z.string(),
110
+ title: z.string().optional(),
111
+ type: z.enum(["nda", "service", "employment", "license", "other"]).optional(),
112
+ status: z.enum(["draft", "pending_signature", "active", "expired", "terminated"]).optional(),
113
+ counterparty: z.string().optional(),
114
+ counterparty_email: z.string().optional(),
115
+ start_date: z.string().optional(),
116
+ end_date: z.string().optional(),
117
+ auto_renew: z.boolean().optional(),
118
+ renewal_period: z.string().optional(),
119
+ value: z.number().optional(),
120
+ currency: z.string().optional(),
121
+ file_path: z.string().optional(),
122
+ },
123
+ },
124
+ async ({ id, ...input }) => {
125
+ const contract = updateContract(id, input);
126
+ if (!contract) {
127
+ return { content: [{ type: "text", text: `Contract '${id}' not found.` }], isError: true };
128
+ }
129
+ return { content: [{ type: "text", text: JSON.stringify(contract, null, 2) }] };
130
+ }
131
+ );
132
+
133
+ server.registerTool(
134
+ "delete_contract",
135
+ {
136
+ title: "Delete Contract",
137
+ description: "Delete a contract by ID.",
138
+ inputSchema: { id: z.string() },
139
+ },
140
+ async ({ id }) => {
141
+ const deleted = deleteContract(id);
142
+ return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
143
+ }
144
+ );
145
+
146
+ server.registerTool(
147
+ "search_contracts",
148
+ {
149
+ title: "Search Contracts",
150
+ description: "Search contracts by title, counterparty, or email.",
151
+ inputSchema: { query: z.string() },
152
+ },
153
+ async ({ query }) => {
154
+ const results = searchContracts(query);
155
+ return {
156
+ content: [
157
+ { type: "text", text: JSON.stringify({ results, count: results.length }, null, 2) },
158
+ ],
159
+ };
160
+ }
161
+ );
162
+
163
+ server.registerTool(
164
+ "list_expiring_contracts",
165
+ {
166
+ title: "List Expiring Contracts",
167
+ description: "List contracts expiring within the given number of days.",
168
+ inputSchema: { days: z.number().optional() },
169
+ },
170
+ async ({ days }) => {
171
+ const contracts = listExpiring(days ?? 30);
172
+ return {
173
+ content: [
174
+ {
175
+ type: "text",
176
+ text: JSON.stringify({ contracts, count: contracts.length }, null, 2),
177
+ },
178
+ ],
179
+ };
180
+ }
181
+ );
182
+
183
+ server.registerTool(
184
+ "renew_contract",
185
+ {
186
+ title: "Renew Contract",
187
+ description: "Renew a contract, extending end_date by its renewal_period.",
188
+ inputSchema: { id: z.string() },
189
+ },
190
+ async ({ id }) => {
191
+ const contract = renewContract(id);
192
+ if (!contract) {
193
+ return { content: [{ type: "text", text: `Contract '${id}' not found.` }], isError: true };
194
+ }
195
+ return { content: [{ type: "text", text: JSON.stringify(contract, null, 2) }] };
196
+ }
197
+ );
198
+
199
+ server.registerTool(
200
+ "contract_stats",
201
+ {
202
+ title: "Contract Stats",
203
+ description: "Get aggregate statistics about contracts.",
204
+ inputSchema: {},
205
+ },
206
+ async () => {
207
+ const stats = getContractStats();
208
+ return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] };
209
+ }
210
+ );
211
+
212
+ // --- Clauses ---
213
+
214
+ server.registerTool(
215
+ "add_clause",
216
+ {
217
+ title: "Add Clause",
218
+ description: "Add a clause to a contract.",
219
+ inputSchema: {
220
+ contract_id: z.string(),
221
+ name: z.string(),
222
+ text: z.string(),
223
+ type: z.enum(["standard", "custom", "negotiated"]).optional(),
224
+ },
225
+ },
226
+ async (params) => {
227
+ const clause = createClause(params);
228
+ return { content: [{ type: "text", text: JSON.stringify(clause, null, 2) }] };
229
+ }
230
+ );
231
+
232
+ server.registerTool(
233
+ "list_clauses",
234
+ {
235
+ title: "List Clauses",
236
+ description: "List all clauses for a contract.",
237
+ inputSchema: { contract_id: z.string() },
238
+ },
239
+ async ({ contract_id }) => {
240
+ const clauses = listClauses(contract_id);
241
+ return {
242
+ content: [
243
+ { type: "text", text: JSON.stringify({ clauses, count: clauses.length }, null, 2) },
244
+ ],
245
+ };
246
+ }
247
+ );
248
+
249
+ server.registerTool(
250
+ "remove_clause",
251
+ {
252
+ title: "Remove Clause",
253
+ description: "Remove a clause by ID.",
254
+ inputSchema: { id: z.string() },
255
+ },
256
+ async ({ id }) => {
257
+ const deleted = deleteClause(id);
258
+ return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
259
+ }
260
+ );
261
+
262
+ // --- Reminders ---
263
+
264
+ server.registerTool(
265
+ "set_reminder",
266
+ {
267
+ title: "Set Reminder",
268
+ description: "Set a reminder for a contract.",
269
+ inputSchema: {
270
+ contract_id: z.string(),
271
+ remind_at: z.string(),
272
+ message: z.string(),
273
+ },
274
+ },
275
+ async (params) => {
276
+ const reminder = createReminder(params);
277
+ return { content: [{ type: "text", text: JSON.stringify(reminder, null, 2) }] };
278
+ }
279
+ );
280
+
281
+ server.registerTool(
282
+ "list_reminders",
283
+ {
284
+ title: "List Reminders",
285
+ description: "List all reminders for a contract.",
286
+ inputSchema: { contract_id: z.string() },
287
+ },
288
+ async ({ contract_id }) => {
289
+ const reminders = listReminders(contract_id);
290
+ return {
291
+ content: [
292
+ { type: "text", text: JSON.stringify({ reminders, count: reminders.length }, null, 2) },
293
+ ],
294
+ };
295
+ }
296
+ );
297
+
298
+ // --- Start ---
299
+ async function main() {
300
+ const transport = new StdioServerTransport();
301
+ await server.connect(transport);
302
+ console.error("microservice-contracts MCP server running on stdio");
303
+ }
304
+
305
+ main().catch((error) => {
306
+ console.error("Fatal error:", error);
307
+ process.exit(1);
308
+ });
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@hasna/microservice-domains",
3
+ "version": "0.0.1",
4
+ "description": "Domain portfolio and DNS management microservice with SQLite — manage domains, DNS records, SSL certificates, and expiry alerts",
5
+ "type": "module",
6
+ "bin": {
7
+ "microservice-domains": "./src/cli/index.ts",
8
+ "microservice-domains-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
+ }