@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.
- package/README.md +143 -23
- package/bin/index.js +711 -13998
- package/bin/mcp.js +228 -10987
- package/dist/index.js +166 -10056
- package/package.json +25 -25
- package/microservices/microservice-ads/package.json +0 -28
- 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 -91
- 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 -28
- 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 -91
- 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 -28
- 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 -91
- 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 -28
- 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 -91
- 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 -28
- 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 -91
- 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 -28
- 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 -91
- 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 -28
- 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 -91
- 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 -28
- 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 -91
- 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 -28
- 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 -91
- 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 -28
- package/microservices/microservice-crm/src/cli/index.ts +0 -396
- package/microservices/microservice-crm/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-documents/src/cli/index.ts +0 -246
- package/microservices/microservice-documents/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-domains/src/cli/index.ts +0 -1111
- package/microservices/microservice-domains/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-expenses/src/cli/index.ts +0 -267
- package/microservices/microservice-expenses/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-habits/src/cli/index.ts +0 -315
- package/microservices/microservice-habits/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-health/src/cli/index.ts +0 -484
- package/microservices/microservice-health/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-hiring/src/cli/index.ts +0 -741
- package/microservices/microservice-hiring/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-inventory/src/cli/index.ts +0 -365
- package/microservices/microservice-inventory/src/db/database.ts +0 -91
- 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/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 -31
- 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 -91
- 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 -28
- package/microservices/microservice-leads/src/cli/index.ts +0 -596
- package/microservices/microservice-leads/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-notes/src/cli/index.ts +0 -63
- package/microservices/microservice-notes/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-notifications/src/cli/index.ts +0 -349
- package/microservices/microservice-notifications/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-payments/src/cli/index.ts +0 -609
- package/microservices/microservice-payments/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-payroll/src/cli/index.ts +0 -643
- package/microservices/microservice-payroll/src/db/database.ts +0 -91
- 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 -28
- 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 -91
- 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 -28
- package/microservices/microservice-projects/src/cli/index.ts +0 -480
- package/microservices/microservice-projects/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-proposals/src/cli/index.ts +0 -400
- package/microservices/microservice-proposals/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-reading/src/cli/index.ts +0 -464
- package/microservices/microservice-reading/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-shipping/src/cli/index.ts +0 -606
- package/microservices/microservice-shipping/src/db/database.ts +0 -91
- 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 -29
- package/microservices/microservice-social/src/cli/index.ts +0 -1583
- package/microservices/microservice-social/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-subscriptions/src/cli/index.ts +0 -715
- package/microservices/microservice-subscriptions/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-timesheets/src/cli/index.ts +0 -373
- package/microservices/microservice-timesheets/src/db/database.ts +0 -91
- 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 -29
- 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 -91
- 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 -28
- package/microservices/microservice-travel/src/cli/index.ts +0 -505
- package/microservices/microservice-travel/src/db/database.ts +0 -91
- 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 -28
- package/microservices/microservice-wiki/src/cli/index.ts +0 -345
- package/microservices/microservice-wiki/src/db/database.ts +0 -91
- 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,683 +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
|
-
createPayment,
|
|
8
|
-
getPayment,
|
|
9
|
-
listPayments,
|
|
10
|
-
updatePayment,
|
|
11
|
-
deletePayment,
|
|
12
|
-
refundPayment,
|
|
13
|
-
searchPayments,
|
|
14
|
-
getRevenueReport,
|
|
15
|
-
getRevenueByCustomer,
|
|
16
|
-
reconcileWithInvoice,
|
|
17
|
-
getPaymentStats,
|
|
18
|
-
getBalanceByProvider,
|
|
19
|
-
listByProvider,
|
|
20
|
-
autoReconcile,
|
|
21
|
-
retryPayment,
|
|
22
|
-
listRetries,
|
|
23
|
-
getRetryStats,
|
|
24
|
-
convertCurrency,
|
|
25
|
-
feeAnalysis,
|
|
26
|
-
declineReport,
|
|
27
|
-
addDisputeEvidence,
|
|
28
|
-
splitPayment,
|
|
29
|
-
revenueForecast,
|
|
30
|
-
findReconciliationGaps,
|
|
31
|
-
} from "../db/payments.js";
|
|
32
|
-
import {
|
|
33
|
-
createDispute,
|
|
34
|
-
getDispute,
|
|
35
|
-
listDisputes,
|
|
36
|
-
respondDispute,
|
|
37
|
-
deleteDispute,
|
|
38
|
-
} from "../db/payments.js";
|
|
39
|
-
import {
|
|
40
|
-
createPayout,
|
|
41
|
-
getPayout,
|
|
42
|
-
listPayouts,
|
|
43
|
-
updatePayout,
|
|
44
|
-
deletePayout,
|
|
45
|
-
} from "../db/payments.js";
|
|
46
|
-
|
|
47
|
-
const server = new McpServer({
|
|
48
|
-
name: "microservice-payments",
|
|
49
|
-
version: "0.0.1",
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// --- Payments ---
|
|
53
|
-
|
|
54
|
-
server.registerTool(
|
|
55
|
-
"create_payment",
|
|
56
|
-
{
|
|
57
|
-
title: "Create Payment",
|
|
58
|
-
description: "Create a new payment record.",
|
|
59
|
-
inputSchema: {
|
|
60
|
-
type: z.enum(["charge", "refund", "transfer", "payout"]),
|
|
61
|
-
amount: z.number(),
|
|
62
|
-
currency: z.string().optional(),
|
|
63
|
-
status: z.enum(["pending", "succeeded", "failed", "disputed", "refunded"]).optional(),
|
|
64
|
-
customer_name: z.string().optional(),
|
|
65
|
-
customer_email: z.string().optional(),
|
|
66
|
-
description: z.string().optional(),
|
|
67
|
-
provider: z.enum(["stripe", "square", "mercury", "manual"]).optional(),
|
|
68
|
-
provider_id: z.string().optional(),
|
|
69
|
-
invoice_id: z.string().optional(),
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
async (params) => {
|
|
73
|
-
const payment = createPayment(params);
|
|
74
|
-
return { content: [{ type: "text", text: JSON.stringify(payment, null, 2) }] };
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
server.registerTool(
|
|
79
|
-
"get_payment",
|
|
80
|
-
{
|
|
81
|
-
title: "Get Payment",
|
|
82
|
-
description: "Get a payment by ID.",
|
|
83
|
-
inputSchema: { id: z.string() },
|
|
84
|
-
},
|
|
85
|
-
async ({ id }) => {
|
|
86
|
-
const payment = getPayment(id);
|
|
87
|
-
if (!payment) {
|
|
88
|
-
return { content: [{ type: "text", text: `Payment '${id}' not found.` }], isError: true };
|
|
89
|
-
}
|
|
90
|
-
return { content: [{ type: "text", text: JSON.stringify(payment, null, 2) }] };
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
server.registerTool(
|
|
95
|
-
"list_payments",
|
|
96
|
-
{
|
|
97
|
-
title: "List Payments",
|
|
98
|
-
description: "List payments with optional filters.",
|
|
99
|
-
inputSchema: {
|
|
100
|
-
status: z.enum(["pending", "succeeded", "failed", "disputed", "refunded"]).optional(),
|
|
101
|
-
type: z.enum(["charge", "refund", "transfer", "payout"]).optional(),
|
|
102
|
-
provider: z.enum(["stripe", "square", "mercury", "manual"]).optional(),
|
|
103
|
-
customer_email: z.string().optional(),
|
|
104
|
-
limit: z.number().optional(),
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
async (params) => {
|
|
108
|
-
const payments = listPayments(params);
|
|
109
|
-
return {
|
|
110
|
-
content: [
|
|
111
|
-
{ type: "text", text: JSON.stringify({ payments, count: payments.length }, null, 2) },
|
|
112
|
-
],
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
server.registerTool(
|
|
118
|
-
"update_payment",
|
|
119
|
-
{
|
|
120
|
-
title: "Update Payment",
|
|
121
|
-
description: "Update an existing payment.",
|
|
122
|
-
inputSchema: {
|
|
123
|
-
id: z.string(),
|
|
124
|
-
status: z.enum(["pending", "succeeded", "failed", "disputed", "refunded"]).optional(),
|
|
125
|
-
customer_name: z.string().optional(),
|
|
126
|
-
customer_email: z.string().optional(),
|
|
127
|
-
description: z.string().optional(),
|
|
128
|
-
provider: z.enum(["stripe", "square", "mercury", "manual"]).optional(),
|
|
129
|
-
provider_id: z.string().optional(),
|
|
130
|
-
invoice_id: z.string().optional(),
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
async ({ id, ...input }) => {
|
|
134
|
-
const payment = updatePayment(id, input);
|
|
135
|
-
if (!payment) {
|
|
136
|
-
return { content: [{ type: "text", text: `Payment '${id}' not found.` }], isError: true };
|
|
137
|
-
}
|
|
138
|
-
return { content: [{ type: "text", text: JSON.stringify(payment, null, 2) }] };
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
server.registerTool(
|
|
143
|
-
"delete_payment",
|
|
144
|
-
{
|
|
145
|
-
title: "Delete Payment",
|
|
146
|
-
description: "Delete a payment by ID.",
|
|
147
|
-
inputSchema: { id: z.string() },
|
|
148
|
-
},
|
|
149
|
-
async ({ id }) => {
|
|
150
|
-
const deleted = deletePayment(id);
|
|
151
|
-
return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
server.registerTool(
|
|
156
|
-
"refund_payment",
|
|
157
|
-
{
|
|
158
|
-
title: "Refund Payment",
|
|
159
|
-
description: "Refund a succeeded payment. Creates a refund record and marks the original as refunded.",
|
|
160
|
-
inputSchema: {
|
|
161
|
-
id: z.string(),
|
|
162
|
-
amount: z.number().optional(),
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
async ({ id, amount }) => {
|
|
166
|
-
const refund = refundPayment(id, amount);
|
|
167
|
-
if (!refund) {
|
|
168
|
-
return {
|
|
169
|
-
content: [{ type: "text", text: `Cannot refund payment '${id}' — not found or not succeeded.` }],
|
|
170
|
-
isError: true,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
return { content: [{ type: "text", text: JSON.stringify(refund, null, 2) }] };
|
|
174
|
-
}
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
server.registerTool(
|
|
178
|
-
"search_payments",
|
|
179
|
-
{
|
|
180
|
-
title: "Search Payments",
|
|
181
|
-
description: "Search payments by customer name, email, description, provider ID, or invoice ID.",
|
|
182
|
-
inputSchema: { query: z.string() },
|
|
183
|
-
},
|
|
184
|
-
async ({ query }) => {
|
|
185
|
-
const results = searchPayments(query);
|
|
186
|
-
return {
|
|
187
|
-
content: [
|
|
188
|
-
{ type: "text", text: JSON.stringify({ results, count: results.length }, null, 2) },
|
|
189
|
-
],
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
server.registerTool(
|
|
195
|
-
"revenue_report",
|
|
196
|
-
{
|
|
197
|
-
title: "Revenue Report",
|
|
198
|
-
description: "Get revenue report for a date range.",
|
|
199
|
-
inputSchema: {
|
|
200
|
-
start_date: z.string(),
|
|
201
|
-
end_date: z.string(),
|
|
202
|
-
},
|
|
203
|
-
},
|
|
204
|
-
async ({ start_date, end_date }) => {
|
|
205
|
-
const report = getRevenueReport(start_date, end_date);
|
|
206
|
-
return { content: [{ type: "text", text: JSON.stringify(report, null, 2) }] };
|
|
207
|
-
}
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
server.registerTool(
|
|
211
|
-
"revenue_by_customer",
|
|
212
|
-
{
|
|
213
|
-
title: "Revenue by Customer",
|
|
214
|
-
description: "Get revenue breakdown by customer.",
|
|
215
|
-
inputSchema: {},
|
|
216
|
-
},
|
|
217
|
-
async () => {
|
|
218
|
-
const revenue = getRevenueByCustomer();
|
|
219
|
-
return { content: [{ type: "text", text: JSON.stringify(revenue, null, 2) }] };
|
|
220
|
-
}
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
server.registerTool(
|
|
224
|
-
"reconcile_payment",
|
|
225
|
-
{
|
|
226
|
-
title: "Reconcile Payment",
|
|
227
|
-
description: "Link a payment to an invoice ID for reconciliation.",
|
|
228
|
-
inputSchema: {
|
|
229
|
-
payment_id: z.string(),
|
|
230
|
-
invoice_id: z.string(),
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
async ({ payment_id, invoice_id }) => {
|
|
234
|
-
const payment = reconcileWithInvoice(payment_id, invoice_id);
|
|
235
|
-
if (!payment) {
|
|
236
|
-
return { content: [{ type: "text", text: `Payment '${payment_id}' not found.` }], isError: true };
|
|
237
|
-
}
|
|
238
|
-
return { content: [{ type: "text", text: JSON.stringify(payment, null, 2) }] };
|
|
239
|
-
}
|
|
240
|
-
);
|
|
241
|
-
|
|
242
|
-
server.registerTool(
|
|
243
|
-
"payment_stats",
|
|
244
|
-
{
|
|
245
|
-
title: "Payment Statistics",
|
|
246
|
-
description: "Get overall payment statistics.",
|
|
247
|
-
inputSchema: {},
|
|
248
|
-
},
|
|
249
|
-
async () => {
|
|
250
|
-
const stats = getPaymentStats();
|
|
251
|
-
return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] };
|
|
252
|
-
}
|
|
253
|
-
);
|
|
254
|
-
|
|
255
|
-
server.registerTool(
|
|
256
|
-
"balance_by_provider",
|
|
257
|
-
{
|
|
258
|
-
title: "Balance by Provider",
|
|
259
|
-
description: "Get balance breakdown by payment provider.",
|
|
260
|
-
inputSchema: {},
|
|
261
|
-
},
|
|
262
|
-
async () => {
|
|
263
|
-
const balances = getBalanceByProvider();
|
|
264
|
-
return { content: [{ type: "text", text: JSON.stringify(balances, null, 2) }] };
|
|
265
|
-
}
|
|
266
|
-
);
|
|
267
|
-
|
|
268
|
-
server.registerTool(
|
|
269
|
-
"list_by_provider",
|
|
270
|
-
{
|
|
271
|
-
title: "List by Provider",
|
|
272
|
-
description: "List all payments for a specific provider.",
|
|
273
|
-
inputSchema: {
|
|
274
|
-
provider: z.enum(["stripe", "square", "mercury", "manual"]),
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
async ({ provider }) => {
|
|
278
|
-
const payments = listByProvider(provider);
|
|
279
|
-
return {
|
|
280
|
-
content: [
|
|
281
|
-
{ type: "text", text: JSON.stringify({ payments, count: payments.length }, null, 2) },
|
|
282
|
-
],
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
);
|
|
286
|
-
|
|
287
|
-
// --- Disputes ---
|
|
288
|
-
|
|
289
|
-
server.registerTool(
|
|
290
|
-
"create_dispute",
|
|
291
|
-
{
|
|
292
|
-
title: "Create Dispute",
|
|
293
|
-
description: "Create a dispute for a payment.",
|
|
294
|
-
inputSchema: {
|
|
295
|
-
payment_id: z.string(),
|
|
296
|
-
reason: z.string().optional(),
|
|
297
|
-
amount: z.number().optional(),
|
|
298
|
-
},
|
|
299
|
-
},
|
|
300
|
-
async (params) => {
|
|
301
|
-
const dispute = createDispute(params);
|
|
302
|
-
return { content: [{ type: "text", text: JSON.stringify(dispute, null, 2) }] };
|
|
303
|
-
}
|
|
304
|
-
);
|
|
305
|
-
|
|
306
|
-
server.registerTool(
|
|
307
|
-
"get_dispute",
|
|
308
|
-
{
|
|
309
|
-
title: "Get Dispute",
|
|
310
|
-
description: "Get a dispute by ID.",
|
|
311
|
-
inputSchema: { id: z.string() },
|
|
312
|
-
},
|
|
313
|
-
async ({ id }) => {
|
|
314
|
-
const dispute = getDispute(id);
|
|
315
|
-
if (!dispute) {
|
|
316
|
-
return { content: [{ type: "text", text: `Dispute '${id}' not found.` }], isError: true };
|
|
317
|
-
}
|
|
318
|
-
return { content: [{ type: "text", text: JSON.stringify(dispute, null, 2) }] };
|
|
319
|
-
}
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
server.registerTool(
|
|
323
|
-
"list_disputes",
|
|
324
|
-
{
|
|
325
|
-
title: "List Disputes",
|
|
326
|
-
description: "List disputes with optional status filter.",
|
|
327
|
-
inputSchema: {
|
|
328
|
-
status: z.enum(["open", "under_review", "won", "lost"]).optional(),
|
|
329
|
-
},
|
|
330
|
-
},
|
|
331
|
-
async ({ status }) => {
|
|
332
|
-
const disputes = listDisputes(status);
|
|
333
|
-
return {
|
|
334
|
-
content: [
|
|
335
|
-
{ type: "text", text: JSON.stringify({ disputes, count: disputes.length }, null, 2) },
|
|
336
|
-
],
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
);
|
|
340
|
-
|
|
341
|
-
server.registerTool(
|
|
342
|
-
"respond_dispute",
|
|
343
|
-
{
|
|
344
|
-
title: "Respond to Dispute",
|
|
345
|
-
description: "Respond to a dispute — update status and optionally add evidence.",
|
|
346
|
-
inputSchema: {
|
|
347
|
-
id: z.string(),
|
|
348
|
-
status: z.enum(["open", "under_review", "won", "lost"]),
|
|
349
|
-
},
|
|
350
|
-
},
|
|
351
|
-
async ({ id, status }) => {
|
|
352
|
-
const dispute = respondDispute(id, { status });
|
|
353
|
-
if (!dispute) {
|
|
354
|
-
return { content: [{ type: "text", text: `Dispute '${id}' not found.` }], isError: true };
|
|
355
|
-
}
|
|
356
|
-
return { content: [{ type: "text", text: JSON.stringify(dispute, null, 2) }] };
|
|
357
|
-
}
|
|
358
|
-
);
|
|
359
|
-
|
|
360
|
-
server.registerTool(
|
|
361
|
-
"delete_dispute",
|
|
362
|
-
{
|
|
363
|
-
title: "Delete Dispute",
|
|
364
|
-
description: "Delete a dispute by ID.",
|
|
365
|
-
inputSchema: { id: z.string() },
|
|
366
|
-
},
|
|
367
|
-
async ({ id }) => {
|
|
368
|
-
const deleted = deleteDispute(id);
|
|
369
|
-
return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
|
|
370
|
-
}
|
|
371
|
-
);
|
|
372
|
-
|
|
373
|
-
// --- Payouts ---
|
|
374
|
-
|
|
375
|
-
server.registerTool(
|
|
376
|
-
"create_payout",
|
|
377
|
-
{
|
|
378
|
-
title: "Create Payout",
|
|
379
|
-
description: "Initiate a new payout.",
|
|
380
|
-
inputSchema: {
|
|
381
|
-
amount: z.number(),
|
|
382
|
-
currency: z.string().optional(),
|
|
383
|
-
destination: z.string().optional(),
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
|
-
async (params) => {
|
|
387
|
-
const payout = createPayout(params);
|
|
388
|
-
return { content: [{ type: "text", text: JSON.stringify(payout, null, 2) }] };
|
|
389
|
-
}
|
|
390
|
-
);
|
|
391
|
-
|
|
392
|
-
server.registerTool(
|
|
393
|
-
"get_payout",
|
|
394
|
-
{
|
|
395
|
-
title: "Get Payout",
|
|
396
|
-
description: "Get a payout by ID.",
|
|
397
|
-
inputSchema: { id: z.string() },
|
|
398
|
-
},
|
|
399
|
-
async ({ id }) => {
|
|
400
|
-
const payout = getPayout(id);
|
|
401
|
-
if (!payout) {
|
|
402
|
-
return { content: [{ type: "text", text: `Payout '${id}' not found.` }], isError: true };
|
|
403
|
-
}
|
|
404
|
-
return { content: [{ type: "text", text: JSON.stringify(payout, null, 2) }] };
|
|
405
|
-
}
|
|
406
|
-
);
|
|
407
|
-
|
|
408
|
-
server.registerTool(
|
|
409
|
-
"list_payouts",
|
|
410
|
-
{
|
|
411
|
-
title: "List Payouts",
|
|
412
|
-
description: "List payouts with optional status filter.",
|
|
413
|
-
inputSchema: {
|
|
414
|
-
status: z.enum(["pending", "in_transit", "paid", "failed"]).optional(),
|
|
415
|
-
},
|
|
416
|
-
},
|
|
417
|
-
async ({ status }) => {
|
|
418
|
-
const payouts = listPayouts(status);
|
|
419
|
-
return {
|
|
420
|
-
content: [
|
|
421
|
-
{ type: "text", text: JSON.stringify({ payouts, count: payouts.length }, null, 2) },
|
|
422
|
-
],
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
);
|
|
426
|
-
|
|
427
|
-
server.registerTool(
|
|
428
|
-
"update_payout",
|
|
429
|
-
{
|
|
430
|
-
title: "Update Payout",
|
|
431
|
-
description: "Update a payout status.",
|
|
432
|
-
inputSchema: {
|
|
433
|
-
id: z.string(),
|
|
434
|
-
status: z.enum(["pending", "in_transit", "paid", "failed"]).optional(),
|
|
435
|
-
destination: z.string().optional(),
|
|
436
|
-
arrived_at: z.string().optional(),
|
|
437
|
-
},
|
|
438
|
-
},
|
|
439
|
-
async ({ id, ...input }) => {
|
|
440
|
-
const payout = updatePayout(id, input);
|
|
441
|
-
if (!payout) {
|
|
442
|
-
return { content: [{ type: "text", text: `Payout '${id}' not found.` }], isError: true };
|
|
443
|
-
}
|
|
444
|
-
return { content: [{ type: "text", text: JSON.stringify(payout, null, 2) }] };
|
|
445
|
-
}
|
|
446
|
-
);
|
|
447
|
-
|
|
448
|
-
server.registerTool(
|
|
449
|
-
"delete_payout",
|
|
450
|
-
{
|
|
451
|
-
title: "Delete Payout",
|
|
452
|
-
description: "Delete a payout by ID.",
|
|
453
|
-
inputSchema: { id: z.string() },
|
|
454
|
-
},
|
|
455
|
-
async ({ id }) => {
|
|
456
|
-
const deleted = deletePayout(id);
|
|
457
|
-
return { content: [{ type: "text", text: JSON.stringify({ id, deleted }) }] };
|
|
458
|
-
}
|
|
459
|
-
);
|
|
460
|
-
|
|
461
|
-
// --- Auto-Reconciliation ---
|
|
462
|
-
|
|
463
|
-
server.registerTool(
|
|
464
|
-
"auto_reconcile",
|
|
465
|
-
{
|
|
466
|
-
title: "Auto Reconcile",
|
|
467
|
-
description: "Auto-reconcile payments to invoices by matching amount, customer email, and date (+-3 days tolerance).",
|
|
468
|
-
inputSchema: {
|
|
469
|
-
date_from: z.string().optional(),
|
|
470
|
-
date_to: z.string().optional(),
|
|
471
|
-
},
|
|
472
|
-
},
|
|
473
|
-
async ({ date_from, date_to }) => {
|
|
474
|
-
const result = autoReconcile(date_from, date_to);
|
|
475
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
476
|
-
}
|
|
477
|
-
);
|
|
478
|
-
|
|
479
|
-
// --- Retry ---
|
|
480
|
-
|
|
481
|
-
server.registerTool(
|
|
482
|
-
"retry_payment",
|
|
483
|
-
{
|
|
484
|
-
title: "Retry Payment",
|
|
485
|
-
description: "Retry a failed payment. Creates a retry attempt record and re-processes the payment.",
|
|
486
|
-
inputSchema: { id: z.string() },
|
|
487
|
-
},
|
|
488
|
-
async ({ id }) => {
|
|
489
|
-
const attempt = retryPayment(id);
|
|
490
|
-
if (!attempt) {
|
|
491
|
-
return {
|
|
492
|
-
content: [{ type: "text", text: `Cannot retry payment '${id}' — not found or not failed.` }],
|
|
493
|
-
isError: true,
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
return { content: [{ type: "text", text: JSON.stringify(attempt, null, 2) }] };
|
|
497
|
-
}
|
|
498
|
-
);
|
|
499
|
-
|
|
500
|
-
server.registerTool(
|
|
501
|
-
"list_retries",
|
|
502
|
-
{
|
|
503
|
-
title: "List Retries",
|
|
504
|
-
description: "List all retry attempts for a payment.",
|
|
505
|
-
inputSchema: { payment_id: z.string() },
|
|
506
|
-
},
|
|
507
|
-
async ({ payment_id }) => {
|
|
508
|
-
const retries = listRetries(payment_id);
|
|
509
|
-
return {
|
|
510
|
-
content: [
|
|
511
|
-
{ type: "text", text: JSON.stringify({ retries, count: retries.length }, null, 2) },
|
|
512
|
-
],
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
);
|
|
516
|
-
|
|
517
|
-
server.registerTool(
|
|
518
|
-
"retry_stats",
|
|
519
|
-
{
|
|
520
|
-
title: "Retry Statistics",
|
|
521
|
-
description: "Get overall retry attempt statistics.",
|
|
522
|
-
inputSchema: {},
|
|
523
|
-
},
|
|
524
|
-
async () => {
|
|
525
|
-
const stats = getRetryStats();
|
|
526
|
-
return { content: [{ type: "text", text: JSON.stringify(stats, null, 2) }] };
|
|
527
|
-
}
|
|
528
|
-
);
|
|
529
|
-
|
|
530
|
-
// --- Currency Conversion ---
|
|
531
|
-
|
|
532
|
-
server.registerTool(
|
|
533
|
-
"convert_currency",
|
|
534
|
-
{
|
|
535
|
-
title: "Convert Currency",
|
|
536
|
-
description: "Convert an amount between currencies using built-in rates (USD/EUR/GBP/CAD/AUD).",
|
|
537
|
-
inputSchema: {
|
|
538
|
-
amount: z.number(),
|
|
539
|
-
from: z.string(),
|
|
540
|
-
to: z.string(),
|
|
541
|
-
},
|
|
542
|
-
},
|
|
543
|
-
async ({ amount, from, to }) => {
|
|
544
|
-
const result = convertCurrency(amount, from, to);
|
|
545
|
-
if (!result) {
|
|
546
|
-
return {
|
|
547
|
-
content: [{ type: "text", text: `Unsupported currency pair: ${from} -> ${to}` }],
|
|
548
|
-
isError: true,
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
552
|
-
}
|
|
553
|
-
);
|
|
554
|
-
|
|
555
|
-
// --- Fee Analysis ---
|
|
556
|
-
|
|
557
|
-
server.registerTool(
|
|
558
|
-
"fee_analysis",
|
|
559
|
-
{
|
|
560
|
-
title: "Fee Analysis",
|
|
561
|
-
description: "Analyze processor fees per provider for a given month. Shows gross, fees, and net per provider.",
|
|
562
|
-
inputSchema: {
|
|
563
|
-
month: z.string().describe("Month in YYYY-MM format"),
|
|
564
|
-
},
|
|
565
|
-
},
|
|
566
|
-
async ({ month }) => {
|
|
567
|
-
const result = feeAnalysis(month);
|
|
568
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
569
|
-
}
|
|
570
|
-
);
|
|
571
|
-
|
|
572
|
-
// --- Decline Analytics ---
|
|
573
|
-
|
|
574
|
-
server.registerTool(
|
|
575
|
-
"decline_analysis",
|
|
576
|
-
{
|
|
577
|
-
title: "Decline Analysis",
|
|
578
|
-
description: "Get decline analytics — groups failed payments by description/reason.",
|
|
579
|
-
inputSchema: {
|
|
580
|
-
provider: z.enum(["stripe", "square", "mercury", "manual"]).optional(),
|
|
581
|
-
},
|
|
582
|
-
},
|
|
583
|
-
async ({ provider }) => {
|
|
584
|
-
const report = declineReport(provider);
|
|
585
|
-
return { content: [{ type: "text", text: JSON.stringify(report, null, 2) }] };
|
|
586
|
-
}
|
|
587
|
-
);
|
|
588
|
-
|
|
589
|
-
// --- Dispute Evidence ---
|
|
590
|
-
|
|
591
|
-
server.registerTool(
|
|
592
|
-
"add_dispute_evidence",
|
|
593
|
-
{
|
|
594
|
-
title: "Add Dispute Evidence",
|
|
595
|
-
description: "Add evidence to an existing dispute. Appends to the evidence items array.",
|
|
596
|
-
inputSchema: {
|
|
597
|
-
dispute_id: z.string(),
|
|
598
|
-
description: z.string(),
|
|
599
|
-
file_ref: z.string().optional(),
|
|
600
|
-
},
|
|
601
|
-
},
|
|
602
|
-
async ({ dispute_id, description, file_ref }) => {
|
|
603
|
-
const dispute = addDisputeEvidence(dispute_id, description, file_ref);
|
|
604
|
-
if (!dispute) {
|
|
605
|
-
return {
|
|
606
|
-
content: [{ type: "text", text: `Dispute '${dispute_id}' not found.` }],
|
|
607
|
-
isError: true,
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
return { content: [{ type: "text", text: JSON.stringify(dispute, null, 2) }] };
|
|
611
|
-
}
|
|
612
|
-
);
|
|
613
|
-
|
|
614
|
-
// --- Payment Split ---
|
|
615
|
-
|
|
616
|
-
server.registerTool(
|
|
617
|
-
"split_payment",
|
|
618
|
-
{
|
|
619
|
-
title: "Split Payment",
|
|
620
|
-
description: "Record marketplace commission splits for a payment. Stores split percentages in payment metadata.",
|
|
621
|
-
inputSchema: {
|
|
622
|
-
payment_id: z.string(),
|
|
623
|
-
splits: z.record(z.number()).describe("Map of vendor name to percentage (e.g. {vendor1: 70, vendor2: 30})"),
|
|
624
|
-
},
|
|
625
|
-
},
|
|
626
|
-
async ({ payment_id, splits }) => {
|
|
627
|
-
const payment = splitPayment(payment_id, splits);
|
|
628
|
-
if (!payment) {
|
|
629
|
-
return {
|
|
630
|
-
content: [{ type: "text", text: `Payment '${payment_id}' not found.` }],
|
|
631
|
-
isError: true,
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
return { content: [{ type: "text", text: JSON.stringify(payment, null, 2) }] };
|
|
635
|
-
}
|
|
636
|
-
);
|
|
637
|
-
|
|
638
|
-
// --- Revenue Forecast ---
|
|
639
|
-
|
|
640
|
-
server.registerTool(
|
|
641
|
-
"revenue_forecast",
|
|
642
|
-
{
|
|
643
|
-
title: "Revenue Forecast",
|
|
644
|
-
description: "Project revenue for upcoming months based on last 3 months trend.",
|
|
645
|
-
inputSchema: {
|
|
646
|
-
months: z.number().describe("Number of months to forecast"),
|
|
647
|
-
},
|
|
648
|
-
},
|
|
649
|
-
async ({ months }) => {
|
|
650
|
-
const result = revenueForecast(months);
|
|
651
|
-
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
652
|
-
}
|
|
653
|
-
);
|
|
654
|
-
|
|
655
|
-
// --- Reconciliation Gaps ---
|
|
656
|
-
|
|
657
|
-
server.registerTool(
|
|
658
|
-
"reconciliation_gaps",
|
|
659
|
-
{
|
|
660
|
-
title: "Reconciliation Gaps",
|
|
661
|
-
description: "Find payments without invoice_id and invoice IDs without a succeeded payment in a date range.",
|
|
662
|
-
inputSchema: {
|
|
663
|
-
date_from: z.string(),
|
|
664
|
-
date_to: z.string(),
|
|
665
|
-
},
|
|
666
|
-
},
|
|
667
|
-
async ({ date_from, date_to }) => {
|
|
668
|
-
const gaps = findReconciliationGaps(date_from, date_to);
|
|
669
|
-
return { content: [{ type: "text", text: JSON.stringify(gaps, null, 2) }] };
|
|
670
|
-
}
|
|
671
|
-
);
|
|
672
|
-
|
|
673
|
-
// --- Start ---
|
|
674
|
-
async function main() {
|
|
675
|
-
const transport = new StdioServerTransport();
|
|
676
|
-
await server.connect(transport);
|
|
677
|
-
console.error("microservice-payments MCP server running on stdio");
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
main().catch((error) => {
|
|
681
|
-
console.error("Fatal error:", error);
|
|
682
|
-
process.exit(1);
|
|
683
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hasna/microservice-payroll",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"description": "Payroll management microservice with SQLite — manage employees, pay periods, pay stubs, and payments",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"microservice-payroll": "./src/cli/index.ts",
|
|
8
|
-
"microservice-payroll-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
|
-
}
|