@mgsoftwarebv/mcp-server-bridge 3.5.10 → 3.5.11
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/dist/index.js +30 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -103467,7 +103467,9 @@ var customerRecurringServices = pgTable(
|
|
|
103467
103467
|
mode: "string"
|
|
103468
103468
|
}),
|
|
103469
103469
|
// --- Lifecycle ---
|
|
103470
|
-
// "active" | "paused" | "cancelled" | "ended"
|
|
103470
|
+
// "draft" | "active" | "paused" | "cancelled" | "ended"
|
|
103471
|
+
// "draft" = created but not yet activated (e.g. via MCP); excluded from
|
|
103472
|
+
// all billing/due queries until a human activates it in the dashboard.
|
|
103471
103473
|
status: text().$type().default("active").notNull(),
|
|
103472
103474
|
startDate: timestamp("start_date", { withTimezone: true, mode: "string" }),
|
|
103473
103475
|
// Planned end of the agreement (before cancellation/ended).
|
|
@@ -107490,7 +107492,7 @@ var TOOLS = [
|
|
|
107490
107492
|
customerId: { type: "string", description: "Filter by customer UUID" },
|
|
107491
107493
|
status: {
|
|
107492
107494
|
type: "string",
|
|
107493
|
-
enum: ["active", "paused", "cancelled", "ended"],
|
|
107495
|
+
enum: ["draft", "active", "paused", "cancelled", "ended"],
|
|
107494
107496
|
description: "Filter by agreement status"
|
|
107495
107497
|
}
|
|
107496
107498
|
}
|
|
@@ -107498,7 +107500,7 @@ var TOOLS = [
|
|
|
107498
107500
|
},
|
|
107499
107501
|
{
|
|
107500
107502
|
name: "create-customer-agreement",
|
|
107501
|
-
description: "Create a customer-specific product agreement
|
|
107503
|
+
description: "Create a customer-specific product agreement as a DRAFT. Snapshots price, discount, clause and invoice line text without mutating the catalog product. Drafts are never invoiced; a human activates them in the dashboard. A draft can still be edited via update-customer-agreement, but once activated it is locked for MCP writes.",
|
|
107502
107504
|
inputSchema: {
|
|
107503
107505
|
type: "object",
|
|
107504
107506
|
properties: {
|
|
@@ -107534,7 +107536,7 @@ var TOOLS = [
|
|
|
107534
107536
|
},
|
|
107535
107537
|
{
|
|
107536
107538
|
name: "update-customer-agreement",
|
|
107537
|
-
description: "Update
|
|
107539
|
+
description: "Update a customer product agreement by id. Allowed ONLY while it is a DRAFT; once activated it is locked and this tool returns an error. It cannot change status (activation is a dashboard action) and there is no delete tool by design.",
|
|
107538
107540
|
inputSchema: {
|
|
107539
107541
|
type: "object",
|
|
107540
107542
|
properties: {
|
|
@@ -107555,11 +107557,7 @@ var TOOLS = [
|
|
|
107555
107557
|
startDate: { type: "string" },
|
|
107556
107558
|
endDate: { type: "string" },
|
|
107557
107559
|
contractPeriodEnd: { type: "string" },
|
|
107558
|
-
proRataFirstInvoice: { type: "boolean" }
|
|
107559
|
-
status: {
|
|
107560
|
-
type: "string",
|
|
107561
|
-
enum: ["active", "paused", "cancelled", "ended"]
|
|
107562
|
-
}
|
|
107560
|
+
proRataFirstInvoice: { type: "boolean" }
|
|
107563
107561
|
},
|
|
107564
107562
|
required: ["id"]
|
|
107565
107563
|
}
|
|
@@ -108853,16 +108851,33 @@ async function handleCreateCustomerAgreement(input) {
|
|
|
108853
108851
|
endDate: input.endDate ?? null,
|
|
108854
108852
|
contractPeriodEnd: input.contractPeriodEnd ?? null,
|
|
108855
108853
|
proRataFirstInvoice: input.proRataFirstInvoice ?? false,
|
|
108856
|
-
|
|
108854
|
+
// MCP-created agreements start as a draft; a human activates them in the
|
|
108855
|
+
// dashboard. Drafts are excluded from every billing/due query.
|
|
108856
|
+
status: "draft"
|
|
108857
108857
|
}).returning();
|
|
108858
|
-
return textResponse2(
|
|
108858
|
+
return textResponse2(
|
|
108859
|
+
`Created customer agreement as **draft**. It will not be invoiced until a human activates it in the dashboard. You can keep editing it via update-customer-agreement while it stays a draft.
|
|
108859
108860
|
|
|
108860
|
-
${formatAgreement(row)}`
|
|
108861
|
+
${formatAgreement(row)}`
|
|
108862
|
+
);
|
|
108861
108863
|
}
|
|
108862
108864
|
async function handleUpdateCustomerAgreement(input) {
|
|
108863
108865
|
const scope = await resolveTeamScope(input.teamId);
|
|
108864
108866
|
if (!scope.ok) return scope.response;
|
|
108865
|
-
const
|
|
108867
|
+
const [existing] = await db.select().from(schema_exports.customerRecurringServices).where(
|
|
108868
|
+
and(
|
|
108869
|
+
eq(schema_exports.customerRecurringServices.id, input.id),
|
|
108870
|
+
inArray(schema_exports.customerRecurringServices.teamId, scope.teamIds)
|
|
108871
|
+
)
|
|
108872
|
+
).limit(1);
|
|
108873
|
+
if (!existing) {
|
|
108874
|
+
return textResponse2("Agreement not found.");
|
|
108875
|
+
}
|
|
108876
|
+
if (existing.status !== "draft") {
|
|
108877
|
+
return textResponse2(
|
|
108878
|
+
`This agreement is '${existing.status}' and is locked: only drafts can be edited via MCP. Activation and any change to a live agreement happen in the dashboard.`
|
|
108879
|
+
);
|
|
108880
|
+
}
|
|
108866
108881
|
const patch = {
|
|
108867
108882
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
108868
108883
|
};
|
|
@@ -108886,17 +108901,16 @@ async function handleUpdateCustomerAgreement(input) {
|
|
|
108886
108901
|
patch.contractPeriodEnd = input.contractPeriodEnd;
|
|
108887
108902
|
if (input.proRataFirstInvoice !== void 0)
|
|
108888
108903
|
patch.proRataFirstInvoice = input.proRataFirstInvoice;
|
|
108889
|
-
if (input.status !== void 0) patch.status = input.status;
|
|
108890
108904
|
const [row] = await db.update(schema_exports.customerRecurringServices).set(patch).where(
|
|
108891
108905
|
and(
|
|
108892
108906
|
eq(schema_exports.customerRecurringServices.id, input.id),
|
|
108893
|
-
|
|
108907
|
+
inArray(schema_exports.customerRecurringServices.teamId, scope.teamIds)
|
|
108894
108908
|
)
|
|
108895
108909
|
).returning();
|
|
108896
108910
|
if (!row) {
|
|
108897
108911
|
return textResponse2("Agreement not found.");
|
|
108898
108912
|
}
|
|
108899
|
-
return textResponse2(`Updated
|
|
108913
|
+
return textResponse2(`Updated draft agreement:
|
|
108900
108914
|
|
|
108901
108915
|
${formatAgreement(row)}`);
|
|
108902
108916
|
}
|