@hasna/microservices 0.0.4 → 0.0.6

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 (57) hide show
  1. package/bin/index.js +9 -1
  2. package/bin/mcp.js +9 -1
  3. package/dist/index.js +9 -1
  4. package/microservices/microservice-ads/src/cli/index.ts +198 -0
  5. package/microservices/microservice-ads/src/db/campaigns.ts +304 -0
  6. package/microservices/microservice-ads/src/mcp/index.ts +160 -0
  7. package/microservices/microservice-company/package.json +27 -0
  8. package/microservices/microservice-company/src/cli/index.ts +1126 -0
  9. package/microservices/microservice-company/src/db/company.ts +854 -0
  10. package/microservices/microservice-company/src/db/database.ts +93 -0
  11. package/microservices/microservice-company/src/db/migrations.ts +214 -0
  12. package/microservices/microservice-company/src/db/workflow-migrations.ts +44 -0
  13. package/microservices/microservice-company/src/index.ts +60 -0
  14. package/microservices/microservice-company/src/lib/audit.ts +168 -0
  15. package/microservices/microservice-company/src/lib/finance.ts +299 -0
  16. package/microservices/microservice-company/src/lib/settings.ts +85 -0
  17. package/microservices/microservice-company/src/lib/workflows.ts +698 -0
  18. package/microservices/microservice-company/src/mcp/index.ts +991 -0
  19. package/microservices/microservice-contracts/src/cli/index.ts +410 -23
  20. package/microservices/microservice-contracts/src/db/contracts.ts +430 -1
  21. package/microservices/microservice-contracts/src/db/migrations.ts +83 -0
  22. package/microservices/microservice-contracts/src/mcp/index.ts +312 -3
  23. package/microservices/microservice-domains/src/cli/index.ts +673 -0
  24. package/microservices/microservice-domains/src/db/domains.ts +613 -0
  25. package/microservices/microservice-domains/src/index.ts +21 -0
  26. package/microservices/microservice-domains/src/lib/brandsight.ts +285 -0
  27. package/microservices/microservice-domains/src/lib/godaddy.ts +328 -0
  28. package/microservices/microservice-domains/src/lib/namecheap.ts +474 -0
  29. package/microservices/microservice-domains/src/lib/registrar.ts +355 -0
  30. package/microservices/microservice-domains/src/mcp/index.ts +413 -0
  31. package/microservices/microservice-hiring/src/cli/index.ts +318 -8
  32. package/microservices/microservice-hiring/src/db/hiring.ts +503 -0
  33. package/microservices/microservice-hiring/src/db/migrations.ts +21 -0
  34. package/microservices/microservice-hiring/src/index.ts +29 -0
  35. package/microservices/microservice-hiring/src/lib/scoring.ts +206 -0
  36. package/microservices/microservice-hiring/src/mcp/index.ts +245 -0
  37. package/microservices/microservice-payments/src/cli/index.ts +255 -3
  38. package/microservices/microservice-payments/src/db/migrations.ts +18 -0
  39. package/microservices/microservice-payments/src/db/payments.ts +552 -0
  40. package/microservices/microservice-payments/src/mcp/index.ts +223 -0
  41. package/microservices/microservice-payroll/src/cli/index.ts +269 -0
  42. package/microservices/microservice-payroll/src/db/migrations.ts +26 -0
  43. package/microservices/microservice-payroll/src/db/payroll.ts +636 -0
  44. package/microservices/microservice-payroll/src/mcp/index.ts +246 -0
  45. package/microservices/microservice-shipping/src/cli/index.ts +211 -3
  46. package/microservices/microservice-shipping/src/db/migrations.ts +8 -0
  47. package/microservices/microservice-shipping/src/db/shipping.ts +453 -3
  48. package/microservices/microservice-shipping/src/mcp/index.ts +149 -1
  49. package/microservices/microservice-social/src/cli/index.ts +244 -2
  50. package/microservices/microservice-social/src/db/migrations.ts +33 -0
  51. package/microservices/microservice-social/src/db/social.ts +378 -4
  52. package/microservices/microservice-social/src/mcp/index.ts +221 -1
  53. package/microservices/microservice-subscriptions/src/cli/index.ts +315 -0
  54. package/microservices/microservice-subscriptions/src/db/migrations.ts +68 -0
  55. package/microservices/microservice-subscriptions/src/db/subscriptions.ts +567 -3
  56. package/microservices/microservice-subscriptions/src/mcp/index.ts +267 -1
  57. package/package.json +1 -1
@@ -18,6 +18,15 @@ import {
18
18
  listAdGroups,
19
19
  createAd,
20
20
  listAds,
21
+ bulkPause,
22
+ bulkResume,
23
+ getRankedCampaigns,
24
+ checkBudgetStatus,
25
+ comparePlatforms,
26
+ exportCampaigns,
27
+ cloneCampaign,
28
+ getBudgetRemaining,
29
+ getAdGroupStats,
21
30
  } from "../db/campaigns.js";
22
31
 
