@hasna/microservices 0.0.15 → 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.
- package/README.md +120 -138
- package/bin/index.js +703 -12728
- package/bin/mcp.js +250 -9726
- package/dist/index.js +170 -9407
- package/package.json +25 -25
- package/microservices/microservice-ads/package.json +0 -27
- package/microservices/microservice-ads/src/cli/index.ts +0 -605
- package/microservices/microservice-ads/src/db/campaigns.ts +0 -797
- package/microservices/microservice-ads/src/db/database.ts +0 -93
- package/microservices/microservice-ads/src/db/migrations.ts +0 -60
- package/microservices/microservice-ads/src/index.ts +0 -39
- package/microservices/microservice-ads/src/mcp/index.ts +0 -480
- package/microservices/microservice-analytics/package.json +0 -27
- package/microservices/microservice-analytics/src/cli/index.ts +0 -373
- package/microservices/microservice-analytics/src/db/analytics.ts +0 -564
- package/microservices/microservice-analytics/src/db/database.ts +0 -93
- package/microservices/microservice-analytics/src/db/migrations.ts +0 -50
- package/microservices/microservice-analytics/src/index.ts +0 -37
- package/microservices/microservice-analytics/src/mcp/index.ts +0 -334
- package/microservices/microservice-assets/package.json +0 -27
- package/microservices/microservice-assets/src/cli/index.ts +0 -375
- package/microservices/microservice-assets/src/db/assets.ts +0 -370
- package/microservices/microservice-assets/src/db/database.ts +0 -93
- package/microservices/microservice-assets/src/db/migrations.ts +0 -51
- package/microservices/microservice-assets/src/index.ts +0 -32
- package/microservices/microservice-assets/src/mcp/index.ts +0 -346
- package/microservices/microservice-bookkeeping/package.json +0 -27
- package/microservices/microservice-bookkeeping/src/cli/index.ts +0 -386
- package/microservices/microservice-bookkeeping/src/db/bookkeeping.ts +0 -591
- package/microservices/microservice-bookkeeping/src/db/database.ts +0 -93
- package/microservices/microservice-bookkeeping/src/db/migrations.ts +0 -52
- package/microservices/microservice-bookkeeping/src/index.ts +0 -32
- package/microservices/microservice-bookkeeping/src/mcp/index.ts +0 -284
- package/microservices/microservice-calendar/package.json +0 -27
- package/microservices/microservice-calendar/src/cli/index.ts +0 -287
- package/microservices/microservice-calendar/src/db/calendar.ts +0 -328
- package/microservices/microservice-calendar/src/db/database.ts +0 -82
- package/microservices/microservice-calendar/src/db/migrations.ts +0 -47
- package/microservices/microservice-calendar/src/index.ts +0 -24
- package/microservices/microservice-calendar/src/mcp/index.ts +0 -226
- package/microservices/microservice-company/package.json +0 -27
- package/microservices/microservice-company/src/cli/index.ts +0 -1126
- package/microservices/microservice-company/src/db/company.ts +0 -854
- package/microservices/microservice-company/src/db/database.ts +0 -93
- package/microservices/microservice-company/src/db/migrations.ts +0 -214
- package/microservices/microservice-company/src/db/workflow-migrations.ts +0 -44
- package/microservices/microservice-company/src/index.ts +0 -60
- package/microservices/microservice-company/src/lib/audit.ts +0 -168
- package/microservices/microservice-company/src/lib/finance.ts +0 -299
- package/microservices/microservice-company/src/lib/settings.ts +0 -85
- package/microservices/microservice-company/src/lib/workflows.ts +0 -698
- package/microservices/microservice-company/src/mcp/index.ts +0 -991
- package/microservices/microservice-compliance/package.json +0 -27
- package/microservices/microservice-compliance/src/cli/index.ts +0 -467
- package/microservices/microservice-compliance/src/db/compliance.ts +0 -633
- package/microservices/microservice-compliance/src/db/database.ts +0 -93
- package/microservices/microservice-compliance/src/db/migrations.ts +0 -63
- package/microservices/microservice-compliance/src/index.ts +0 -46
- package/microservices/microservice-compliance/src/mcp/index.ts +0 -438
- package/microservices/microservice-contacts/package.json +0 -27
- package/microservices/microservice-contacts/src/cli/index.ts +0 -393
- package/microservices/microservice-contacts/src/db/companies.ts +0 -167
- package/microservices/microservice-contacts/src/db/contacts.ts +0 -249
- package/microservices/microservice-contacts/src/db/database.ts +0 -93
- package/microservices/microservice-contacts/src/db/migrations.ts +0 -71
- package/microservices/microservice-contacts/src/db/relationships.ts +0 -53
- package/microservices/microservice-contacts/src/index.ts +0 -42
- package/microservices/microservice-contacts/src/mcp/index.ts +0 -303
- package/microservices/microservice-contracts/package.json +0 -27
- package/microservices/microservice-contracts/src/cli/index.ts +0 -770
- package/microservices/microservice-contracts/src/db/contracts.ts +0 -925
- package/microservices/microservice-contracts/src/db/database.ts +0 -93
- package/microservices/microservice-contracts/src/db/migrations.ts +0 -141
- package/microservices/microservice-contracts/src/index.ts +0 -43
- package/microservices/microservice-contracts/src/mcp/index.ts +0 -617
- package/microservices/microservice-crm/package.json +0 -27
- package/microservices/microservice-crm/src/cli/index.ts +0 -396
- package/microservices/microservice-crm/src/db/database.ts +0 -82
- package/microservices/microservice-crm/src/db/migrations.ts +0 -66
- package/microservices/microservice-crm/src/db/pipeline.ts +0 -397
- package/microservices/microservice-crm/src/index.ts +0 -34
- package/microservices/microservice-crm/src/mcp/index.ts +0 -294
- package/microservices/microservice-documents/package.json +0 -27
- package/microservices/microservice-documents/src/cli/index.ts +0 -246
- package/microservices/microservice-documents/src/db/database.ts +0 -82
- package/microservices/microservice-documents/src/db/documents.ts +0 -316
- package/microservices/microservice-documents/src/db/migrations.ts +0 -49
- package/microservices/microservice-documents/src/index.ts +0 -24
- package/microservices/microservice-documents/src/mcp/index.ts +0 -202
- package/microservices/microservice-domains/package.json +0 -27
- package/microservices/microservice-domains/src/cli/index.ts +0 -1111
- package/microservices/microservice-domains/src/db/database.ts +0 -93
- package/microservices/microservice-domains/src/db/domains.ts +0 -1164
- package/microservices/microservice-domains/src/db/migrations.ts +0 -60
- package/microservices/microservice-domains/src/index.ts +0 -65
- package/microservices/microservice-domains/src/lib/brandsight.ts +0 -350
- package/microservices/microservice-domains/src/lib/godaddy.ts +0 -338
- package/microservices/microservice-domains/src/lib/namecheap.ts +0 -262
- package/microservices/microservice-domains/src/lib/registrar.ts +0 -355
- package/microservices/microservice-domains/src/mcp/index.ts +0 -781
- package/microservices/microservice-expenses/package.json +0 -27
- package/microservices/microservice-expenses/src/cli/index.ts +0 -267
- package/microservices/microservice-expenses/src/db/database.ts +0 -82
- package/microservices/microservice-expenses/src/db/expenses.ts +0 -345
- package/microservices/microservice-expenses/src/db/migrations.ts +0 -45
- package/microservices/microservice-expenses/src/index.ts +0 -25
- package/microservices/microservice-expenses/src/mcp/index.ts +0 -196
- package/microservices/microservice-habits/package.json +0 -27
- package/microservices/microservice-habits/src/cli/index.ts +0 -315
- package/microservices/microservice-habits/src/db/database.ts +0 -93
- package/microservices/microservice-habits/src/db/habits.ts +0 -451
- package/microservices/microservice-habits/src/db/migrations.ts +0 -46
- package/microservices/microservice-habits/src/index.ts +0 -31
- package/microservices/microservice-habits/src/mcp/index.ts +0 -313
- package/microservices/microservice-health/package.json +0 -27
- package/microservices/microservice-health/src/cli/index.ts +0 -484
- package/microservices/microservice-health/src/db/database.ts +0 -93
- package/microservices/microservice-health/src/db/health.ts +0 -708
- package/microservices/microservice-health/src/db/migrations.ts +0 -70
- package/microservices/microservice-health/src/index.ts +0 -63
- package/microservices/microservice-health/src/mcp/index.ts +0 -437
- package/microservices/microservice-hiring/package.json +0 -27
- package/microservices/microservice-hiring/src/cli/index.ts +0 -741
- package/microservices/microservice-hiring/src/db/database.ts +0 -93
- package/microservices/microservice-hiring/src/db/hiring.ts +0 -1085
- package/microservices/microservice-hiring/src/db/migrations.ts +0 -89
- package/microservices/microservice-hiring/src/index.ts +0 -80
- package/microservices/microservice-hiring/src/lib/scoring.ts +0 -206
- package/microservices/microservice-hiring/src/mcp/index.ts +0 -709
- package/microservices/microservice-inventory/package.json +0 -27
- package/microservices/microservice-inventory/src/cli/index.ts +0 -365
- package/microservices/microservice-inventory/src/db/database.ts +0 -82
- package/microservices/microservice-inventory/src/db/inventory.ts +0 -393
- package/microservices/microservice-inventory/src/db/migrations.ts +0 -54
- package/microservices/microservice-inventory/src/index.ts +0 -28
- package/microservices/microservice-inventory/src/mcp/index.ts +0 -250
- package/microservices/microservice-invoices/dashboard/dist/assets/index-Bngq7FNM.css +0 -1
- package/microservices/microservice-invoices/dashboard/dist/assets/index-aHW4ARZR.js +0 -124
- package/microservices/microservice-invoices/dashboard/dist/index.html +0 -13
- package/microservices/microservice-invoices/dashboard/index.html +0 -12
- package/microservices/microservice-invoices/dashboard/package.json +0 -29
- package/microservices/microservice-invoices/dashboard/tsconfig.json +0 -14
- package/microservices/microservice-invoices/dashboard/vite.config.ts +0 -15
- package/microservices/microservice-invoices/package.json +0 -30
- package/microservices/microservice-invoices/src/cli/index.ts +0 -308
- package/microservices/microservice-invoices/src/db/business.ts +0 -241
- package/microservices/microservice-invoices/src/db/clients.ts +0 -127
- package/microservices/microservice-invoices/src/db/database.ts +0 -82
- package/microservices/microservice-invoices/src/db/invoices.ts +0 -345
- package/microservices/microservice-invoices/src/db/migrations.ts +0 -184
- package/microservices/microservice-invoices/src/index.ts +0 -56
- package/microservices/microservice-invoices/src/mcp/index.ts +0 -242
- package/microservices/microservice-invoices/src/server/index.ts +0 -162
- package/microservices/microservice-leads/package.json +0 -27
- package/microservices/microservice-leads/src/cli/index.ts +0 -596
- package/microservices/microservice-leads/src/db/database.ts +0 -93
- package/microservices/microservice-leads/src/db/leads.ts +0 -520
- package/microservices/microservice-leads/src/db/lists.ts +0 -151
- package/microservices/microservice-leads/src/db/migrations.ts +0 -93
- package/microservices/microservice-leads/src/index.ts +0 -65
- package/microservices/microservice-leads/src/lib/enrichment.ts +0 -202
- package/microservices/microservice-leads/src/lib/scoring.ts +0 -134
- package/microservices/microservice-leads/src/mcp/index.ts +0 -533
- package/microservices/microservice-notes/package.json +0 -27
- package/microservices/microservice-notes/src/cli/index.ts +0 -63
- package/microservices/microservice-notes/src/db/database.ts +0 -93
- package/microservices/microservice-notes/src/db/migrations.ts +0 -40
- package/microservices/microservice-notes/src/db/notes.ts +0 -114
- package/microservices/microservice-notes/src/index.ts +0 -2
- package/microservices/microservice-notes/src/mcp/index.ts +0 -37
- package/microservices/microservice-notifications/package.json +0 -27
- package/microservices/microservice-notifications/src/cli/index.ts +0 -349
- package/microservices/microservice-notifications/src/db/database.ts +0 -93
- package/microservices/microservice-notifications/src/db/migrations.ts +0 -62
- package/microservices/microservice-notifications/src/db/notifications.ts +0 -509
- package/microservices/microservice-notifications/src/index.ts +0 -41
- package/microservices/microservice-notifications/src/mcp/index.ts +0 -422
- package/microservices/microservice-payments/package.json +0 -27
- package/microservices/microservice-payments/src/cli/index.ts +0 -609
- package/microservices/microservice-payments/src/db/database.ts +0 -93
- package/microservices/microservice-payments/src/db/migrations.ts +0 -81
- package/microservices/microservice-payments/src/db/payments.ts +0 -1204
- package/microservices/microservice-payments/src/index.ts +0 -51
- package/microservices/microservice-payments/src/mcp/index.ts +0 -683
- package/microservices/microservice-payroll/package.json +0 -27
- package/microservices/microservice-payroll/src/cli/index.ts +0 -643
- package/microservices/microservice-payroll/src/db/database.ts +0 -93
- package/microservices/microservice-payroll/src/db/migrations.ts +0 -95
- package/microservices/microservice-payroll/src/db/payroll.ts +0 -1377
- package/microservices/microservice-payroll/src/index.ts +0 -48
- package/microservices/microservice-payroll/src/mcp/index.ts +0 -666
- package/microservices/microservice-products/package.json +0 -27
- package/microservices/microservice-products/src/cli/index.ts +0 -416
- package/microservices/microservice-products/src/db/categories.ts +0 -154
- package/microservices/microservice-products/src/db/database.ts +0 -93
- package/microservices/microservice-products/src/db/migrations.ts +0 -58
- package/microservices/microservice-products/src/db/pricing-tiers.ts +0 -66
- package/microservices/microservice-products/src/db/products.ts +0 -452
- package/microservices/microservice-products/src/index.ts +0 -53
- package/microservices/microservice-products/src/mcp/index.ts +0 -453
- package/microservices/microservice-projects/package.json +0 -27
- package/microservices/microservice-projects/src/cli/index.ts +0 -480
- package/microservices/microservice-projects/src/db/database.ts +0 -93
- package/microservices/microservice-projects/src/db/migrations.ts +0 -65
- package/microservices/microservice-projects/src/db/projects.ts +0 -715
- package/microservices/microservice-projects/src/index.ts +0 -57
- package/microservices/microservice-projects/src/mcp/index.ts +0 -501
- package/microservices/microservice-proposals/package.json +0 -27
- package/microservices/microservice-proposals/src/cli/index.ts +0 -400
- package/microservices/microservice-proposals/src/db/database.ts +0 -93
- package/microservices/microservice-proposals/src/db/migrations.ts +0 -52
- package/microservices/microservice-proposals/src/db/proposals.ts +0 -532
- package/microservices/microservice-proposals/src/index.ts +0 -37
- package/microservices/microservice-proposals/src/mcp/index.ts +0 -375
- package/microservices/microservice-reading/package.json +0 -27
- package/microservices/microservice-reading/src/cli/index.ts +0 -464
- package/microservices/microservice-reading/src/db/database.ts +0 -93
- package/microservices/microservice-reading/src/db/migrations.ts +0 -59
- package/microservices/microservice-reading/src/db/reading.ts +0 -524
- package/microservices/microservice-reading/src/index.ts +0 -51
- package/microservices/microservice-reading/src/mcp/index.ts +0 -368
- package/microservices/microservice-shipping/package.json +0 -27
- package/microservices/microservice-shipping/src/cli/index.ts +0 -606
- package/microservices/microservice-shipping/src/db/database.ts +0 -93
- package/microservices/microservice-shipping/src/db/migrations.ts +0 -69
- package/microservices/microservice-shipping/src/db/shipping.ts +0 -1093
- package/microservices/microservice-shipping/src/index.ts +0 -53
- package/microservices/microservice-shipping/src/mcp/index.ts +0 -533
- package/microservices/microservice-social/package.json +0 -28
- package/microservices/microservice-social/src/cli/index.ts +0 -1583
- package/microservices/microservice-social/src/db/database.ts +0 -93
- package/microservices/microservice-social/src/db/migrations.ts +0 -160
- package/microservices/microservice-social/src/db/social.ts +0 -1076
- package/microservices/microservice-social/src/index.ts +0 -46
- package/microservices/microservice-social/src/lib/audience.ts +0 -353
- package/microservices/microservice-social/src/lib/content-ai.ts +0 -278
- package/microservices/microservice-social/src/lib/media.ts +0 -311
- package/microservices/microservice-social/src/lib/mentions.ts +0 -434
- package/microservices/microservice-social/src/lib/metrics-sync.ts +0 -264
- package/microservices/microservice-social/src/lib/publisher.ts +0 -377
- package/microservices/microservice-social/src/lib/scheduler.ts +0 -229
- package/microservices/microservice-social/src/lib/sentiment.ts +0 -256
- package/microservices/microservice-social/src/lib/threads.ts +0 -291
- package/microservices/microservice-social/src/mcp/index.ts +0 -1425
- package/microservices/microservice-social/src/server/index.ts +0 -441
- package/microservices/microservice-subscriptions/package.json +0 -27
- package/microservices/microservice-subscriptions/src/cli/index.ts +0 -715
- package/microservices/microservice-subscriptions/src/db/database.ts +0 -93
- package/microservices/microservice-subscriptions/src/db/migrations.ts +0 -125
- package/microservices/microservice-subscriptions/src/db/subscriptions.ts +0 -1256
- package/microservices/microservice-subscriptions/src/index.ts +0 -41
- package/microservices/microservice-subscriptions/src/mcp/index.ts +0 -631
- package/microservices/microservice-timesheets/package.json +0 -27
- package/microservices/microservice-timesheets/src/cli/index.ts +0 -373
- package/microservices/microservice-timesheets/src/db/database.ts +0 -82
- package/microservices/microservice-timesheets/src/db/locale.ts +0 -217
- package/microservices/microservice-timesheets/src/db/migrations.ts +0 -74
- package/microservices/microservice-timesheets/src/db/timesheets.ts +0 -447
- package/microservices/microservice-timesheets/src/index.ts +0 -44
- package/microservices/microservice-timesheets/src/mcp/index.ts +0 -269
- package/microservices/microservice-transcriber/package.json +0 -28
- package/microservices/microservice-transcriber/src/cli/index.ts +0 -1593
- package/microservices/microservice-transcriber/src/db/annotations.ts +0 -37
- package/microservices/microservice-transcriber/src/db/comments.ts +0 -166
- package/microservices/microservice-transcriber/src/db/database.ts +0 -82
- package/microservices/microservice-transcriber/src/db/migrations.ts +0 -118
- package/microservices/microservice-transcriber/src/db/proofread.ts +0 -119
- package/microservices/microservice-transcriber/src/db/transcripts.ts +0 -395
- package/microservices/microservice-transcriber/src/index.ts +0 -43
- package/microservices/microservice-transcriber/src/lib/config.ts +0 -77
- package/microservices/microservice-transcriber/src/lib/diff.ts +0 -91
- package/microservices/microservice-transcriber/src/lib/downloader.ts +0 -638
- package/microservices/microservice-transcriber/src/lib/feeds.ts +0 -62
- package/microservices/microservice-transcriber/src/lib/live.ts +0 -94
- package/microservices/microservice-transcriber/src/lib/notion.ts +0 -129
- package/microservices/microservice-transcriber/src/lib/proofread.ts +0 -296
- package/microservices/microservice-transcriber/src/lib/providers.ts +0 -713
- package/microservices/microservice-transcriber/src/lib/summarizer.ts +0 -147
- package/microservices/microservice-transcriber/src/lib/translator.ts +0 -75
- package/microservices/microservice-transcriber/src/lib/webhook.ts +0 -37
- package/microservices/microservice-transcriber/src/mcp/index.ts +0 -1330
- package/microservices/microservice-transcriber/src/server/index.ts +0 -199
- package/microservices/microservice-travel/package.json +0 -27
- package/microservices/microservice-travel/src/cli/index.ts +0 -505
- package/microservices/microservice-travel/src/db/database.ts +0 -93
- package/microservices/microservice-travel/src/db/migrations.ts +0 -77
- package/microservices/microservice-travel/src/db/travel.ts +0 -802
- package/microservices/microservice-travel/src/index.ts +0 -60
- package/microservices/microservice-travel/src/mcp/index.ts +0 -495
- package/microservices/microservice-wiki/package.json +0 -27
- package/microservices/microservice-wiki/src/cli/index.ts +0 -345
- package/microservices/microservice-wiki/src/db/database.ts +0 -93
- package/microservices/microservice-wiki/src/db/migrations.ts +0 -55
- package/microservices/microservice-wiki/src/db/wiki.ts +0 -395
- package/microservices/microservice-wiki/src/index.ts +0 -32
- package/microservices/microservice-wiki/src/mcp/index.ts +0 -344
|
@@ -1,422 +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
|
-
sendNotification,
|
|
8
|
-
getNotification,
|
|
9
|
-
listNotifications,
|
|
10
|
-
markRead,
|
|
11
|
-
markAllRead,
|
|
12
|
-
markSent,
|
|
13
|
-
markFailed,
|
|
14
|
-
createRule,
|
|
15
|
-
getRule,
|
|
16
|
-
listRules,
|
|
17
|
-
updateRule,
|
|
18
|
-
deleteRule,
|
|
19
|
-
enableRule,
|
|
20
|
-
disableRule,
|
|
21
|
-
createTemplate,
|
|
22
|
-
getTemplate,
|
|
23
|
-
listTemplates,
|
|
24
|
-
deleteTemplate,
|
|
25
|
-
renderTemplate,
|
|
26
|
-
processEvent,
|
|
27
|
-
getNotificationStats,
|
|
28
|
-
} from "../db/notifications.js";
|
|
29
|
-
|
|
30
|
-
const server = new McpServer({
|
|
31
|
-
name: "microservice-notifications",
|
|
32
|
-
version: "0.0.1",
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// --- Notifications ---
|
|
36
|
-
|
|
37
|
-
server.registerTool(
|
|
38
|
-
"send_notification",
|
|
39
|
-
{
|
|
40
|
-
title: "Send Notification",
|
|
41
|
-
description: "Send a notification via a specified channel.",
|
|
42
|
-
inputSchema: {
|
|
43
|
-
channel: z.enum(["email", "slack", "sms", "webhook", "in_app"]),
|
|
44
|
-
recipient: z.string(),
|
|
45
|
-
subject: z.string().optional(),
|
|
46
|
-
body: z.string().optional(),
|
|
47
|
-
priority: z.enum(["low", "normal", "high", "urgent"]).optional(),
|
|
48
|
-
source_service: z.string().optional(),
|
|
49
|
-
source_event: z.string().optional(),
|
|
50
|
-
metadata: z.record(z.unknown()).optional(),
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
async (params) => {
|
|
54
|
-
const notification = sendNotification(params);
|
|
55
|
-
return { content: [{ type: "text", text: JSON.stringify(notification, null, 2) }] };
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
server.registerTool(
|
|
60
|
-
"get_notification",
|
|
61
|
-
{
|
|
62
|
-
title: "Get Notification",
|
|
63
|
-
description: "Get a notification by ID.",
|
|
64
|
-
inputSchema: { id: z.string() },
|
|
65
|
-
},
|
|
66
|
-
async ({ id }) => {
|
|
67
|
-
const notification = getNotification(id);
|
|
68
|
-
if (!notification) {
|
|
69
|
-
return { content: [{ type: "text", text: `Notification '${id}' not found.` }], isError: true };
|
|
70
|
-
}
|
|
71
|
-
return { content: [{ type: "text", text: JSON.stringify(notification, null, 2) }] };
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
server.registerTool(
|
|
76
|
-
"list_notifications",
|
|
77
|
-
{
|
|
78
|
-
title: "List Notifications",
|
|
79
|
-
description: "List notifications with optional filters.",
|
|
80
|
-
inputSchema: {
|
|
81
|
-
status: z.enum(["pending", "sent", "failed", "read"]).optional(),
|
|
82
|
-
channel: z.enum(["email", "slack", "sms", "webhook", "in_app"]).optional(),
|
|
83
|
-
priority: z.enum(["low", "normal", "high", "urgent"]).optional(),
|
|
84
|
-
recipient: z.string().optional(),
|
|
85
|
-
limit: z.number().optional(),
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
async (params) => {
|
|
89
|
-
const notifications = listNotifications(params);
|
|
90
|
-
return {
|
|
91
|
-
content: [
|
|
92
|
-
{
|
|
93
|
-
type: "text",
|
|
94
|
-
text: JSON.stringify({ notifications, count: notifications.length }, null, 2),
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
server.registerTool(
|
|
102
|
-
"mark_notification_read",
|
|
103
|
-
{
|
|
104
|
-
title: "Mark Notification Read",
|
|
105
|
-
description: "Mark a notification as read.",
|
|
106
|
-
inputSchema: { id: z.string() },
|
|
107
|
-
},
|
|
108
|
-
async ({ id }) => {
|
|
109
|
-
const notification = markRead(id);
|
|
110
|
-
if (!notification) {
|
|
111
|
-
return { content: [{ type: "text", text: `Notification '${id}' not found.` }], isError: true };
|
|
112
|
-
}
|
|
113
|
-
return { content: [{ type: "text", text: JSON.stringify(notification, null, 2) }] };
|
|
114
|
-
}
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
server.registerTool(
|
|
118
|
-
"mark_all_notifications_read",
|
|
119
|
-
{
|
|
120
|
-
title: "Mark All Notifications Read",
|
|
121
|
-
description: "Mark all notifications as read for a recipient.",
|
|
122
|
-
inputSchema: { recipient: z.string() },
|
|
123
|
-
},
|
|
124
|
-
async ({ recipient }) => {
|
|
125
|
-
const count = markAllRead(recipient);
|
|
126
|
-
return { content: [{ type: "text", text: JSON.stringify({ recipient, marked_read: count }) }] };
|
|
127
|
-
}
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
server.registerTool(
|
|
131
|
-
"mark_notification_sent",
|
|
132
|
-
{
|
|
133
|
-
title: "Mark Notification Sent",
|
|
134
|
-
description: "Mark a notification as sent.",
|
|
135
|
-
inputSchema: { id: z.string() },
|
|
136
|
-
},
|
|
137
|
-
async ({ id }) => {
|
|
138
|
-
const notification = markSent(id);
|
|
139
|
-
if (!notification) {
|
|
140
|
-
return { content: [{ type: "text", text: `Notification '${id}' not found.` }], isError: true };
|
|
141
|
-
}
|
|
142
|
-
return { content: [{ type: "text", text: JSON.stringify(notification, null, 2) }] };
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
server.registerTool(
|
|
147
|
-
"mark_notification_failed",
|
|
148
|
-
{
|
|
149
|
-
title: "Mark Notification Failed",
|
|
150
|
-
description: "Mark a notification as failed.",
|
|
151
|
-
inputSchema: { id: z.string() },
|
|
152
|
-
},
|
|
153
|
-
async ({ id }) => {
|
|
154
|
-
const notification = markFailed(id);
|
|
155
|
-
if (!notification) {
|
|
156
|
-
return { content: [{ type: "text", text: `Notification '${id}' not found.` }], isError: true };
|
|
157
|
-
}
|
|
158
|
-
return { content: [{ type: "text", text: JSON.stringify(notification, null, 2) }] };
|
|
159
|
-
}
|
|
160
|
-
);
|
|
161
|
-
|
|
162
|
-
// --- Rules ---
|
|
163
|
-
|
|
164
|
-
server.registerTool(
|
|
165
|
-
"create_notification_rule",
|
|
166
|
-
{
|
|
167
|
-
title: "Create Notification Rule",
|
|
168
|
-
description: "Create a rule that triggers notifications on events.",
|
|
169
|
-
inputSchema: {
|
|
170
|
-
name: z.string().optional(),
|
|
171
|
-
trigger_event: z.string(),
|
|
172
|
-
channel: z.string(),
|
|
173
|
-
recipient: z.string(),
|
|
174
|
-
template_id: z.string().optional(),
|
|
175
|
-
metadata: z.record(z.unknown()).optional(),
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
async (params) => {
|
|
179
|
-
const rule = createRule(params);
|
|
180
|
-
return { content: [{ type: "text", text: JSON.stringify(rule, null, 2) }] };
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
server.registerTool(
|
|
185
|
-
"get_notification_rule",
|
|
186
|
-
{
|
|
187
|
-
title: "Get Notification Rule",
|
|
188
|
-
description: "Get a notification rule by ID.",
|
|
189
|
-
inputSchema: { id: z.string() },
|
|
190
|
-
},
|
|
191
|
-
async ({ id }) => {
|
|
192
|
-
const rule = getRule(id);
|
|
193
|
-
if (!rule) {
|
|
194
|
-
return { content: [{ type: "text", text: `Rule '${id}' not found.` }], isError: true };
|
|
195
|
-
}
|
|
196
|
-
return { content: [{ type: "text", text: JSON.stringify(rule, null, 2) }] };
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
server.registerTool(
|
|
201
|
-
"list_notification_rules",
|
|
202
|
-
{
|
|
203
|
-
title: "List Notification Rules",
|
|
204
|
-
description: "List all notification rules.",
|
|
205
|
-
inputSchema: {},
|
|
206
|
-
},
|
|
207
|
-
async () => {
|
|
208
|
-
const rules = listRules();
|
|
209
|
-
return {
|
|
210
|
-
content: [
|
|
211
|
-
{ type: "text", text: JSON.stringify({ rules, count: rules.length }, null, 2) },
|
|
212
|
-
],
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
server.registerTool(
|
|
218
|
-
"update_notification_rule",
|
|
219
|
-
{
|
|
220
|
-
title: "Update Notification Rule",
|
|
221
|
-
description: "Update a notification rule.",
|
|
222
|
-
inputSchema: {
|
|
223
|
-
id: z.string(),
|
|
224
|
-
name: z.string().optional(),
|
|
225
|
-
trigger_event: z.string().optional(),
|
|
226
|
-
channel: z.string().optional(),
|
|
227
|
-
recipient: z.string().optional(),
|
|
228
|
-
template_id: z.string().optional(),
|
|
229
|
-
metadata: z.record(z.unknown()).optional(),
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
async ({ id, ...input }) => {
|
|
233
|
-
const rule = updateRule(id, input);
|
|
234
|
-
if (!rule) {
|
|
235
|
-
return { content: [{ type: "text", text: `Rule '${id}' not found.` }], isError: true };
|
|
236
|
-
}
|
|
237
|
-
return { content: [{ type: "text", text: JSON.stringify(rule, null, 2) }] };
|
|
238
|
-
}
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
server.registerTool(
|
|
242
|
-
"delete_notification_rule",
|
|
243
|
-
{
|
|
244
|
-
title: "Delete Notification Rule",
|
|
245
|
-
description: "Delete a notification rule by ID.",
|
|
246
|
-
inputSchema: { id: z.string() },
|
|
247
|
-
},
|
|
248
|
-
async ({ id }) => {
|
|
249
|
-
const deleted = deleteRule(id);
|
|
250
|
-
return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
|
|
251
|
-
}
|
|
252
|
-
);
|
|
253
|
-
|
|
254
|
-
server.registerTool(
|
|
255
|
-
"enable_notification_rule",
|
|
256
|
-
{
|
|
257
|
-
title: "Enable Notification Rule",
|
|
258
|
-
description: "Enable a notification rule.",
|
|
259
|
-
inputSchema: { id: z.string() },
|
|
260
|
-
},
|
|
261
|
-
async ({ id }) => {
|
|
262
|
-
const rule = enableRule(id);
|
|
263
|
-
if (!rule) {
|
|
264
|
-
return { content: [{ type: "text", text: `Rule '${id}' not found.` }], isError: true };
|
|
265
|
-
}
|
|
266
|
-
return { content: [{ type: "text", text: JSON.stringify(rule, null, 2) }] };
|
|
267
|
-
}
|
|
268
|
-
);
|
|
269
|
-
|
|
270
|
-
server.registerTool(
|
|
271
|
-
"disable_notification_rule",
|
|
272
|
-
{
|
|
273
|
-
title: "Disable Notification Rule",
|
|
274
|
-
description: "Disable a notification rule.",
|
|
275
|
-
inputSchema: { id: z.string() },
|
|
276
|
-
},
|
|
277
|
-
async ({ id }) => {
|
|
278
|
-
const rule = disableRule(id);
|
|
279
|
-
if (!rule) {
|
|
280
|
-
return { content: [{ type: "text", text: `Rule '${id}' not found.` }], isError: true };
|
|
281
|
-
}
|
|
282
|
-
return { content: [{ type: "text", text: JSON.stringify(rule, null, 2) }] };
|
|
283
|
-
}
|
|
284
|
-
);
|
|
285
|
-
|
|
286
|
-
// --- Templates ---
|
|
287
|
-
|
|
288
|
-
server.registerTool(
|
|
289
|
-
"create_notification_template",
|
|
290
|
-
{
|
|
291
|
-
title: "Create Notification Template",
|
|
292
|
-
description: "Create a notification template with variable substitution.",
|
|
293
|
-
inputSchema: {
|
|
294
|
-
name: z.string(),
|
|
295
|
-
channel: z.string().optional(),
|
|
296
|
-
subject_template: z.string().optional(),
|
|
297
|
-
body_template: z.string().optional(),
|
|
298
|
-
variables: z.array(z.string()).optional(),
|
|
299
|
-
},
|
|
300
|
-
},
|
|
301
|
-
async (params) => {
|
|
302
|
-
const template = createTemplate(params);
|
|
303
|
-
return { content: [{ type: "text", text: JSON.stringify(template, null, 2) }] };
|
|
304
|
-
}
|
|
305
|
-
);
|
|
306
|
-
|
|
307
|
-
server.registerTool(
|
|
308
|
-
"get_notification_template",
|
|
309
|
-
{
|
|
310
|
-
title: "Get Notification Template",
|
|
311
|
-
description: "Get a notification template by ID.",
|
|
312
|
-
inputSchema: { id: z.string() },
|
|
313
|
-
},
|
|
314
|
-
async ({ id }) => {
|
|
315
|
-
const template = getTemplate(id);
|
|
316
|
-
if (!template) {
|
|
317
|
-
return { content: [{ type: "text", text: `Template '${id}' not found.` }], isError: true };
|
|
318
|
-
}
|
|
319
|
-
return { content: [{ type: "text", text: JSON.stringify(template, null, 2) }] };
|
|
320
|
-
}
|
|
321
|
-
);
|
|
322
|
-
|
|
323
|
-
server.registerTool(
|
|
324
|
-
"list_notification_templates",
|
|
325
|
-
{
|
|
326
|
-
title: "List Notification Templates",
|
|
327
|
-
description: "List all notification templates.",
|
|
328
|
-
inputSchema: {},
|
|
329
|
-
},
|
|
330
|
-
async () => {
|
|
331
|
-
const templates = listTemplates();
|
|
332
|
-
return {
|
|
333
|
-
content: [
|
|
334
|
-
{ type: "text", text: JSON.stringify({ templates, count: templates.length }, null, 2) },
|
|
335
|
-
],
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
server.registerTool(
|
|
341
|
-
"delete_notification_template",
|
|
342
|
-
{
|
|
343
|
-
title: "Delete Notification Template",
|
|
344
|
-
description: "Delete a notification template by ID.",
|
|
345
|
-
inputSchema: { id: z.string() },
|
|
346
|
-
},
|
|
347
|
-
async ({ id }) => {
|
|
348
|
-
const deleted = deleteTemplate(id);
|
|
349
|
-
return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
|
|
350
|
-
}
|
|
351
|
-
);
|
|
352
|
-
|
|
353
|
-
server.registerTool(
|
|
354
|
-
"render_notification_template",
|
|
355
|
-
{
|
|
356
|
-
title: "Render Notification Template",
|
|
357
|
-
description: "Render a template with variable substitution.",
|
|
358
|
-
inputSchema: {
|
|
359
|
-
template_id: z.string(),
|
|
360
|
-
variables: z.record(z.string()),
|
|
361
|
-
},
|
|
362
|
-
},
|
|
363
|
-
async ({ template_id, variables }) => {
|
|
364
|
-
const rendered = renderTemplate(template_id, variables);
|
|
365
|
-
if (!rendered) {
|
|
366
|
-
return { content: [{ type: "text", text: `Template '${template_id}' not found.` }], isError: true };
|
|
367
|
-
}
|
|
368
|
-
return { content: [{ type: "text", text: JSON.stringify(rendered, null, 2) }] };
|
|
369
|
-
}
|
|
370
|
-
);
|
|
371
|
-
|
|
372
|
-
// --- Event Processing ---
|
|
373
|
-
|
|
374
|
-
server.registerTool(
|
|
375
|
-
"process_notification_event",
|
|
376
|
-
{
|
|
377
|
-
title: "Process Notification Event",
|
|
378
|
-
description: "Process an event, matching rules and creating notifications with template substitution.",
|
|
379
|
-
inputSchema: {
|
|
380
|
-
event: z.string(),
|
|
381
|
-
data: z.record(z.string()).optional(),
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
async ({ event, data }) => {
|
|
385
|
-
const notifications = processEvent(event, data || {});
|
|
386
|
-
return {
|
|
387
|
-
content: [
|
|
388
|
-
{
|
|
389
|
-
type: "text",
|
|
390
|
-
text: JSON.stringify({ event, notifications, count: notifications.length }, null, 2),
|
|
391
|
-
},
|
|
392
|
-
],
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
);
|
|
396
|
-
|
|
397
|
-
// --- Stats ---
|
|
398
|
-
|
|
399
|
-
server.registerTool(
|
|
400
|
-
"get_notification_stats",
|
|
401
|
-
{
|
|
402
|
-
title: "Get Notification Stats",
|
|
403
|
-
description: "Get notification statistics by channel, status, and priority.",
|
|
404
|
-
inputSchema: {},
|
|
405
|
-
},
|
|
406
|
-
async () => {
|
|
407
|
-
const stats = getNotificationStats();
|
|
408
|
-
return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] };
|
|
409
|
-
}
|
|
410
|
-
);
|
|
411
|
-
|
|
412
|
-
// --- Start ---
|
|
413
|
-
async function main() {
|
|
414
|
-
const transport = new StdioServerTransport();
|
|
415
|
-
await server.connect(transport);
|
|
416
|
-
console.error("microservice-notifications MCP server running on stdio");
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
main().catch((error) => {
|
|
420
|
-
console.error("Fatal error:", error);
|
|
421
|
-
process.exit(1);
|
|
422
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hasna/microservice-payments",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"description": "Payment processing and tracking microservice with SQLite — manage payments, disputes, and payouts",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"microservice-payments": "./src/cli/index.ts",
|
|
8
|
-
"microservice-payments-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
|
-
}
|