@hasna/microservices 0.0.16 → 0.0.17

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 (293) hide show
  1. package/README.md +143 -23
  2. package/bin/index.js +711 -13998
  3. package/bin/mcp.js +228 -10987
  4. package/dist/index.js +166 -10056
  5. package/package.json +25 -25
  6. package/microservices/microservice-ads/package.json +0 -28
  7. package/microservices/microservice-ads/src/cli/index.ts +0 -605
  8. package/microservices/microservice-ads/src/db/campaigns.ts +0 -797
  9. package/microservices/microservice-ads/src/db/database.ts +0 -91
  10. package/microservices/microservice-ads/src/db/migrations.ts +0 -60
  11. package/microservices/microservice-ads/src/index.ts +0 -39
  12. package/microservices/microservice-ads/src/mcp/index.ts +0 -480
  13. package/microservices/microservice-analytics/package.json +0 -28
  14. package/microservices/microservice-analytics/src/cli/index.ts +0 -373
  15. package/microservices/microservice-analytics/src/db/analytics.ts +0 -564
  16. package/microservices/microservice-analytics/src/db/database.ts +0 -91
  17. package/microservices/microservice-analytics/src/db/migrations.ts +0 -50
  18. package/microservices/microservice-analytics/src/index.ts +0 -37
  19. package/microservices/microservice-analytics/src/mcp/index.ts +0 -334
  20. package/microservices/microservice-assets/package.json +0 -28
  21. package/microservices/microservice-assets/src/cli/index.ts +0 -375
  22. package/microservices/microservice-assets/src/db/assets.ts +0 -370
  23. package/microservices/microservice-assets/src/db/database.ts +0 -91
  24. package/microservices/microservice-assets/src/db/migrations.ts +0 -51
  25. package/microservices/microservice-assets/src/index.ts +0 -32
  26. package/microservices/microservice-assets/src/mcp/index.ts +0 -346
  27. package/microservices/microservice-bookkeeping/package.json +0 -28
  28. package/microservices/microservice-bookkeeping/src/cli/index.ts +0 -386
  29. package/microservices/microservice-bookkeeping/src/db/bookkeeping.ts +0 -591
  30. package/microservices/microservice-bookkeeping/src/db/database.ts +0 -91
  31. package/microservices/microservice-bookkeeping/src/db/migrations.ts +0 -52
  32. package/microservices/microservice-bookkeeping/src/index.ts +0 -32
  33. package/microservices/microservice-bookkeeping/src/mcp/index.ts +0 -284
  34. package/microservices/microservice-calendar/package.json +0 -28
  35. package/microservices/microservice-calendar/src/cli/index.ts +0 -287
  36. package/microservices/microservice-calendar/src/db/calendar.ts +0 -328
  37. package/microservices/microservice-calendar/src/db/database.ts +0 -91
  38. package/microservices/microservice-calendar/src/db/migrations.ts +0 -47
  39. package/microservices/microservice-calendar/src/index.ts +0 -24
  40. package/microservices/microservice-calendar/src/mcp/index.ts +0 -226
  41. package/microservices/microservice-company/package.json +0 -28
  42. package/microservices/microservice-company/src/cli/index.ts +0 -1126
  43. package/microservices/microservice-company/src/db/company.ts +0 -854
  44. package/microservices/microservice-company/src/db/database.ts +0 -91
  45. package/microservices/microservice-company/src/db/migrations.ts +0 -214
  46. package/microservices/microservice-company/src/db/workflow-migrations.ts +0 -44
  47. package/microservices/microservice-company/src/index.ts +0 -60
  48. package/microservices/microservice-company/src/lib/audit.ts +0 -168
  49. package/microservices/microservice-company/src/lib/finance.ts +0 -299
  50. package/microservices/microservice-company/src/lib/settings.ts +0 -85
  51. package/microservices/microservice-company/src/lib/workflows.ts +0 -698
  52. package/microservices/microservice-company/src/mcp/index.ts +0 -991
  53. package/microservices/microservice-compliance/package.json +0 -28
  54. package/microservices/microservice-compliance/src/cli/index.ts +0 -467
  55. package/microservices/microservice-compliance/src/db/compliance.ts +0 -633
  56. package/microservices/microservice-compliance/src/db/database.ts +0 -91
  57. package/microservices/microservice-compliance/src/db/migrations.ts +0 -63
  58. package/microservices/microservice-compliance/src/index.ts +0 -46
  59. package/microservices/microservice-compliance/src/mcp/index.ts +0 -438
  60. package/microservices/microservice-contacts/package.json +0 -28
  61. package/microservices/microservice-contacts/src/cli/index.ts +0 -393
  62. package/microservices/microservice-contacts/src/db/companies.ts +0 -167
  63. package/microservices/microservice-contacts/src/db/contacts.ts +0 -249
  64. package/microservices/microservice-contacts/src/db/database.ts +0 -91
  65. package/microservices/microservice-contacts/src/db/migrations.ts +0 -71
  66. package/microservices/microservice-contacts/src/db/relationships.ts +0 -53
  67. package/microservices/microservice-contacts/src/index.ts +0 -42
  68. package/microservices/microservice-contacts/src/mcp/index.ts +0 -303
  69. package/microservices/microservice-contracts/package.json +0 -28
  70. package/microservices/microservice-contracts/src/cli/index.ts +0 -770
  71. package/microservices/microservice-contracts/src/db/contracts.ts +0 -925
  72. package/microservices/microservice-contracts/src/db/database.ts +0 -91
  73. package/microservices/microservice-contracts/src/db/migrations.ts +0 -141
  74. package/microservices/microservice-contracts/src/index.ts +0 -43
  75. package/microservices/microservice-contracts/src/mcp/index.ts +0 -617
  76. package/microservices/microservice-crm/package.json +0 -28
  77. package/microservices/microservice-crm/src/cli/index.ts +0 -396
  78. package/microservices/microservice-crm/src/db/database.ts +0 -91
  79. package/microservices/microservice-crm/src/db/migrations.ts +0 -66
  80. package/microservices/microservice-crm/src/db/pipeline.ts +0 -397
  81. package/microservices/microservice-crm/src/index.ts +0 -34
  82. package/microservices/microservice-crm/src/mcp/index.ts +0 -294
  83. package/microservices/microservice-documents/package.json +0 -28
  84. package/microservices/microservice-documents/src/cli/index.ts +0 -246
  85. package/microservices/microservice-documents/src/db/database.ts +0 -91
  86. package/microservices/microservice-documents/src/db/documents.ts +0 -316
  87. package/microservices/microservice-documents/src/db/migrations.ts +0 -49
  88. package/microservices/microservice-documents/src/index.ts +0 -24
  89. package/microservices/microservice-documents/src/mcp/index.ts +0 -202
  90. package/microservices/microservice-domains/package.json +0 -28
  91. package/microservices/microservice-domains/src/cli/index.ts +0 -1111
  92. package/microservices/microservice-domains/src/db/database.ts +0 -91
  93. package/microservices/microservice-domains/src/db/domains.ts +0 -1164
  94. package/microservices/microservice-domains/src/db/migrations.ts +0 -60
  95. package/microservices/microservice-domains/src/index.ts +0 -65
  96. package/microservices/microservice-domains/src/lib/brandsight.ts +0 -350
  97. package/microservices/microservice-domains/src/lib/godaddy.ts +0 -338
  98. package/microservices/microservice-domains/src/lib/namecheap.ts +0 -262
  99. package/microservices/microservice-domains/src/lib/registrar.ts +0 -355
  100. package/microservices/microservice-domains/src/mcp/index.ts +0 -781
  101. package/microservices/microservice-expenses/package.json +0 -28
  102. package/microservices/microservice-expenses/src/cli/index.ts +0 -267
  103. package/microservices/microservice-expenses/src/db/database.ts +0 -91
  104. package/microservices/microservice-expenses/src/db/expenses.ts +0 -345
  105. package/microservices/microservice-expenses/src/db/migrations.ts +0 -45
  106. package/microservices/microservice-expenses/src/index.ts +0 -25
  107. package/microservices/microservice-expenses/src/mcp/index.ts +0 -196
  108. package/microservices/microservice-habits/package.json +0 -28
  109. package/microservices/microservice-habits/src/cli/index.ts +0 -315
  110. package/microservices/microservice-habits/src/db/database.ts +0 -91
  111. package/microservices/microservice-habits/src/db/habits.ts +0 -451
  112. package/microservices/microservice-habits/src/db/migrations.ts +0 -46
  113. package/microservices/microservice-habits/src/index.ts +0 -31
  114. package/microservices/microservice-habits/src/mcp/index.ts +0 -313
  115. package/microservices/microservice-health/package.json +0 -28
  116. package/microservices/microservice-health/src/cli/index.ts +0 -484
  117. package/microservices/microservice-health/src/db/database.ts +0 -91
  118. package/microservices/microservice-health/src/db/health.ts +0 -708
  119. package/microservices/microservice-health/src/db/migrations.ts +0 -70
  120. package/microservices/microservice-health/src/index.ts +0 -63
  121. package/microservices/microservice-health/src/mcp/index.ts +0 -437
  122. package/microservices/microservice-hiring/package.json +0 -28
  123. package/microservices/microservice-hiring/src/cli/index.ts +0 -741
  124. package/microservices/microservice-hiring/src/db/database.ts +0 -91
  125. package/microservices/microservice-hiring/src/db/hiring.ts +0 -1085
  126. package/microservices/microservice-hiring/src/db/migrations.ts +0 -89
  127. package/microservices/microservice-hiring/src/index.ts +0 -80
  128. package/microservices/microservice-hiring/src/lib/scoring.ts +0 -206
  129. package/microservices/microservice-hiring/src/mcp/index.ts +0 -709
  130. package/microservices/microservice-inventory/package.json +0 -28
  131. package/microservices/microservice-inventory/src/cli/index.ts +0 -365
  132. package/microservices/microservice-inventory/src/db/database.ts +0 -91
  133. package/microservices/microservice-inventory/src/db/inventory.ts +0 -393
  134. package/microservices/microservice-inventory/src/db/migrations.ts +0 -54
  135. package/microservices/microservice-inventory/src/index.ts +0 -28
  136. package/microservices/microservice-inventory/src/mcp/index.ts +0 -250
  137. package/microservices/microservice-invoices/dashboard/index.html +0 -12
  138. package/microservices/microservice-invoices/dashboard/package.json +0 -29
  139. package/microservices/microservice-invoices/dashboard/tsconfig.json +0 -14
  140. package/microservices/microservice-invoices/dashboard/vite.config.ts +0 -15
  141. package/microservices/microservice-invoices/package.json +0 -31
  142. package/microservices/microservice-invoices/src/cli/index.ts +0 -308
  143. package/microservices/microservice-invoices/src/db/business.ts +0 -241
  144. package/microservices/microservice-invoices/src/db/clients.ts +0 -127
  145. package/microservices/microservice-invoices/src/db/database.ts +0 -91
  146. package/microservices/microservice-invoices/src/db/invoices.ts +0 -345
  147. package/microservices/microservice-invoices/src/db/migrations.ts +0 -184
  148. package/microservices/microservice-invoices/src/index.ts +0 -56
  149. package/microservices/microservice-invoices/src/mcp/index.ts +0 -242
  150. package/microservices/microservice-invoices/src/server/index.ts +0 -162
  151. package/microservices/microservice-leads/package.json +0 -28
  152. package/microservices/microservice-leads/src/cli/index.ts +0 -596
  153. package/microservices/microservice-leads/src/db/database.ts +0 -91
  154. package/microservices/microservice-leads/src/db/leads.ts +0 -520
  155. package/microservices/microservice-leads/src/db/lists.ts +0 -151
  156. package/microservices/microservice-leads/src/db/migrations.ts +0 -93
  157. package/microservices/microservice-leads/src/index.ts +0 -65
  158. package/microservices/microservice-leads/src/lib/enrichment.ts +0 -202
  159. package/microservices/microservice-leads/src/lib/scoring.ts +0 -134
  160. package/microservices/microservice-leads/src/mcp/index.ts +0 -533
  161. package/microservices/microservice-notes/package.json +0 -28
  162. package/microservices/microservice-notes/src/cli/index.ts +0 -63
  163. package/microservices/microservice-notes/src/db/database.ts +0 -91
  164. package/microservices/microservice-notes/src/db/migrations.ts +0 -40
  165. package/microservices/microservice-notes/src/db/notes.ts +0 -114
  166. package/microservices/microservice-notes/src/index.ts +0 -2
  167. package/microservices/microservice-notes/src/mcp/index.ts +0 -37
  168. package/microservices/microservice-notifications/package.json +0 -28
  169. package/microservices/microservice-notifications/src/cli/index.ts +0 -349
  170. package/microservices/microservice-notifications/src/db/database.ts +0 -91
  171. package/microservices/microservice-notifications/src/db/migrations.ts +0 -62
  172. package/microservices/microservice-notifications/src/db/notifications.ts +0 -509
  173. package/microservices/microservice-notifications/src/index.ts +0 -41
  174. package/microservices/microservice-notifications/src/mcp/index.ts +0 -422
  175. package/microservices/microservice-payments/package.json +0 -28
  176. package/microservices/microservice-payments/src/cli/index.ts +0 -609
  177. package/microservices/microservice-payments/src/db/database.ts +0 -91
  178. package/microservices/microservice-payments/src/db/migrations.ts +0 -81
  179. package/microservices/microservice-payments/src/db/payments.ts +0 -1204
  180. package/microservices/microservice-payments/src/index.ts +0 -51
  181. package/microservices/microservice-payments/src/mcp/index.ts +0 -683
  182. package/microservices/microservice-payroll/package.json +0 -28
  183. package/microservices/microservice-payroll/src/cli/index.ts +0 -643
  184. package/microservices/microservice-payroll/src/db/database.ts +0 -91
  185. package/microservices/microservice-payroll/src/db/migrations.ts +0 -95
  186. package/microservices/microservice-payroll/src/db/payroll.ts +0 -1377
  187. package/microservices/microservice-payroll/src/index.ts +0 -48
  188. package/microservices/microservice-payroll/src/mcp/index.ts +0 -666
  189. package/microservices/microservice-products/package.json +0 -28
  190. package/microservices/microservice-products/src/cli/index.ts +0 -416
  191. package/microservices/microservice-products/src/db/categories.ts +0 -154
  192. package/microservices/microservice-products/src/db/database.ts +0 -91
  193. package/microservices/microservice-products/src/db/migrations.ts +0 -58
  194. package/microservices/microservice-products/src/db/pricing-tiers.ts +0 -66
  195. package/microservices/microservice-products/src/db/products.ts +0 -452
  196. package/microservices/microservice-products/src/index.ts +0 -53
  197. package/microservices/microservice-products/src/mcp/index.ts +0 -453
  198. package/microservices/microservice-projects/package.json +0 -28
  199. package/microservices/microservice-projects/src/cli/index.ts +0 -480
  200. package/microservices/microservice-projects/src/db/database.ts +0 -91
  201. package/microservices/microservice-projects/src/db/migrations.ts +0 -65
  202. package/microservices/microservice-projects/src/db/projects.ts +0 -715
  203. package/microservices/microservice-projects/src/index.ts +0 -57
  204. package/microservices/microservice-projects/src/mcp/index.ts +0 -501
  205. package/microservices/microservice-proposals/package.json +0 -28
  206. package/microservices/microservice-proposals/src/cli/index.ts +0 -400
  207. package/microservices/microservice-proposals/src/db/database.ts +0 -91
  208. package/microservices/microservice-proposals/src/db/migrations.ts +0 -52
  209. package/microservices/microservice-proposals/src/db/proposals.ts +0 -532
  210. package/microservices/microservice-proposals/src/index.ts +0 -37
  211. package/microservices/microservice-proposals/src/mcp/index.ts +0 -375
  212. package/microservices/microservice-reading/package.json +0 -28
  213. package/microservices/microservice-reading/src/cli/index.ts +0 -464
  214. package/microservices/microservice-reading/src/db/database.ts +0 -91
  215. package/microservices/microservice-reading/src/db/migrations.ts +0 -59
  216. package/microservices/microservice-reading/src/db/reading.ts +0 -524
  217. package/microservices/microservice-reading/src/index.ts +0 -51
  218. package/microservices/microservice-reading/src/mcp/index.ts +0 -368
  219. package/microservices/microservice-shipping/package.json +0 -28
  220. package/microservices/microservice-shipping/src/cli/index.ts +0 -606
  221. package/microservices/microservice-shipping/src/db/database.ts +0 -91
  222. package/microservices/microservice-shipping/src/db/migrations.ts +0 -69
  223. package/microservices/microservice-shipping/src/db/shipping.ts +0 -1093
  224. package/microservices/microservice-shipping/src/index.ts +0 -53
  225. package/microservices/microservice-shipping/src/mcp/index.ts +0 -533
  226. package/microservices/microservice-social/package.json +0 -29
  227. package/microservices/microservice-social/src/cli/index.ts +0 -1583
  228. package/microservices/microservice-social/src/db/database.ts +0 -91
  229. package/microservices/microservice-social/src/db/migrations.ts +0 -160
  230. package/microservices/microservice-social/src/db/social.ts +0 -1076
  231. package/microservices/microservice-social/src/index.ts +0 -46
  232. package/microservices/microservice-social/src/lib/audience.ts +0 -353
  233. package/microservices/microservice-social/src/lib/content-ai.ts +0 -278
  234. package/microservices/microservice-social/src/lib/media.ts +0 -311
  235. package/microservices/microservice-social/src/lib/mentions.ts +0 -434
  236. package/microservices/microservice-social/src/lib/metrics-sync.ts +0 -264
  237. package/microservices/microservice-social/src/lib/publisher.ts +0 -377
  238. package/microservices/microservice-social/src/lib/scheduler.ts +0 -229
  239. package/microservices/microservice-social/src/lib/sentiment.ts +0 -256
  240. package/microservices/microservice-social/src/lib/threads.ts +0 -291
  241. package/microservices/microservice-social/src/mcp/index.ts +0 -1425
  242. package/microservices/microservice-social/src/server/index.ts +0 -441
  243. package/microservices/microservice-subscriptions/package.json +0 -28
  244. package/microservices/microservice-subscriptions/src/cli/index.ts +0 -715
  245. package/microservices/microservice-subscriptions/src/db/database.ts +0 -91
  246. package/microservices/microservice-subscriptions/src/db/migrations.ts +0 -125
  247. package/microservices/microservice-subscriptions/src/db/subscriptions.ts +0 -1256
  248. package/microservices/microservice-subscriptions/src/index.ts +0 -41
  249. package/microservices/microservice-subscriptions/src/mcp/index.ts +0 -631
  250. package/microservices/microservice-timesheets/package.json +0 -28
  251. package/microservices/microservice-timesheets/src/cli/index.ts +0 -373
  252. package/microservices/microservice-timesheets/src/db/database.ts +0 -91
  253. package/microservices/microservice-timesheets/src/db/locale.ts +0 -217
  254. package/microservices/microservice-timesheets/src/db/migrations.ts +0 -74
  255. package/microservices/microservice-timesheets/src/db/timesheets.ts +0 -447
  256. package/microservices/microservice-timesheets/src/index.ts +0 -44
  257. package/microservices/microservice-timesheets/src/mcp/index.ts +0 -269
  258. package/microservices/microservice-transcriber/package.json +0 -29
  259. package/microservices/microservice-transcriber/src/cli/index.ts +0 -1593
  260. package/microservices/microservice-transcriber/src/db/annotations.ts +0 -37
  261. package/microservices/microservice-transcriber/src/db/comments.ts +0 -166
  262. package/microservices/microservice-transcriber/src/db/database.ts +0 -91
  263. package/microservices/microservice-transcriber/src/db/migrations.ts +0 -118
  264. package/microservices/microservice-transcriber/src/db/proofread.ts +0 -119
  265. package/microservices/microservice-transcriber/src/db/transcripts.ts +0 -395
  266. package/microservices/microservice-transcriber/src/index.ts +0 -43
  267. package/microservices/microservice-transcriber/src/lib/config.ts +0 -77
  268. package/microservices/microservice-transcriber/src/lib/diff.ts +0 -91
  269. package/microservices/microservice-transcriber/src/lib/downloader.ts +0 -638
  270. package/microservices/microservice-transcriber/src/lib/feeds.ts +0 -62
  271. package/microservices/microservice-transcriber/src/lib/live.ts +0 -94
  272. package/microservices/microservice-transcriber/src/lib/notion.ts +0 -129
  273. package/microservices/microservice-transcriber/src/lib/proofread.ts +0 -296
  274. package/microservices/microservice-transcriber/src/lib/providers.ts +0 -713
  275. package/microservices/microservice-transcriber/src/lib/summarizer.ts +0 -147
  276. package/microservices/microservice-transcriber/src/lib/translator.ts +0 -75
  277. package/microservices/microservice-transcriber/src/lib/webhook.ts +0 -37
  278. package/microservices/microservice-transcriber/src/mcp/index.ts +0 -1330
  279. package/microservices/microservice-transcriber/src/server/index.ts +0 -199
  280. package/microservices/microservice-travel/package.json +0 -28
  281. package/microservices/microservice-travel/src/cli/index.ts +0 -505
  282. package/microservices/microservice-travel/src/db/database.ts +0 -91
  283. package/microservices/microservice-travel/src/db/migrations.ts +0 -77
  284. package/microservices/microservice-travel/src/db/travel.ts +0 -802
  285. package/microservices/microservice-travel/src/index.ts +0 -60
  286. package/microservices/microservice-travel/src/mcp/index.ts +0 -495
  287. package/microservices/microservice-wiki/package.json +0 -28
  288. package/microservices/microservice-wiki/src/cli/index.ts +0 -345
  289. package/microservices/microservice-wiki/src/db/database.ts +0 -91
  290. package/microservices/microservice-wiki/src/db/migrations.ts +0 -55
  291. package/microservices/microservice-wiki/src/db/wiki.ts +0 -395
  292. package/microservices/microservice-wiki/src/index.ts +0 -32
  293. package/microservices/microservice-wiki/src/mcp/index.ts +0 -344