23
32
  const server = new McpServer({
@@ -307,6 +316,157 @@ server.registerTool(
307
316
  }
308
317
  );
309
318
 
319
+ // --- QoL Tools ---
320
+
321
+ // 1. Bulk pause/resume
322
+ server.registerTool(
323
+ "bulk_pause_campaigns",
324
+ {
325
+ title: "Bulk Pause Campaigns",
326
+ description: "Pause all active campaigns on a specific platform.",
327
+ inputSchema: {
328
+ platform: PlatformEnum,
329
+ },
330
+ },
331
+ async ({ platform }) => {
332
+ const result = bulkPause(platform);
333
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
334
+ }
335
+ );
336
+
337
+ server.registerTool(
338
+ "bulk_resume_campaigns",
339
+ {
340
+ title: "Bulk Resume Campaigns",
341
+ description: "Resume all paused campaigns on a specific platform.",
342
+ inputSchema: {
343
+ platform: PlatformEnum,
344
+ },
345
+ },
346
+ async ({ platform }) => {
347
+ const result = bulkResume(platform);
348
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
349
+ }
350
+ );
351
+
352
+ // 2. Performance ranking
353
+ server.registerTool(
354
+ "ranked_campaigns",
355
+ {
356
+ title: "Ranked Campaigns",
357
+ description: "Get campaigns ranked by a performance metric (roas, ctr, or spend).",
358
+ inputSchema: {
359
+ sort_by: z.enum(["roas", "ctr", "spend"]).optional(),
360
+ limit: z.number().optional(),
361
+ },
362
+ },
363
+ async ({ sort_by, limit }) => {
364
+ const campaigns = getRankedCampaigns(sort_by || "roas", limit || 10);
365
+ return { content: [{ type: "text", text: JSON.stringify(campaigns, null, 2) }] };
366
+ }
367
+ );
368
+
369
+ // 3. Budget alerts
370
+ server.registerTool(
371
+ "check_budget",
372
+ {
373
+ title: "Check Budget Status",
374
+ description: "Check if a campaign is over budget and get remaining budget details.",
375
+ inputSchema: { id: z.string() },
376
+ },
377
+ async ({ id }) => {
378
+ const status = checkBudgetStatus(id);
379
+ if (!status) {
380
+ return { content: [{ type: "text", text: `Campaign '${id}' not found.` }], isError: true };
381
+ }
382
+ return { content: [{ type: "text", text: JSON.stringify(status, null, 2) }] };
383
+ }
384
+ );
385
+
386
+ // 4. Cross-platform comparison
387
+ server.registerTool(
388
+ "compare_platforms",
389
+ {
390
+ title: "Compare Platforms",
391
+ description: "Compare ROAS, CPA, and spend across all platforms side-by-side.",
392
+ inputSchema: {},
393
+ },
394
+ async () => {
395
+ const comparison = comparePlatforms();
396
+ return { content: [{ type: "text", text: JSON.stringify(comparison, null, 2) }] };
397
+ }
398
+ );
399
+
400
+ // 5. CSV export
401
+ server.registerTool(
402
+ "export_campaigns",
403
+ {
404
+ title: "Export Campaigns",
405
+ description: "Export all campaigns in CSV or JSON format.",
406
+ inputSchema: {
407
+ format: z.enum(["csv", "json"]).optional(),
408
+ },
409
+ },
410
+ async ({ format }) => {
411
+ const output = exportCampaigns(format || "csv");
412
+ return { content: [{ type: "text", text: output }] };
413
+ }
414
+ );
415
+
416
+ // 6. Campaign cloning
417
+ server.registerTool(
418
+ "clone_campaign",
419
+ {
420
+ title: "Clone Campaign",
421
+ description: "Clone a campaign with all its ad groups and ads.",
422
+ inputSchema: {
423
+ id: z.string(),
424
+ new_name: z.string(),
425
+ },
426
+ },
427
+ async ({ id, new_name }) => {
428
+ const cloned = cloneCampaign(id, new_name);
429
+ if (!cloned) {
430
+ return { content: [{ type: "text", text: `Campaign '${id}' not found.` }], isError: true };
431
+ }
432
+ return { content: [{ type: "text", text: JSON.stringify(cloned, null, 2) }] };
433
+ }
434
+ );
435
+
436
+ // 7. Budget remaining
437
+ server.registerTool(
438
+ "budget_remaining",
439
+ {
440
+ title: "Budget Remaining",
441
+ description: "Show daily and total budget remaining for a campaign.",
442
+ inputSchema: { id: z.string() },
443
+ },
444
+ async ({ id }) => {
445
+ const remaining = getBudgetRemaining(id);
446
+ if (!remaining) {
447
+ return { content: [{ type: "text", text: `Campaign '${id}' not found.` }], isError: true };
448
+ }
449
+ return { content: [{ type: "text", text: JSON.stringify(remaining, null, 2) }] };
450
+ }
451
+ );
452
+
453
+ // 8. Ad group stats
454
+ server.registerTool(
455
+ "ad_group_stats",
456
+ {
457
+ title: "Ad Group Stats",
458
+ description: "Get aggregated metrics for all ads within an ad group.",
459
+ inputSchema: { ad_group_id: z.string() },
460
+ },
461
+ async ({ ad_group_id }) => {
462
+ const stats = getAdGroupStats(ad_group_id);
463
+ if (!stats) {
464
+ return { content: [{ type: "text", text: `Ad group '${ad_group_id}' not found.` }], isError: true };
465
+ }
466
+ return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] };
467
+ }
468
+ );
469
+
310
470
  // --- Start ---
311
471
  async function main() {
312
472
  const transport = new StdioServerTransport();
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@hasna/microservice-company",
3
+ "version": "0.0.1",
4
+ "description": "AI agent control plane for autonomous company operations — organizations, teams, members, customers, and vendors",
5
+ "type": "module",
6
+ "bin": {
7
+ "microservice-company": "./src/cli/index.ts",
8
+ "microservice-company-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
+ }