@expensebot/mcp-server-auth 0.6.24 → 0.6.26
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 +23 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/src/client.js +1 -1
- package/src/index.js +838 -129
- package/src/test.js +110 -4
package/src/test.js
CHANGED
|
@@ -27,9 +27,19 @@ const SERVER_PATH = path.join(__dirname, "index.js");
|
|
|
27
27
|
const EXPECTED_TOOL_COUNT = 60;
|
|
28
28
|
// Every stdio tool that advertises outputSchema (enumerated per tranche).
|
|
29
29
|
const OUTPUT_SCHEMA_TOOLS = [
|
|
30
|
+
"add_cash_expense",
|
|
31
|
+
"add_income",
|
|
32
|
+
"add_income_from_csv",
|
|
33
|
+
"add_income_from_file",
|
|
34
|
+
"add_mileage_entry",
|
|
30
35
|
"check_compliance",
|
|
31
36
|
"check_feature",
|
|
32
37
|
"check_tax_deductibility",
|
|
38
|
+
"correct_expenses",
|
|
39
|
+
"create_client_invoice",
|
|
40
|
+
"create_report",
|
|
41
|
+
"export_report",
|
|
42
|
+
"fix_compliance",
|
|
33
43
|
"get_accounting_integration_status",
|
|
34
44
|
"get_accounting_push_status",
|
|
35
45
|
"get_client_advance_balances",
|
|
@@ -51,13 +61,26 @@ const OUTPUT_SCHEMA_TOOLS = [
|
|
|
51
61
|
"get_spreadsheet_url",
|
|
52
62
|
"get_subscription_audit",
|
|
53
63
|
"get_trip_suggestions",
|
|
64
|
+
"group_expenses",
|
|
54
65
|
"list_categories",
|
|
55
66
|
"list_client_invoices",
|
|
56
67
|
"list_income_categories",
|
|
57
68
|
"list_reports",
|
|
58
69
|
"list_tags",
|
|
70
|
+
"mark_client_invoice_paid",
|
|
71
|
+
"parse_expense",
|
|
72
|
+
"prepare_client_invoice",
|
|
73
|
+
"process_gmail_receipts",
|
|
74
|
+
"request_accounting_integration",
|
|
75
|
+
"scan_gmail",
|
|
76
|
+
"scan_gmail_years",
|
|
59
77
|
"search_expenses",
|
|
60
78
|
"search_knowledge",
|
|
79
|
+
"send_report_to_accounting",
|
|
80
|
+
"share_report",
|
|
81
|
+
"submit_receipt",
|
|
82
|
+
"trace_document",
|
|
83
|
+
"update_expense",
|
|
61
84
|
"whatif_afford",
|
|
62
85
|
"whatif_client",
|
|
63
86
|
"whatif_tax_setaside",
|
|
@@ -140,6 +163,37 @@ const TRANCHE_2_RUNTIME_CASES = [
|
|
|
140
163
|
},
|
|
141
164
|
},
|
|
142
165
|
];
|
|
166
|
+
|
|
167
|
+
const TRANCHE_3_RUNTIME_CASES = [
|
|
168
|
+
{ toolName: "create_report", actionId: "create_report", args: {}, payload: { success: true, message: "Report created." } },
|
|
169
|
+
{ toolName: "request_accounting_integration", actionId: "request_accounting_integration", args: { packageName: "Example Books" }, payload: { success: true, duplicate: false, packageName: "Example Books", message: "Request recorded." } },
|
|
170
|
+
{ toolName: "share_report", actionId: "share_report", args: { reportId: "report_test", recipients: ["reviewer@example.com"] }, payload: { success: true, message: "Report shared.", sharedWith: ["reviewer@example.com"], recipientRole: "reviewer" } },
|
|
171
|
+
{ toolName: "fix_compliance", actionId: "correct_expenses", args: { operationId: "expense-bulk:correct_test", status: true }, payload: { success: true, status: "status", operationId: "expense-bulk:correct_test" } },
|
|
172
|
+
{ toolName: "submit_receipt", actionId: "submit_receipt", args: { filesToUpload: [{ filename: "receipt.jpg", mimeType: "image/jpeg" }] }, payload: { success: true, status: "upload_required", message: "Upload the file.", data: { signedUrl: "https://upload.example.test/file", uploadRef: "upload_test" } } },
|
|
173
|
+
{ toolName: "add_cash_expense", actionId: "add_cash_expense", args: { total: 12.5, date: "2026-09-09" }, payload: { success: true, message: "Expense added." } },
|
|
174
|
+
{ toolName: "parse_expense", actionId: "parse_expense", args: { text: "12.50 office supplies today" }, payload: { success: true, expenses: [], validationErrors: [], categoryNames: [] } },
|
|
175
|
+
{ toolName: "process_gmail_receipts", actionId: "process_gmail_receipts", args: { emailIds: ["message_test"] }, payload: { success: true, message: "Receipts queued.", processedItems: [] } },
|
|
176
|
+
{ toolName: "scan_gmail", actionId: "scan_gmail", args: {}, payload: { success: true, message: "Scan started.", status: "processing" } },
|
|
177
|
+
{ toolName: "add_mileage_entry", actionId: "add_mileage_entry", args: { distance: 10, purpose: "Client visit", date: "2026-09-09" }, payload: { success: true, message: "Mileage added." } },
|
|
178
|
+
{ toolName: "add_income", actionId: "add_income", args: { amount: 100, source: "Example", paymentMethod: "Bank", date: "2026-09-09" }, payload: { success: true, message: "Income added." } },
|
|
179
|
+
{ toolName: "add_income_from_file", actionId: "add_income_from_file", args: { confirm: true, previewId: "preview_file" }, payload: { success: true, confirmed: true, previewId: "preview_file", written: 1, deduped: 0, failed: 0, unattempted: 0, total: 1, message: "Income imported." } },
|
|
180
|
+
{ toolName: "add_income_from_csv", actionId: "add_income_from_csv", args: { confirm: true, previewId: "preview_csv" }, payload: { success: true, confirmed: true, previewId: "preview_csv", written: 1, deduped: 0, failed: 0, unattempted: 0, total: 1, message: "Income imported." } },
|
|
181
|
+
{ toolName: "send_report_to_accounting", actionId: "send_report_to_accounting", args: { provider: "zoho_books", reportId: "report_test" }, payload: { success: true, phase: "completed", provider: "zoho_books", proposalId: "proposal_test", reportId: "report_test", finalAnswer: "Report sent.", responseGuidance: "Return finalAnswer." } },
|
|
182
|
+
{ toolName: "trace_document", actionId: "trace_document", args: {}, payload: { success: true, type: "lineage_trace", message: "No events found.", data: { summary: { total: 0 }, events: [], filters: { days: 30 } } } },
|
|
183
|
+
{ toolName: "export_report", actionId: "export_report", args: { reportId: "report_test" }, payload: { success: true, report: { title: "Report", spreadsheetId: "sheet_test" }, urls: { view: "https://example.test/view", pdf: "https://example.test/pdf", report: "https://example.test/report" }, expiresAt: "2026-09-09T20:00:00.000Z", availableInReport: ["csv"], notes: "Short-lived link." } },
|
|
184
|
+
{ toolName: "scan_gmail_years", actionId: "scan_gmail_years", args: { years: [2025] }, payload: { success: true, message: "Preview ready.", preview: true, account: "account@example.com", eligible: [2025], alreadyScanned: [], notEligible: [] } },
|
|
185
|
+
{ toolName: "prepare_client_invoice", actionId: "prepare_client_invoice", args: { reportId: "report_test", clientName: "Example Client", issueDate: "2026-09-09" }, payload: { success: true, preparationId: "prep_test", expiresAt: "2026-09-09T20:00:00.000Z", preview: {} } },
|
|
186
|
+
{ toolName: "create_client_invoice", actionId: "create_client_invoice", args: { preparationId: "prep_test", operationId: "invoice_test" }, payload: { success: true, invoiceId: "invoice_test" } },
|
|
187
|
+
{ toolName: "mark_client_invoice_paid", actionId: "mark_client_invoice_paid", args: { invoiceId: "invoice_test", paidDate: "2026-09-09" }, payload: { success: true, invoiceId: "invoice_test", invoiceNumber: null, status: "paid", paidDate: "2026-09-09", paidAmount: null, paidVia: "manual", incomeRowCreated: false, message: "Invoice marked paid." } },
|
|
188
|
+
{ toolName: "group_expenses", actionId: "group_expenses", args: { operationId: "expense-bulk:group_test", status: true }, payload: { success: true, status: "status", operationId: "expense-bulk:group_test" } },
|
|
189
|
+
{ toolName: "update_expense", actionId: "update_expense", args: { expenseId: "receipt_test", fields: { category: "Office Supplies" } }, payload: { success: true, message: "Preview ready.", data: { applied: false, preview: true, expenseId: "receipt_test", diff: [], unmapped: [] } } },
|
|
190
|
+
{ toolName: "correct_expenses", actionId: "correct_expenses", args: { operationId: "expense-bulk:correct_test", status: true }, payload: { success: true, status: "status", operationId: "expense-bulk:correct_test" } },
|
|
191
|
+
];
|
|
192
|
+
|
|
193
|
+
const SCHEMA_RUNTIME_CASES = [
|
|
194
|
+
...TRANCHE_2_RUNTIME_CASES,
|
|
195
|
+
...TRANCHE_3_RUNTIME_CASES,
|
|
196
|
+
];
|
|
143
197
|
const REQUIRED_TOOLS = [
|
|
144
198
|
// v0.5.x
|
|
145
199
|
"search_expenses",
|
|
@@ -395,6 +449,39 @@ function check(label, ok, details = "") {
|
|
|
395
449
|
) &&
|
|
396
450
|
reportDetailsTool?.inputSchema?.required?.includes("userRequest")
|
|
397
451
|
);
|
|
452
|
+
// Since web commit c05493e19 the executor rejects a missing date for these
|
|
453
|
+
// two writes, so the schema must require it and must never imply a default.
|
|
454
|
+
const entryDateTools = ["add_mileage_entry", "add_income"].map((name) =>
|
|
455
|
+
tools.find((tool) => tool.name === name)
|
|
456
|
+
);
|
|
457
|
+
check(
|
|
458
|
+
"add_mileage_entry and add_income require an explicit date and never imply a default",
|
|
459
|
+
entryDateTools.every((tool) => {
|
|
460
|
+
const dateText = tool?.inputSchema?.properties?.date?.description || "";
|
|
461
|
+
return (
|
|
462
|
+
tool?.inputSchema?.required?.includes("date") &&
|
|
463
|
+
/\bRequired\b/.test(dateText) &&
|
|
464
|
+
!/default/i.test(dateText) &&
|
|
465
|
+
!/defaults? to today/i.test(tool?.description || "")
|
|
466
|
+
);
|
|
467
|
+
})
|
|
468
|
+
);
|
|
469
|
+
const receiptResultTool = tools.find(
|
|
470
|
+
(tool) => tool.name === "get_last_receipt_result"
|
|
471
|
+
);
|
|
472
|
+
check(
|
|
473
|
+
"get_last_receipt_result advertises the held_for_review verdict and heldForReview count",
|
|
474
|
+
receiptResultTool?.outputSchema?.properties?.verdict?.enum?.includes(
|
|
475
|
+
"held_for_review"
|
|
476
|
+
) &&
|
|
477
|
+
receiptResultTool?.outputSchema?.properties?.counts?.properties
|
|
478
|
+
?.heldForReview?.type === "integer" &&
|
|
479
|
+
!receiptResultTool?.outputSchema?.properties?.counts?.required?.includes(
|
|
480
|
+
"heldForReview"
|
|
481
|
+
) &&
|
|
482
|
+
/held_for_review/.test(receiptResultTool?.description || "") &&
|
|
483
|
+
/missing details or a possible duplicate/.test(receiptResultTool?.description || "")
|
|
484
|
+
);
|
|
398
485
|
check(
|
|
399
486
|
`tools/list count = ${EXPECTED_TOOL_COUNT}`,
|
|
400
487
|
tools.length === EXPECTED_TOOL_COUNT,
|
|
@@ -417,6 +504,24 @@ function check(label, ok, details = "") {
|
|
|
417
504
|
? `missing: ${missingOutputSchemas.join(", ")}`
|
|
418
505
|
: ""
|
|
419
506
|
);
|
|
507
|
+
const fixComplianceTool = tools.find(
|
|
508
|
+
(tool) => tool.name === "fix_compliance"
|
|
509
|
+
);
|
|
510
|
+
const canonicalCorrectionTool = tools.find(
|
|
511
|
+
(tool) => tool.name === "correct_expenses"
|
|
512
|
+
);
|
|
513
|
+
check(
|
|
514
|
+
"fix_compliance shares the reviewed exact-correction contract",
|
|
515
|
+
JSON.stringify(fixComplianceTool?.inputSchema) ===
|
|
516
|
+
JSON.stringify(canonicalCorrectionTool?.inputSchema) &&
|
|
517
|
+
JSON.stringify(fixComplianceTool?.outputSchema) ===
|
|
518
|
+
JSON.stringify(canonicalCorrectionTool?.outputSchema) &&
|
|
519
|
+
!Object.prototype.hasOwnProperty.call(
|
|
520
|
+
fixComplianceTool?.inputSchema?.properties || {},
|
|
521
|
+
"reportId"
|
|
522
|
+
) &&
|
|
523
|
+
/grounded preview/i.test(fixComplianceTool?.description || "")
|
|
524
|
+
);
|
|
420
525
|
// Every tool must have a description
|
|
421
526
|
const noDesc = tools.filter((t) => !t.description);
|
|
422
527
|
check(
|
|
@@ -619,7 +724,7 @@ function check(label, ok, details = "") {
|
|
|
619
724
|
return res.end(JSON.stringify({ success: false }));
|
|
620
725
|
}
|
|
621
726
|
|
|
622
|
-
const runtimeCase =
|
|
727
|
+
const runtimeCase = SCHEMA_RUNTIME_CASES.find(
|
|
623
728
|
(entry) => entry.actionId === parsed.actionId
|
|
624
729
|
);
|
|
625
730
|
if (runtimeCase) {
|
|
@@ -662,7 +767,7 @@ function check(label, ok, details = "") {
|
|
|
662
767
|
arguments: { query: "how it works" },
|
|
663
768
|
},
|
|
664
769
|
},
|
|
665
|
-
...
|
|
770
|
+
...SCHEMA_RUNTIME_CASES.map((runtimeCase, index) => ({
|
|
666
771
|
jsonrpc: "2.0",
|
|
667
772
|
id: 20 + index,
|
|
668
773
|
method: "tools/call",
|
|
@@ -713,7 +818,7 @@ function check(label, ok, details = "") {
|
|
|
713
818
|
)
|
|
714
819
|
);
|
|
715
820
|
|
|
716
|
-
for (const [index, runtimeCase] of
|
|
821
|
+
for (const [index, runtimeCase] of SCHEMA_RUNTIME_CASES.entries()) {
|
|
717
822
|
const result = authenticatedResponses.find(
|
|
718
823
|
(response) => response.id === 20 + index
|
|
719
824
|
)?.result;
|
|
@@ -722,7 +827,8 @@ function check(label, ok, details = "") {
|
|
|
722
827
|
result?.isError !== true &&
|
|
723
828
|
JSON.stringify(result?.structuredContent) ===
|
|
724
829
|
JSON.stringify(runtimeCase.payload) &&
|
|
725
|
-
(
|
|
830
|
+
(!runtimeCase.payload.message ||
|
|
831
|
+
(result?.content?.[0]?.text || "").includes(runtimeCase.payload.message))
|
|
726
832
|
);
|
|
727
833
|
}
|
|
728
834
|
|