@@ -1,41 +0,0 @@
1
- /**
2
- * microservice-subscriptions — Subscription and recurring billing management microservice
3
- */
4
-
5
- export {
6
- createPlan,
7
- getPlan,
8
- listPlans,
9
- updatePlan,
10
- deletePlan,
11
- countPlans,
12
- createSubscriber,
13
- getSubscriber,
14
- listSubscribers,
15
- updateSubscriber,
16
- deleteSubscriber,
17
- countSubscribers,
18
- cancelSubscriber,
19
- upgradeSubscriber,
20
- downgradeSubscriber,
21
- recordEvent,
22
- getEvent,
23
- listEvents,
24
- getMrr,
25
- getArr,
26
- getChurnRate,
27
- listExpiring,
28
- getSubscriberStats,
29
- type Plan,
30
- type CreatePlanInput,
31
- type UpdatePlanInput,
32
- type ListPlansOptions,
33
- type Subscriber,
34
- type CreateSubscriberInput,
35
- type UpdateSubscriberInput,
36
- type ListSubscribersOptions,
37
- type SubscriptionEvent,
38
- type ListEventsOptions,
39
- } from "./db/subscriptions.js";
40
-
41
- export { getDatabase, closeDatabase } from "./db/database.js";
@@ -1,631 +0,0 @@
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
- createPlan,
8
- getPlan,
9
- listPlans,
10
- updatePlan,
11
- deletePlan,
12
- createSubscriber,
13
- getSubscriber,
14
- listSubscribers,
15
- cancelSubscriber,
16
- upgradeSubscriber,
17
- downgradeSubscriber,
18
- listEvents,
19
- getMrr,
20
- getArr,
21
- getChurnRate,
22
- listExpiring,
23
- getSubscriberStats,
24
- pauseSubscriber,
25
- resumeSubscriber,
26
- extendTrial,
27
- createDunning,
28
- listDunning,
29
- updateDunning,
30
- bulkImportSubscribers,
31
- exportSubscribers,
32
- getLtv,
33
- getNrr,
34
- getCohortReport,
35
- comparePlans,
36
- getExpiringRenewals,
37
- } from "../db/subscriptions.js";
38
-
39
- const server = new McpServer({
40
- name: "microservice-subscriptions",
41
- version: "0.0.1",
42
- });
43
-
44
- // --- Plans ---
45
-
46
- server.registerTool(
47
- "create_plan",
48
- {
49
- title: "Create Plan",
50
- description: "Create a new subscription plan.",
51
- inputSchema: {
52
- name: z.string(),
53
- price: z.number(),
54
- interval: z.enum(["monthly", "yearly", "lifetime"]).default("monthly"),
55
- features: z.array(z.string()).optional(),
56
- active: z.boolean().optional(),
57
- },
58
- },
59
- async (params) => {
60
- const plan = createPlan(params);
61
- return { content: [{ type: "text", text: JSON.stringify(plan, null, 2) }] };
62
- }
63
- );
64
-
65
- server.registerTool(
66
- "get_plan",
67
- {
68
- title: "Get Plan",
69
- description: "Get a subscription plan by ID.",
70
- inputSchema: { id: z.string() },
71
- },
72
- async ({ id }) => {
73
- const plan = getPlan(id);
74
- if (!plan) {
75
- return { content: [{ type: "text", text: `Plan '${id}' not found.` }], isError: true };
76
- }
77
- return { content: [{ type: "text", text: JSON.stringify(plan, null, 2) }] };
78
- }
79
- );
80
-
81
- server.registerTool(
82
- "list_plans",
83
- {
84
- title: "List Plans",
85
- description: "List subscription plans with optional filters.",
86
- inputSchema: {
87
- active_only: z.boolean().optional(),
88
- interval: z.string().optional(),
89
- limit: z.number().optional(),
90
- },
91
- },
92
- async (params) => {
93
- const plans = listPlans(params);
94
- return {
95
- content: [
96
- { type: "text", text: JSON.stringify({ plans, count: plans.length }, null, 2) },
97
- ],
98
- };
99
- }
100
- );
101
-
102
- server.registerTool(
103
- "update_plan",
104
- {
105
- title: "Update Plan",
106
- description: "Update a subscription plan.",
107
- inputSchema: {
108
- id: z.string(),
109
- name: z.string().optional(),
110
- price: z.number().optional(),
111
- interval: z.enum(["monthly", "yearly", "lifetime"]).optional(),
112
- features: z.array(z.string()).optional(),
113
- active: z.boolean().optional(),
114
- },
115
- },
116
- async ({ id, ...input }) => {
117
- const plan = updatePlan(id, input);
118
- if (!plan) {
119
- return { content: [{ type: "text", text: `Plan '${id}' not found.` }], isError: true };
120
- }
121
- return { content: [{ type: "text", text: JSON.stringify(plan, null, 2) }] };
122
- }
123
- );
124
-
125
- server.registerTool(
126
- "delete_plan",
127
- {
128
- title: "Delete Plan",
129
- description: "Delete a subscription plan by ID.",
130
- inputSchema: { id: z.string() },
131
- },
132
- async ({ id }) => {
133
- const deleted = deletePlan(id);
134
- return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
135
- }
136
- );
137
-
138
- // --- Subscribers ---
139
-
140
- server.registerTool(
141
- "create_subscriber",
142
- {
143
- title: "Create Subscriber",
144
- description: "Create a new subscriber for a plan.",
145
- inputSchema: {
146
- plan_id: z.string(),
147
- customer_name: z.string(),
148
- customer_email: z.string(),
149
- status: z.enum(["trialing", "active", "past_due", "canceled", "expired", "paused"]).optional(),
150
- trial_ends_at: z.string().optional(),
151
- metadata: z.record(z.unknown()).optional(),
152
- },
153
- },
154
- async (params) => {
155
- const subscriber = createSubscriber(params);
156
- return { content: [{ type: "text", text: JSON.stringify(subscriber, null, 2) }] };
157
- }
158
- );
159
-
160
- server.registerTool(
161
- "get_subscriber",
162
- {
163
- title: "Get Subscriber",
164
- description: "Get a subscriber by ID.",
165
- inputSchema: { id: z.string() },
166
- },
167
- async ({ id }) => {
168
- const subscriber = getSubscriber(id);
169
- if (!subscriber) {
170
- return { content: [{ type: "text", text: `Subscriber '${id}' not found.` }], isError: true };
171
- }
172
- return { content: [{ type: "text", text: JSON.stringify(subscriber, null, 2) }] };
173
- }
174
- );
175
-
176
- server.registerTool(
177
- "list_subscribers",
178
- {
179
- title: "List Subscribers",
180
- description: "List subscribers with optional filters.",
181
- inputSchema: {
182
- plan_id: z.string().optional(),
183
- status: z.string().optional(),
184
- search: z.string().optional(),
185
- limit: z.number().optional(),
186
- },
187
- },
188
- async (params) => {
189
- const subscribers = listSubscribers(params);
190
- return {
191
- content: [
192
- {
193
- type: "text",
194
- text: JSON.stringify({ subscribers, count: subscribers.length }, null, 2),
195
- },
196
- ],
197
- };
198
- }
199
- );
200
-
201
- server.registerTool(
202
- "cancel_subscriber",
203
- {
204
- title: "Cancel Subscriber",
205
- description: "Cancel a subscription.",
206
- inputSchema: { id: z.string() },
207
- },
208
- async ({ id }) => {
209
- const subscriber = cancelSubscriber(id);
210
- if (!subscriber) {
211
- return { content: [{ type: "text", text: `Subscriber '${id}' not found.` }], isError: true };
212
- }
213
- return { content: [{ type: "text", text: JSON.stringify(subscriber, null, 2) }] };
214
- }
215
- );
216
-
217
- server.registerTool(
218
- "upgrade_subscriber",
219
- {
220
- title: "Upgrade Subscriber",
221
- description: "Upgrade a subscriber to a new plan.",
222
- inputSchema: {
223
- subscriber_id: z.string(),
224
- new_plan_id: z.string(),
225
- },
226
- },
227
- async ({ subscriber_id, new_plan_id }) => {
228
- const subscriber = upgradeSubscriber(subscriber_id, new_plan_id);
229
- if (!subscriber) {
230
- return {
231
- content: [{ type: "text", text: `Subscriber or plan not found.` }],
232
- isError: true,
233
- };
234
- }
235
- return { content: [{ type: "text", text: JSON.stringify(subscriber, null, 2) }] };
236
- }
237
- );
238
-
239
- server.registerTool(
240
- "downgrade_subscriber",
241
- {
242
- title: "Downgrade Subscriber",
243
- description: "Downgrade a subscriber to a new plan.",
244
- inputSchema: {
245
- subscriber_id: z.string(),
246
- new_plan_id: z.string(),
247
- },
248
- },
249
- async ({ subscriber_id, new_plan_id }) => {
250
- const subscriber = downgradeSubscriber(subscriber_id, new_plan_id);
251
- if (!subscriber) {
252
- return {
253
- content: [{ type: "text", text: `Subscriber or plan not found.` }],
254
- isError: true,
255
- };
256
- }
257
- return { content: [{ type: "text", text: JSON.stringify(subscriber, null, 2) }] };
258
- }
259
- );
260
-
261
- // --- Events ---
262
-
263
- server.registerTool(
264
- "list_events",
265
- {
266
- title: "List Events",
267
- description: "List subscription events.",
268
- inputSchema: {
269
- subscriber_id: z.string().optional(),
270
- type: z.string().optional(),
271
- limit: z.number().optional(),
272
- },
273
- },
274
- async (params) => {
275
- const events = listEvents(params);
276
- return {
277
- content: [
278
- { type: "text", text: JSON.stringify({ events, count: events.length }, null, 2) },
279
- ],
280
- };
281
- }
282
- );
283
-
284
- // --- Analytics ---
285
-
286
- server.registerTool(
287
- "get_mrr",
288
- {
289
- title: "Get MRR",
290
- description: "Get monthly recurring revenue.",
291
- inputSchema: {},
292
- },
293
- async () => {
294
- const mrr = getMrr();
295
- return { content: [{ type: "text", text: JSON.stringify({ mrr }) }] };
296
- }
297
- );
298
-
299
- server.registerTool(
300
- "get_arr",
301
- {
302
- title: "Get ARR",
303
- description: "Get annual recurring revenue.",
304
- inputSchema: {},
305
- },
306
- async () => {
307
- const arr = getArr();
308
- return { content: [{ type: "text", text: JSON.stringify({ arr }) }] };
309
- }
310
- );
311
-
312
- server.registerTool(
313
- "get_churn_rate",
314
- {
315
- title: "Get Churn Rate",
316
- description: "Get churn rate for a period.",
317
- inputSchema: {
318
- period_days: z.number().default(30),
319
- },
320
- },
321
- async ({ period_days }) => {
322
- const rate = getChurnRate(period_days);
323
- return { content: [{ type: "text", text: JSON.stringify({ churn_rate: rate, period_days }) }] };
324
- }
325
- );
326
-
327
- server.registerTool(
328
- "list_expiring",
329
- {
330
- title: "List Expiring Subscriptions",
331
- description: "List subscriptions expiring within a number of days.",
332
- inputSchema: {
333
- days: z.number().default(7),
334
- },
335
- },
336
- async ({ days }) => {
337
- const expiring = listExpiring(days);
338
- return {
339
- content: [
340
- {
341
- type: "text",
342
- text: JSON.stringify({ expiring, count: expiring.length }, null, 2),
343
- },
344
- ],
345
- };
346
- }
347
- );
348
-
349
- server.registerTool(
350
- "get_subscriber_stats",
351
- {
352
- title: "Get Subscriber Stats",
353
- description: "Get subscriber statistics including counts by status, MRR, and ARR.",
354
- inputSchema: {},
355
- },
356
- async () => {
357
- const stats = getSubscriberStats();
358
- const mrr = getMrr();
359
- const arr = getArr();
360
- return {
361
- content: [
362
- { type: "text", text: JSON.stringify({ ...stats, mrr, arr }, null, 2) },
363
- ],
364
- };
365
- }
366
- );
367
-
368
- // --- Pause/Resume ---
369
-
370
- server.registerTool(
371
- "pause_subscriber",
372
- {
373
- title: "Pause Subscriber",
374
- description: "Pause a subscription. Paused subscribers are excluded from MRR.",
375
- inputSchema: {
376
- id: z.string(),
377
- resume_date: z.string().optional().describe("Optional scheduled resume date (YYYY-MM-DD HH:MM:SS)"),
378
- },
379
- },
380
- async ({ id, resume_date }) => {
381
- const subscriber = pauseSubscriber(id, resume_date);
382
- if (!subscriber) {
383
- return { content: [{ type: "text", text: `Subscriber '${id}' not found or cannot be paused.` }], isError: true };
384
- }
385
- return { content: [{ type: "text", text: JSON.stringify(subscriber, null, 2) }] };
386
- }
387
- );
388
-
389
- server.registerTool(
390
- "resume_subscriber",
391
- {
392
- title: "Resume Subscriber",
393
- description: "Resume a paused subscription.",
394
- inputSchema: { id: z.string() },
395
- },
396
- async ({ id }) => {
397
- const subscriber = resumeSubscriber(id);
398
- if (!subscriber) {
399
- return { content: [{ type: "text", text: `Subscriber '${id}' not found or not paused.` }], isError: true };
400
- }
401
- return { content: [{ type: "text", text: JSON.stringify(subscriber, null, 2) }] };
402
- }
403
- );
404
-
405
- // --- Trial Extension ---
406
-
407
- server.registerTool(
408
- "extend_trial",
409
- {
410
- title: "Extend Trial",
411
- description: "Extend a subscriber's trial period by a number of days.",
412
- inputSchema: {
413
- id: z.string(),
414
- days: z.number().describe("Number of days to extend the trial"),
415
- },
416
- },
417
- async ({ id, days }) => {
418
- const subscriber = extendTrial(id, days);
419
- if (!subscriber) {
420
- return { content: [{ type: "text", text: `Subscriber '${id}' not found.` }], isError: true };
421
- }
422
- return { content: [{ type: "text", text: JSON.stringify(subscriber, null, 2) }] };
423
- }
424
- );
425
-
426
- // --- Bulk Import/Export ---
427
-
428
- server.registerTool(
429
- "bulk_import_subscribers",
430
- {
431
- title: "Bulk Import Subscribers",
432
- description: "Bulk import multiple subscribers at once.",
433
- inputSchema: {
434
- subscribers: z.array(z.object({
435
- plan_id: z.string(),
436
- customer_name: z.string(),
437
- customer_email: z.string(),
438
- status: z.enum(["trialing", "active", "past_due", "canceled", "expired", "paused"]).optional(),
439
- trial_ends_at: z.string().optional(),
440
- current_period_end: z.string().optional(),
441
- })),
442
- },
443
- },
444
- async ({ subscribers }) => {
445
- const imported = bulkImportSubscribers(subscribers);
446
- return {
447
- content: [
448
- { type: "text", text: JSON.stringify({ imported: imported.length, subscribers: imported }, null, 2) },
449
- ],
450
- };
451
- }
452
- );
453
-
454
- server.registerTool(
455
- "export_subscribers",
456
- {
457
- title: "Export Subscribers",
458
- description: "Export all subscribers in CSV or JSON format.",
459
- inputSchema: {
460
- format: z.enum(["csv", "json"]).default("json"),
461
- },
462
- },
463
- async ({ format }) => {
464
- const output = exportSubscribers(format);
465
- return { content: [{ type: "text", text: output }] };
466
- }
467
- );
468
-
469
- // --- Dunning ---
470
-
471
- server.registerTool(
472
- "create_dunning",
473
- {
474
- title: "Create Dunning Attempt",
475
- description: "Create a new dunning attempt for a subscriber.",
476
- inputSchema: {
477
- subscriber_id: z.string(),
478
- attempt_number: z.number().optional(),
479
- status: z.enum(["pending", "retrying", "failed", "recovered"]).optional(),
480
- next_retry_at: z.string().optional(),
481
- },
482
- },
483
- async (params) => {
484
- const attempt = createDunning(params);
485
- return { content: [{ type: "text", text: JSON.stringify(attempt, null, 2) }] };
486
- }
487
- );
488
-
489
- server.registerTool(
490
- "list_dunning",
491
- {
492
- title: "List Dunning Attempts",
493
- description: "List dunning attempts with optional filters.",
494
- inputSchema: {
495
- subscriber_id: z.string().optional(),
496
- status: z.string().optional(),
497
- limit: z.number().optional(),
498
- },
499
- },
500
- async (params) => {
501
- const attempts = listDunning(params);
502
- return {
503
- content: [
504
- { type: "text", text: JSON.stringify({ attempts, count: attempts.length }, null, 2) },
505
- ],
506
- };
507
- }
508
- );
509
-
510
- server.registerTool(
511
- "update_dunning",
512
- {
513
- title: "Update Dunning Attempt",
514
- description: "Update a dunning attempt status or next retry date.",
515
- inputSchema: {
516
- id: z.string(),
517
- status: z.enum(["pending", "retrying", "failed", "recovered"]).optional(),
518
- next_retry_at: z.string().optional(),
519
- },
520
- },
521
- async ({ id, ...input }) => {
522
- const attempt = updateDunning(id, input);
523
- if (!attempt) {
524
- return { content: [{ type: "text", text: `Dunning attempt '${id}' not found.` }], isError: true };
525
- }
526
- return { content: [{ type: "text", text: JSON.stringify(attempt, null, 2) }] };
527
- }
528
- );
529
-
530
- // --- LTV ---
531
-
532
- server.registerTool(
533
- "get_ltv",
534
- {
535
- title: "Get LTV",
536
- description: "Get lifetime value per subscriber and average LTV.",
537
- inputSchema: {},
538
- },
539
- async () => {
540
- const result = getLtv();
541
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
542
- }
543
- );
544
-
545
- // --- NRR ---
546
-
547
- server.registerTool(
548
- "get_nrr",
549
- {
550
- title: "Get NRR",
551
- description: "Calculate net revenue retention for a given month.",
552
- inputSchema: {
553
- month: z.string().describe("Month in YYYY-MM format"),
554
- },
555
- },
556
- async ({ month }) => {
557
- const result = getNrr(month);
558
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
559
- }
560
- );
561
-
562
- // --- Cohort Analysis ---
563
-
564
- server.registerTool(
565
- "cohort_report",
566
- {
567
- title: "Cohort Report",
568
- description: "Generate a cohort retention analysis for the last N months.",
569
- inputSchema: {
570
- months: z.number().default(6),
571
- },
572
- },
573
- async ({ months }) => {
574
- const report = getCohortReport(months);
575
- return { content: [{ type: "text", text: JSON.stringify(report, null, 2) }] };
576
- }
577
- );
578
-
579
- // --- Plan Comparison ---
580
-
581
- server.registerTool(
582
- "compare_plans",
583
- {
584
- title: "Compare Plans",
585
- description: "Compare two plans side by side showing price and feature differences.",
586
- inputSchema: {
587
- id1: z.string().describe("First plan ID"),
588
- id2: z.string().describe("Second plan ID"),
589
- },
590
- },
591
- async ({ id1, id2 }) => {
592
- const result = comparePlans(id1, id2);
593
- if (!result) {
594
- return { content: [{ type: "text", text: "One or both plans not found." }], isError: true };
595
- }
596
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
597
- }
598
- );
599
-
600
- // --- Expiring Renewals ---
601
-
602
- server.registerTool(
603
- "expiring_renewals",
604
- {
605
- title: "Expiring Renewals",
606
- description: "List subscribers whose current period ends within N days.",
607
- inputSchema: {
608
- days: z.number().default(7),
609
- },
610
- },
611
- async ({ days }) => {
612
- const expiring = getExpiringRenewals(days);
613
- return {
614
- content: [
615
- { type: "text", text: JSON.stringify({ expiring, count: expiring.length }, null, 2) },
616
- ],
617
- };
618
- }
619
- );
620
-
621
- // --- Start ---
622
- async function main() {
623
- const transport = new StdioServerTransport();
624
- await server.connect(transport);
625
- console.error("microservice-subscriptions MCP server running on stdio");
626
- }
627
-
628
- main().catch((error) => {
629
- console.error("Fatal error:", error);
630
- process.exit(1);
631
- });
@@ -1,28 +0,0 @@
1
- {
2
- "name": "@hasna/microservice-timesheets",
3
- "version": "0.0.1",
4
- "description": "Timesheet management microservice with SQLite — track projects, log time entries, and generate summaries",
5
- "type": "module",
6
- "bin": {
7
- "microservice-timesheets": "./src/cli/index.ts",
8
- "microservice-timesheets-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
- "@hasna/cloud": "^0.1.24",
19
- "@modelcontextprotocol/sdk": "^1.26.0",
20
- "commander": "^12.1.0",
21
- "zod": "^3.24.0"
22
- },
23
- "license": "Apache-2.0",
24
- "publishConfig": {
25
- "registry": "https://registry.npmjs.org",
26
- "access": "public"
27
- }
28
- }