@hasna/microservices 0.0.16 → 0.0.18

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 +784 -13987
  3. package/bin/mcp.js +298 -10973
  4. package/dist/index.js +251 -10056
  5. package/package.json +36 -26
  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,617 +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
- createContract,
8
- getContract,
9
- listContracts,
10
- updateContract,
11
- deleteContract,
12
- searchContracts,
13
- listExpiring,
14
- renewContract,
15
- getContractStats,
16
- submitForReview,
17
- approveContract,
18
- getContractHistory,
19
- recordSignature,
20
- listSignatures,
21
- compareContracts,
22
- exportContract,
23
- } from "../db/contracts.js";
24
- import {
25
- createClause,
26
- listClauses,
27
- deleteClause,
28
- addClauseFromTemplate,
29
- saveClauseTemplate,
30
- listClauseTemplates,
31
- } from "../db/contracts.js";
32
- import {
33
- createReminder,
34
- listReminders,
35
- deleteReminder,
36
- setMultiReminders,
37
- } from "../db/contracts.js";
38
- import {
39
- createObligation,
40
- listObligations,
41
- completeObligation,
42
- listOverdueObligations,
43
- } from "../db/contracts.js";
44
-
45
- const server = new McpServer({
46
- name: "microservice-contracts",
47
- version: "0.0.1",
48
- });
49
-
50
- // --- Contracts ---
51
-
52
- server.registerTool(
53
- "create_contract",
54
- {
55
- title: "Create Contract",
56
- description: "Create a new contract or agreement.",
57
- inputSchema: {
58
- title: z.string(),
59
- type: z.enum(["nda", "service", "employment", "license", "other"]).optional(),
60
- status: z.enum(["draft", "pending_review", "pending_signature", "active", "expired", "terminated"]).optional(),
61
- counterparty: z.string().optional(),
62
- counterparty_email: z.string().optional(),
63
- start_date: z.string().optional(),
64
- end_date: z.string().optional(),
65
- auto_renew: z.boolean().optional(),
66
- renewal_period: z.string().optional(),
67
- value: z.number().optional(),
68
- currency: z.string().optional(),
69
- file_path: z.string().optional(),
70
- },
71
- },
72
- async (params) => {
73
- const contract = createContract(params);
74
- return { content: [{ type: "text", text: JSON.stringify(contract, null, 2) }] };
75
- }
76
- );
77
-
78
- server.registerTool(
79
- "get_contract",
80
- {
81
- title: "Get Contract",
82
- description: "Get a contract by ID.",
83
- inputSchema: { id: z.string() },
84
- },
85
- async ({ id }) => {
86
- const contract = getContract(id);
87
- if (!contract) {
88
- return { content: [{ type: "text", text: `Contract '${id}' not found.` }], isError: true };
89
- }
90
- return { content: [{ type: "text", text: JSON.stringify(contract, null, 2) }] };
91
- }
92
- );
93
-
94
- server.registerTool(
95
- "list_contracts",
96
- {
97
- title: "List Contracts",
98
- description: "List contracts with optional filters.",
99
- inputSchema: {
100
- search: z.string().optional(),
101
- type: z.enum(["nda", "service", "employment", "license", "other"]).optional(),
102
- status: z.enum(["draft", "pending_review", "pending_signature", "active", "expired", "terminated"]).optional(),
103
- counterparty: z.string().optional(),
104
- limit: z.number().optional(),
105
- },
106
- },
107
- async (params) => {
108
- const contracts = listContracts(params);
109
- return {
110
- content: [
111
- {
112
- type: "text",
113
- text: JSON.stringify({ contracts, count: contracts.length }, null, 2),
114
- },
115
- ],
116
- };
117
- }
118
- );
119
-
120
- server.registerTool(
121
- "update_contract",
122
- {
123
- title: "Update Contract",
124
- description: "Update an existing contract.",
125
- inputSchema: {
126
- id: z.string(),
127
- title: z.string().optional(),
128
- type: z.enum(["nda", "service", "employment", "license", "other"]).optional(),
129
- status: z.enum(["draft", "pending_review", "pending_signature", "active", "expired", "terminated"]).optional(),
130
- counterparty: z.string().optional(),
131
- counterparty_email: z.string().optional(),
132
- start_date: z.string().optional(),
133
- end_date: z.string().optional(),
134
- auto_renew: z.boolean().optional(),
135
- renewal_period: z.string().optional(),
136
- value: z.number().optional(),
137
- currency: z.string().optional(),
138
- file_path: z.string().optional(),
139
- },
140
- },
141
- async ({ id, ...input }) => {
142
- const contract = updateContract(id, input);
143
- if (!contract) {
144
- return { content: [{ type: "text", text: `Contract '${id}' not found.` }], isError: true };
145
- }
146
- return { content: [{ type: "text", text: JSON.stringify(contract, null, 2) }] };
147
- }
148
- );
149
-
150
- server.registerTool(
151
- "delete_contract",
152
- {
153
- title: "Delete Contract",
154
- description: "Delete a contract by ID.",
155
- inputSchema: { id: z.string() },
156
- },
157
- async ({ id }) => {
158
- const deleted = deleteContract(id);
159
- return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
160
- }
161
- );
162
-
163
- server.registerTool(
164
- "search_contracts",
165
- {
166
- title: "Search Contracts",
167
- description: "Search contracts by title, counterparty, or email.",
168
- inputSchema: { query: z.string() },
169
- },
170
- async ({ query }) => {
171
- const results = searchContracts(query);
172
- return {
173
- content: [
174
- { type: "text", text: JSON.stringify({ results, count: results.length }, null, 2) },
175
- ],
176
- };
177
- }
178
- );
179
-
180
- server.registerTool(
181
- "list_expiring_contracts",
182
- {
183
- title: "List Expiring Contracts",
184
- description: "List contracts expiring within the given number of days.",
185
- inputSchema: { days: z.number().optional() },
186
- },
187
- async ({ days }) => {
188
- const contracts = listExpiring(days ?? 30);
189
- return {
190
- content: [
191
- {
192
- type: "text",
193
- text: JSON.stringify({ contracts, count: contracts.length }, null, 2),
194
- },
195
- ],
196
- };
197
- }
198
- );
199
-
200
- server.registerTool(
201
- "renew_contract",
202
- {
203
- title: "Renew Contract",
204
- description: "Renew a contract, extending end_date by its renewal_period.",
205
- inputSchema: { id: z.string() },
206
- },
207
- async ({ id }) => {
208
- const contract = renewContract(id);
209
- if (!contract) {
210
- return { content: [{ type: "text", text: `Contract '${id}' not found.` }], isError: true };
211
- }
212
- return { content: [{ type: "text", text: JSON.stringify(contract, null, 2) }] };
213
- }
214
- );
215
-
216
- server.registerTool(
217
- "contract_stats",
218
- {
219
- title: "Contract Stats",
220
- description: "Get aggregate statistics about contracts.",
221
- inputSchema: {},
222
- },
223
- async () => {
224
- const stats = getContractStats();
225
- return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] };
226
- }
227
- );
228
-
229
- // --- Approval workflow ---
230
-
231
- server.registerTool(
232
- "submit_for_review",
233
- {
234
- title: "Submit for Review",
235
- description: "Submit a draft contract for review (draft -> pending_review).",
236
- inputSchema: { id: z.string() },
237
- },
238
- async ({ id }) => {
239
- try {
240
- const contract = submitForReview(id);
241
- if (!contract) {
242
- return { content: [{ type: "text", text: `Contract '${id}' not found.` }], isError: true };
243
- }
244
- return { content: [{ type: "text", text: JSON.stringify(contract, null, 2) }] };
245
- } catch (err) {
246
- return { content: [{ type: "text", text: (err as Error).message }], isError: true };
247
- }
248
- }
249
- );
250
-
251
- server.registerTool(
252
- "approve_contract",
253
- {
254
- title: "Approve Contract",
255
- description: "Approve a contract, advancing it through the approval workflow (pending_review -> pending_signature -> active).",
256
- inputSchema: { id: z.string() },
257
- },
258
- async ({ id }) => {
259
- try {
260
- const contract = approveContract(id);
261
- if (!contract) {
262
- return { content: [{ type: "text", text: `Contract '${id}' not found.` }], isError: true };
263
- }
264
- return { content: [{ type: "text", text: JSON.stringify(contract, null, 2) }] };
265
- } catch (err) {
266
- return { content: [{ type: "text", text: (err as Error).message }], isError: true };
267
- }
268
- }
269
- );
270
-
271
- // --- Version history ---
272
-
273
- server.registerTool(
274
- "contract_history",
275
- {
276
- title: "Contract History",
277
- description: "Get version history for a contract, showing previous states before each update.",
278
- inputSchema: { contract_id: z.string() },
279
- },
280
- async ({ contract_id }) => {
281
- const history = getContractHistory(contract_id);
282
- return {
283
- content: [
284
- { type: "text", text: JSON.stringify({ history, count: history.length }, null, 2) },
285
- ],
286
- };
287
- }
288
- );
289
-
290
- // --- Signature logging ---
291
-
292
- server.registerTool(
293
- "record_signature",
294
- {
295
- title: "Record Signature",
296
- description: "Record a signature on a contract.",
297
- inputSchema: {
298
- contract_id: z.string(),
299
- signer_name: z.string(),
300
- signer_email: z.string().optional(),
301
- method: z.enum(["digital", "wet", "docusign"]).optional(),
302
- },
303
- },
304
- async (params) => {
305
- const sig = recordSignature(params);
306
- return { content: [{ type: "text", text: JSON.stringify(sig, null, 2) }] };
307
- }
308
- );
309
-
310
- server.registerTool(
311
- "list_signatures",
312
- {
313
- title: "List Signatures",
314
- description: "List all signatures for a contract.",
315
- inputSchema: { contract_id: z.string() },
316
- },
317
- async ({ contract_id }) => {
318
- const sigs = listSignatures(contract_id);
319
- return {
320
- content: [
321
- { type: "text", text: JSON.stringify({ signatures: sigs, count: sigs.length }, null, 2) },
322
- ],
323
- };
324
- }
325
- );
326
-
327
- // --- Contract comparison ---
328
-
329
- server.registerTool(
330
- "compare_contracts",
331
- {
332
- title: "Compare Contracts",
333
- description: "Compare two contracts, showing field and clause differences.",
334
- inputSchema: {
335
- id1: z.string(),
336
- id2: z.string(),
337
- },
338
- },
339
- async ({ id1, id2 }) => {
340
- try {
341
- const diff = compareContracts(id1, id2);
342
- return { content: [{ type: "text", text: JSON.stringify(diff, null, 2) }] };
343
- } catch (err) {
344
- return { content: [{ type: "text", text: (err as Error).message }], isError: true };
345
- }
346
- }
347
- );
348
-
349
- // --- Markdown export ---
350
-
351
- server.registerTool(
352
- "export_contract",
353
- {
354
- title: "Export Contract",
355
- description: "Export a contract as formatted markdown or JSON.",
356
- inputSchema: {
357
- id: z.string(),
358
- format: z.enum(["md", "json"]).optional(),
359
- },
360
- },
361
- async ({ id, format }) => {
362
- try {
363
- const output = exportContract(id, format || "md");
364
- return { content: [{ type: "text", text: output }] };
365
- } catch (err) {
366
- return { content: [{ type: "text", text: (err as Error).message }], isError: true };
367
- }
368
- }
369
- );
370
-
371
- // --- Clauses ---
372
-
373
- server.registerTool(
374
- "add_clause",
375
- {
376
- title: "Add Clause",
377
- description: "Add a clause to a contract.",
378
- inputSchema: {
379
- contract_id: z.string(),
380
- name: z.string(),
381
- text: z.string(),
382
- type: z.enum(["standard", "custom", "negotiated"]).optional(),
383
- },
384
- },
385
- async (params) => {
386
- const clause = createClause(params);
387
- return { content: [{ type: "text", text: JSON.stringify(clause, null, 2) }] };
388
- }
389
- );
390
-
391
- server.registerTool(
392
- "list_clauses",
393
- {
394
- title: "List Clauses",
395
- description: "List all clauses for a contract.",
396
- inputSchema: { contract_id: z.string() },
397
- },
398
- async ({ contract_id }) => {
399
- const clauses = listClauses(contract_id);
400
- return {
401
- content: [
402
- { type: "text", text: JSON.stringify({ clauses, count: clauses.length }, null, 2) },
403
- ],
404
- };
405
- }
406
- );
407
-
408
- server.registerTool(
409
- "remove_clause",
410
- {
411
- title: "Remove Clause",
412
- description: "Remove a clause by ID.",
413
- inputSchema: { id: z.string() },
414
- },
415
- async ({ id }) => {
416
- const deleted = deleteClause(id);
417
- return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
418
- }
419
- );
420
-
421
- // --- Clause templates ---
422
-
423
- server.registerTool(
424
- "save_clause_template",
425
- {
426
- title: "Save Clause Template",
427
- description: "Save a clause as a reusable template in the clause library.",
428
- inputSchema: {
429
- name: z.string(),
430
- text: z.string(),
431
- type: z.enum(["standard", "custom", "negotiated"]).optional(),
432
- },
433
- },
434
- async (params) => {
435
- const template = saveClauseTemplate(params);
436
- return { content: [{ type: "text", text: JSON.stringify(template, null, 2) }] };
437
- }
438
- );
439
-
440
- server.registerTool(
441
- "list_clause_templates",
442
- {
443
- title: "List Clause Templates",
444
- description: "List all clause templates in the clause library.",
445
- inputSchema: {},
446
- },
447
- async () => {
448
- const templates = listClauseTemplates();
449
- return {
450
- content: [
451
- { type: "text", text: JSON.stringify({ templates, count: templates.length }, null, 2) },
452
- ],
453
- };
454
- }
455
- );
456
-
457
- server.registerTool(
458
- "add_clause_from_template",
459
- {
460
- title: "Add Clause from Template",
461
- description: "Add a clause to a contract using a clause template by name.",
462
- inputSchema: {
463
- contract_id: z.string(),
464
- template_name: z.string(),
465
- },
466
- },
467
- async ({ contract_id, template_name }) => {
468
- try {
469
- const clause = addClauseFromTemplate(contract_id, template_name);
470
- return { content: [{ type: "text", text: JSON.stringify(clause, null, 2) }] };
471
- } catch (err) {
472
- return { content: [{ type: "text", text: (err as Error).message }], isError: true };
473
- }
474
- }
475
- );
476
-
477
- // --- Obligations ---
478
-
479
- server.registerTool(
480
- "add_obligation",
481
- {
482
- title: "Add Obligation",
483
- description: "Add an obligation to a clause for tracking.",
484
- inputSchema: {
485
- clause_id: z.string(),
486
- description: z.string(),
487
- due_date: z.string().optional(),
488
- assigned_to: z.string().optional(),
489
- },
490
- },
491
- async (params) => {
492
- const obligation = createObligation(params);
493
- return { content: [{ type: "text", text: JSON.stringify(obligation, null, 2) }] };
494
- }
495
- );
496
-
497
- server.registerTool(
498
- "list_obligations",
499
- {
500
- title: "List Obligations",
501
- description: "List all obligations for a clause.",
502
- inputSchema: { clause_id: z.string() },
503
- },
504
- async ({ clause_id }) => {
505
- const obligations = listObligations(clause_id);
506
- return {
507
- content: [
508
- { type: "text", text: JSON.stringify({ obligations, count: obligations.length }, null, 2) },
509
- ],
510
- };
511
- }
512
- );
513
-
514
- server.registerTool(
515
- "complete_obligation",
516
- {
517
- title: "Complete Obligation",
518
- description: "Mark an obligation as completed.",
519
- inputSchema: { id: z.string() },
520
- },
521
- async ({ id }) => {
522
- const obligation = completeObligation(id);
523
- if (!obligation) {
524
- return { content: [{ type: "text", text: `Obligation '${id}' not found.` }], isError: true };
525
- }
526
- return { content: [{ type: "text", text: JSON.stringify(obligation, null, 2) }] };
527
- }
528
- );
529
-
530
- server.registerTool(
531
- "list_overdue_obligations",
532
- {
533
- title: "List Overdue Obligations",
534
- description: "List all overdue obligations across all contracts.",
535
- inputSchema: {},
536
- },
537
- async () => {
538
- const obligations = listOverdueObligations();
539
- return {
540
- content: [
541
- { type: "text", text: JSON.stringify({ obligations, count: obligations.length }, null, 2) },
542
- ],
543
- };
544
- }
545
- );
546
-
547
- // --- Reminders ---
548
-
549
- server.registerTool(
550
- "set_reminder",
551
- {
552
- title: "Set Reminder",
553
- description: "Set a reminder for a contract.",
554
- inputSchema: {
555
- contract_id: z.string(),
556
- remind_at: z.string(),
557
- message: z.string(),
558
- },
559
- },
560
- async (params) => {
561
- const reminder = createReminder(params);
562
- return { content: [{ type: "text", text: JSON.stringify(reminder, null, 2) }] };
563
- }
564
- );
565
-
566
- server.registerTool(
567
- "list_reminders",
568
- {
569
- title: "List Reminders",
570
- description: "List all reminders for a contract.",
571
- inputSchema: { contract_id: z.string() },
572
- },
573
- async ({ contract_id }) => {
574
- const reminders = listReminders(contract_id);
575
- return {
576
- content: [
577
- { type: "text", text: JSON.stringify({ reminders, count: reminders.length }, null, 2) },
578
- ],
579
- };
580
- }
581
- );
582
-
583
- server.registerTool(
584
- "set_multi_reminders",
585
- {
586
- title: "Set Multi-Stage Reminders",
587
- description: "Set multiple reminders at once based on days before contract end date.",
588
- inputSchema: {
589
- contract_id: z.string(),
590
- days_before: z.array(z.number()),
591
- },
592
- },
593
- async ({ contract_id, days_before }) => {
594
- try {
595
- const reminders = setMultiReminders(contract_id, days_before);
596
- return {
597
- content: [
598
- { type: "text", text: JSON.stringify({ reminders, count: reminders.length }, null, 2) },
599
- ],
600
- };
601
- } catch (err) {
602
- return { content: [{ type: "text", text: (err as Error).message }], isError: true };
603
- }
604
- }
605
- );
606
-
607
- // --- Start ---
608
- async function main() {
609
- const transport = new StdioServerTransport();
610
- await server.connect(transport);
611
- console.error("microservice-contracts MCP server running on stdio");
612
- }
613
-
614
- main().catch((error) => {
615
- console.error("Fatal error:", error);
616
- process.exit(1);
617
- });
@@ -1,28 +0,0 @@
1
- {
2
- "name": "@hasna/microservice-crm",
3
- "version": "0.0.1",
4
- "description": "CRM pipeline microservice with SQLite — manage sales pipelines, stages, deals, and activities",
5
- "type": "module",
6
- "bin": {
7
- "microservice-crm": "./src/cli/index.ts",
8
- "microservice-crm-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
- }