@charisol/plexo-mcp 1.0.13 → 1.0.14
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/client/plexoClient.js +7 -0
- package/dist/formTools.js +48 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
- package/src/client/plexoClient.ts +9 -0
- package/src/formTools.ts +50 -0
- package/src/index.ts +3 -0
|
@@ -680,6 +680,13 @@ class PlexoClient {
|
|
|
680
680
|
return this.commerceFetch("POST", templateId, "/donations/adopt-monthly-donors", { campaignId });
|
|
681
681
|
}
|
|
682
682
|
// ── WordPress migration (/api/v1/wp-migration) ──────────────────────────────
|
|
683
|
+
/** Every form on a site and where its submissions go (MailDrip list, webhook). */
|
|
684
|
+
async getFormSettings(templateId) {
|
|
685
|
+
return this.apiFetch("GET", `/api/v1/templates/${encodeURIComponent(templateId)}/form-settings`, undefined, "Form settings");
|
|
686
|
+
}
|
|
687
|
+
async setFormDestinations(templateId, body) {
|
|
688
|
+
return this.apiFetch("PUT", `/api/v1/templates/${encodeURIComponent(templateId)}/form-settings`, body, "Form settings");
|
|
689
|
+
}
|
|
683
690
|
async previewWordPressMigration(sourceUrl) {
|
|
684
691
|
return this.apiFetch("POST", "/api/v1/wp-migration/detect", { sourceUrl }, "WordPress check");
|
|
685
692
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FORM_TOOL_NAMES = exports.FORM_TOOL_DEFS = void 0;
|
|
4
|
+
exports.handleFormToolCall = handleFormToolCall;
|
|
5
|
+
// Where a site's forms send submissions — same tools, same descriptions as the live
|
|
6
|
+
// connector in plexo-web (lib/mcp/formTools.ts), executed through plexo-web's REST API.
|
|
7
|
+
exports.FORM_TOOL_DEFS = [
|
|
8
|
+
{
|
|
9
|
+
name: "get_form_settings",
|
|
10
|
+
description: "Lists every form on a site and where its submissions go besides the Form Submissions inbox and the owner's email: a MailDrip list and/or a webhook (Zapier, Make, a CRM), plus a thank-you page and anything a migrated WordPress form did that Plexo doesn't repeat (note). Also says whether MailDrip is connected and lists the account's MailDrip lists (ids to use with set_form_destinations).",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: { templateId: { type: "string", description: "The site's home page id (see list_landing_pages)." } },
|
|
14
|
+
required: ["templateId"],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "set_form_destinations",
|
|
19
|
+
description: "Sets where one form sends each submission: maildripGroupId adds the person (email and name, taken from the submission) to that MailDrip list in the site's own MailDrip account — MailDrip must be connected first; webhookUrl POSTs every submission (https only). Pass null to stop one. Form names come from get_form_settings.",
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
templateId: { type: "string", description: "The site's home page id." },
|
|
24
|
+
formName: { type: "string", description: "Exactly as get_form_settings lists it." },
|
|
25
|
+
maildripGroupId: { type: ["string", "null"], description: "A list id from get_form_settings' maildrip.groups, or null to stop adding to a list." },
|
|
26
|
+
webhookUrl: { type: ["string", "null"], description: "https address to send each submission to, or null to stop." },
|
|
27
|
+
},
|
|
28
|
+
required: ["templateId", "formName"],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
exports.FORM_TOOL_NAMES = new Set(exports.FORM_TOOL_DEFS.map((t) => t.name));
|
|
33
|
+
async function handleFormToolCall(name, args, client) {
|
|
34
|
+
const templateId = typeof args?.templateId === "string" ? args.templateId.trim() : "";
|
|
35
|
+
if (!templateId)
|
|
36
|
+
throw new Error("templateId is required — pass the site's home page id (see list_landing_pages).");
|
|
37
|
+
if (name === "get_form_settings") {
|
|
38
|
+
const overview = await client.getFormSettings(templateId);
|
|
39
|
+
return {
|
|
40
|
+
...overview,
|
|
41
|
+
next: overview.maildrip?.connected
|
|
42
|
+
? "Use set_form_destinations to add a form's sign-ups to one of these MailDrip lists, or to send its submissions to a webhook."
|
|
43
|
+
: "MailDrip isn't connected for this site — the owner connects it from the Form Submissions page (Connect MailDrip). Webhooks work without it.",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const { form } = await client.setFormDestinations(templateId, { formName: String(args?.formName ?? ""), maildripGroupId: args?.maildripGroupId, webhookUrl: args?.webhookUrl });
|
|
47
|
+
return { form, next: "New submissions to this form go there from now on. Suggest the owner sends a test submission to check it arrives." };
|
|
48
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const commerceTools_js_1 = require("./commerceTools.js");
|
|
|
10
10
|
const lmsTools_js_1 = require("./lmsTools.js");
|
|
11
11
|
const donationTools_js_1 = require("./donationTools.js");
|
|
12
12
|
const wpMigrationTools_js_1 = require("./wpMigrationTools.js");
|
|
13
|
+
const formTools_js_1 = require("./formTools.js");
|
|
13
14
|
const server = new index_js_1.Server({
|
|
14
15
|
name: "plexo-mcp",
|
|
15
16
|
version: "1.0.0",
|
|
@@ -647,6 +648,7 @@ To edit a page's CONTENT (designJson), use update_template with the same templat
|
|
|
647
648
|
...lmsTools_js_1.LMS_TOOL_DEFS,
|
|
648
649
|
...donationTools_js_1.DONATION_TOOL_DEFS,
|
|
649
650
|
...wpMigrationTools_js_1.WP_MIGRATION_TOOL_DEFS,
|
|
651
|
+
...formTools_js_1.FORM_TOOL_DEFS,
|
|
650
652
|
],
|
|
651
653
|
};
|
|
652
654
|
});
|
|
@@ -926,6 +928,7 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
|
926
928
|
for (const [names, handler] of [
|
|
927
929
|
[donationTools_js_1.DONATION_TOOL_NAMES, donationTools_js_1.handleDonationToolCall],
|
|
928
930
|
[wpMigrationTools_js_1.WP_MIGRATION_TOOL_NAMES, wpMigrationTools_js_1.handleWpMigrationToolCall],
|
|
931
|
+
[formTools_js_1.FORM_TOOL_NAMES, formTools_js_1.handleFormToolCall],
|
|
929
932
|
]) {
|
|
930
933
|
if (names.has(name)) {
|
|
931
934
|
const result = await handler(name, args || {}, client);
|
package/package.json
CHANGED
|
@@ -843,6 +843,15 @@ export class PlexoClient {
|
|
|
843
843
|
|
|
844
844
|
// ── WordPress migration (/api/v1/wp-migration) ──────────────────────────────
|
|
845
845
|
|
|
846
|
+
/** Every form on a site and where its submissions go (MailDrip list, webhook). */
|
|
847
|
+
async getFormSettings(templateId: string): Promise<any> {
|
|
848
|
+
return this.apiFetch("GET", `/api/v1/templates/${encodeURIComponent(templateId)}/form-settings`, undefined, "Form settings");
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
async setFormDestinations(templateId: string, body: { formName: string; maildripGroupId?: string | null; webhookUrl?: string | null }): Promise<any> {
|
|
852
|
+
return this.apiFetch("PUT", `/api/v1/templates/${encodeURIComponent(templateId)}/form-settings`, body, "Form settings");
|
|
853
|
+
}
|
|
854
|
+
|
|
846
855
|
async previewWordPressMigration(sourceUrl: string): Promise<any> {
|
|
847
856
|
return this.apiFetch("POST", "/api/v1/wp-migration/detect", { sourceUrl }, "WordPress check");
|
|
848
857
|
}
|
package/src/formTools.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PlexoClient } from "./client/plexoClient.js";
|
|
2
|
+
|
|
3
|
+
// Where a site's forms send submissions — same tools, same descriptions as the live
|
|
4
|
+
// connector in plexo-web (lib/mcp/formTools.ts), executed through plexo-web's REST API.
|
|
5
|
+
|
|
6
|
+
export const FORM_TOOL_DEFS = [
|
|
7
|
+
{
|
|
8
|
+
name: "get_form_settings",
|
|
9
|
+
description:
|
|
10
|
+
"Lists every form on a site and where its submissions go besides the Form Submissions inbox and the owner's email: a MailDrip list and/or a webhook (Zapier, Make, a CRM), plus a thank-you page and anything a migrated WordPress form did that Plexo doesn't repeat (note). Also says whether MailDrip is connected and lists the account's MailDrip lists (ids to use with set_form_destinations).",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: { templateId: { type: "string", description: "The site's home page id (see list_landing_pages)." } },
|
|
14
|
+
required: ["templateId"],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "set_form_destinations",
|
|
19
|
+
description:
|
|
20
|
+
"Sets where one form sends each submission: maildripGroupId adds the person (email and name, taken from the submission) to that MailDrip list in the site's own MailDrip account — MailDrip must be connected first; webhookUrl POSTs every submission (https only). Pass null to stop one. Form names come from get_form_settings.",
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
templateId: { type: "string", description: "The site's home page id." },
|
|
25
|
+
formName: { type: "string", description: "Exactly as get_form_settings lists it." },
|
|
26
|
+
maildripGroupId: { type: ["string", "null"], description: "A list id from get_form_settings' maildrip.groups, or null to stop adding to a list." },
|
|
27
|
+
webhookUrl: { type: ["string", "null"], description: "https address to send each submission to, or null to stop." },
|
|
28
|
+
},
|
|
29
|
+
required: ["templateId", "formName"],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export const FORM_TOOL_NAMES = new Set(FORM_TOOL_DEFS.map((t) => t.name));
|
|
35
|
+
|
|
36
|
+
export async function handleFormToolCall(name: string, args: any, client: PlexoClient): Promise<any> {
|
|
37
|
+
const templateId = typeof args?.templateId === "string" ? args.templateId.trim() : "";
|
|
38
|
+
if (!templateId) throw new Error("templateId is required — pass the site's home page id (see list_landing_pages).");
|
|
39
|
+
if (name === "get_form_settings") {
|
|
40
|
+
const overview = await client.getFormSettings(templateId);
|
|
41
|
+
return {
|
|
42
|
+
...overview,
|
|
43
|
+
next: overview.maildrip?.connected
|
|
44
|
+
? "Use set_form_destinations to add a form's sign-ups to one of these MailDrip lists, or to send its submissions to a webhook."
|
|
45
|
+
: "MailDrip isn't connected for this site — the owner connects it from the Form Submissions page (Connect MailDrip). Webhooks work without it.",
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const { form } = await client.setFormDestinations(templateId, { formName: String(args?.formName ?? ""), maildripGroupId: args?.maildripGroupId, webhookUrl: args?.webhookUrl });
|
|
49
|
+
return { form, next: "New submissions to this form go there from now on. Suggest the owner sends a test submission to check it arrives." };
|
|
50
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { COMMERCE_TOOL_DEFS, COMMERCE_TOOL_NAMES, handleCommerceToolCall } from
|
|
|
12
12
|
import { LMS_TOOL_DEFS, LMS_TOOL_NAMES, handleLmsToolCall } from "./lmsTools.js";
|
|
13
13
|
import { DONATION_TOOL_DEFS, DONATION_TOOL_NAMES, handleDonationToolCall } from "./donationTools.js";
|
|
14
14
|
import { WP_MIGRATION_TOOL_DEFS, WP_MIGRATION_TOOL_NAMES, handleWpMigrationToolCall } from "./wpMigrationTools.js";
|
|
15
|
+
import { FORM_TOOL_DEFS, FORM_TOOL_NAMES, handleFormToolCall } from "./formTools.js";
|
|
15
16
|
|
|
16
17
|
const server = new Server(
|
|
17
18
|
{
|
|
@@ -654,6 +655,7 @@ To edit a page's CONTENT (designJson), use update_template with the same templat
|
|
|
654
655
|
...LMS_TOOL_DEFS,
|
|
655
656
|
...DONATION_TOOL_DEFS,
|
|
656
657
|
...WP_MIGRATION_TOOL_DEFS,
|
|
658
|
+
...FORM_TOOL_DEFS,
|
|
657
659
|
],
|
|
658
660
|
};
|
|
659
661
|
});
|
|
@@ -962,6 +964,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
962
964
|
for (const [names, handler] of [
|
|
963
965
|
[DONATION_TOOL_NAMES, handleDonationToolCall],
|
|
964
966
|
[WP_MIGRATION_TOOL_NAMES, handleWpMigrationToolCall],
|
|
967
|
+
[FORM_TOOL_NAMES, handleFormToolCall],
|
|
965
968
|
] as const) {
|
|
966
969
|
if (names.has(name)) {
|
|
967
970
|
const result = await handler(name, (args as any) || {}, client);
|