@migma/mcp 1.1.2 → 1.3.1
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/build/client.d.ts.map +1 -1
- package/build/client.js +3 -1
- package/build/client.js.map +1 -1
- package/build/config.d.ts.map +1 -1
- package/build/config.js +22 -4
- package/build/config.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +14 -11
- package/build/index.js.map +1 -1
- package/build/permissions.d.ts +2 -0
- package/build/permissions.d.ts.map +1 -0
- package/build/permissions.js +17 -0
- package/build/permissions.js.map +1 -0
- package/build/prompts/index.d.ts.map +1 -1
- package/build/prompts/index.js +4 -3
- package/build/prompts/index.js.map +1 -1
- package/build/tools/__tests__/catalog.test.js +20 -9
- package/build/tools/__tests__/catalog.test.js.map +1 -1
- package/build/tools/campaigns.d.ts +1 -1
- package/build/tools/campaigns.d.ts.map +1 -1
- package/build/tools/campaigns.js +244 -222
- package/build/tools/campaigns.js.map +1 -1
- package/build/tools/capabilities.d.ts.map +1 -1
- package/build/tools/capabilities.js +14 -5
- package/build/tools/capabilities.js.map +1 -1
- package/build/tools/contacts.d.ts +1 -1
- package/build/tools/contacts.d.ts.map +1 -1
- package/build/tools/contacts.js +356 -156
- package/build/tools/contacts.js.map +1 -1
- package/build/tools/domains.d.ts +1 -1
- package/build/tools/domains.d.ts.map +1 -1
- package/build/tools/domains.js +98 -96
- package/build/tools/domains.js.map +1 -1
- package/build/tools/export.d.ts +1 -1
- package/build/tools/export.d.ts.map +1 -1
- package/build/tools/export.js +97 -78
- package/build/tools/export.js.map +1 -1
- package/build/tools/generate.d.ts +1 -1
- package/build/tools/generate.d.ts.map +1 -1
- package/build/tools/generate.js +217 -109
- package/build/tools/generate.js.map +1 -1
- package/build/tools/metrics.d.ts +4 -0
- package/build/tools/metrics.d.ts.map +1 -0
- package/build/tools/metrics.js +39 -0
- package/build/tools/metrics.js.map +1 -0
- package/build/tools/projects.d.ts +1 -1
- package/build/tools/projects.d.ts.map +1 -1
- package/build/tools/projects.js +95 -77
- package/build/tools/projects.js.map +1 -1
- package/build/tools/segments.d.ts +1 -1
- package/build/tools/segments.d.ts.map +1 -1
- package/build/tools/segments.js +91 -67
- package/build/tools/segments.js.map +1 -1
- package/build/tools/send.d.ts +1 -1
- package/build/tools/send.d.ts.map +1 -1
- package/build/tools/send.js +72 -69
- package/build/tools/send.js.map +1 -1
- package/build/tools/tags.d.ts +1 -1
- package/build/tools/tags.d.ts.map +1 -1
- package/build/tools/tags.js +77 -69
- package/build/tools/tags.js.map +1 -1
- package/build/tools/validate.d.ts +1 -1
- package/build/tools/validate.d.ts.map +1 -1
- package/build/tools/validate.js +54 -44
- package/build/tools/validate.js.map +1 -1
- package/build/tools/webhooks.d.ts +1 -1
- package/build/tools/webhooks.d.ts.map +1 -1
- package/build/tools/webhooks.js +67 -57
- package/build/tools/webhooks.js.map +1 -1
- package/package.json +2 -2
package/build/tools/domains.js
CHANGED
|
@@ -1,103 +1,105 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
description: "Create an instant managed sending domain (no DNS setup required). The domain will be <prefix>.migma.email.",
|
|
15
|
-
inputSchema: z.object({
|
|
16
|
-
prefix: z
|
|
17
|
-
.string()
|
|
18
|
-
.describe("Domain prefix (e.g. 'mycompany' → mycompany.migma.email)"),
|
|
19
|
-
}),
|
|
20
|
-
}, async (args) => {
|
|
21
|
-
const { data, error } = await client.domains.createManaged({
|
|
22
|
-
prefix: args.prefix,
|
|
2
|
+
import { canUse } from "../permissions.js";
|
|
3
|
+
export function registerDomainTools(server, client, grantedPermissions) {
|
|
4
|
+
if (canUse(grantedPermissions, ["domain:read"])) {
|
|
5
|
+
server.registerTool("migma_list_domains", {
|
|
6
|
+
title: "List Domains",
|
|
7
|
+
description: "List all sending domains (both custom and managed).",
|
|
8
|
+
annotations: { readOnlyHint: true },
|
|
9
|
+
}, async () => {
|
|
10
|
+
const { data, error } = await client.domains.list();
|
|
11
|
+
if (error)
|
|
12
|
+
return toolError(error.message);
|
|
13
|
+
return toolResult(data);
|
|
23
14
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
title: "Provision Stream Identity",
|
|
42
|
-
description: "Provision a transactional or marketing sending identity on a domain you own. Creates notify.<rootDomain> (transactional) or send.<rootDomain> (marketing) to isolate transactional reputation from marketing. Returns DNS records to publish.",
|
|
43
|
-
inputSchema: z.object({
|
|
44
|
-
rootDomain: z
|
|
45
|
-
.string()
|
|
46
|
-
.describe("The apex domain you own, e.g. 'acme.com'"),
|
|
47
|
-
stream: z
|
|
48
|
-
.enum(["transactional", "marketing"])
|
|
49
|
-
.describe("transactional → notify.<domain>; marketing → send.<domain>"),
|
|
50
|
-
region: z
|
|
51
|
-
.enum(["us-east-1", "eu-west-1"])
|
|
52
|
-
.optional()
|
|
53
|
-
.describe("AWS region. Defaults to us-east-1."),
|
|
54
|
-
vanityRootFrom: z
|
|
55
|
-
.boolean()
|
|
56
|
-
.optional()
|
|
57
|
-
.describe("Show the apex domain in the From header when DMARC passes."),
|
|
58
|
-
}),
|
|
59
|
-
}, async (args) => {
|
|
60
|
-
const { data, error } = await client.domains.provisionStream({
|
|
61
|
-
rootDomain: args.rootDomain,
|
|
62
|
-
stream: args.stream,
|
|
63
|
-
region: args.region,
|
|
64
|
-
vanityRootFrom: args.vanityRootFrom,
|
|
15
|
+
}
|
|
16
|
+
if (canUse(grantedPermissions, ["domain:write"])) {
|
|
17
|
+
server.registerTool("migma_create_managed_domain", {
|
|
18
|
+
title: "Create Managed Domain",
|
|
19
|
+
description: "Create an instant managed sending domain (no DNS setup required). The domain will be <prefix>.migma.email.",
|
|
20
|
+
inputSchema: z.object({
|
|
21
|
+
prefix: z
|
|
22
|
+
.string()
|
|
23
|
+
.describe("Domain prefix (e.g. 'mycompany' → mycompany.migma.email)"),
|
|
24
|
+
}),
|
|
25
|
+
}, async (args) => {
|
|
26
|
+
const { data, error } = await client.domains.createManaged({
|
|
27
|
+
prefix: args.prefix,
|
|
28
|
+
});
|
|
29
|
+
if (error)
|
|
30
|
+
return toolError(error.message);
|
|
31
|
+
return toolResult(data);
|
|
65
32
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
.optional()
|
|
80
|
-
.describe("AWS region. Defaults to us-east-1."),
|
|
81
|
-
fromName: z
|
|
82
|
-
.string()
|
|
83
|
-
.optional()
|
|
84
|
-
.describe("Default From display name for the provisioned identities."),
|
|
85
|
-
vanityRootFrom: z
|
|
86
|
-
.boolean()
|
|
87
|
-
.optional()
|
|
88
|
-
.describe("Show the apex domain in the From header when DMARC passes. Defaults to true."),
|
|
89
|
-
}),
|
|
90
|
-
}, async (args) => {
|
|
91
|
-
const { data, error } = await client.domains.setup({
|
|
92
|
-
rootDomain: args.rootDomain,
|
|
93
|
-
region: args.region,
|
|
94
|
-
fromName: args.fromName,
|
|
95
|
-
vanityRootFrom: args.vanityRootFrom,
|
|
33
|
+
}
|
|
34
|
+
if (canUse(grantedPermissions, ["domain:write"])) {
|
|
35
|
+
server.registerTool("migma_verify_domain", {
|
|
36
|
+
title: "Verify Domain",
|
|
37
|
+
description: "Verify DNS records for a custom sending domain.",
|
|
38
|
+
inputSchema: z.object({
|
|
39
|
+
domain: z.string().describe("The domain to verify (e.g. mail.yourbrand.com)"),
|
|
40
|
+
}),
|
|
41
|
+
}, async (args) => {
|
|
42
|
+
const { data, error } = await client.domains.verify(args.domain);
|
|
43
|
+
if (error)
|
|
44
|
+
return toolError(error.message);
|
|
45
|
+
return toolResult(data);
|
|
96
46
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
47
|
+
}
|
|
48
|
+
if (canUse(grantedPermissions, ["domain:write"])) {
|
|
49
|
+
server.registerTool("migma_provision_stream", {
|
|
50
|
+
title: "Provision Stream Identity",
|
|
51
|
+
description: "Provision a transactional or marketing sending identity on a domain you own. Creates notify.<rootDomain> (transactional) or send.<rootDomain> (marketing) to isolate transactional reputation from marketing. Returns DNS records to publish.",
|
|
52
|
+
inputSchema: z.object({
|
|
53
|
+
rootDomain: z
|
|
54
|
+
.string()
|
|
55
|
+
.describe("The apex domain you own, e.g. 'acme.com'"),
|
|
56
|
+
stream: z
|
|
57
|
+
.enum(["transactional", "marketing"])
|
|
58
|
+
.describe("transactional → notify.<domain>; marketing → send.<domain>"),
|
|
59
|
+
vanityRootFrom: z
|
|
60
|
+
.boolean()
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("Show the apex domain in the From header when DMARC passes."),
|
|
63
|
+
}),
|
|
64
|
+
}, async (args) => {
|
|
65
|
+
const { data, error } = await client.domains.provisionStream({
|
|
66
|
+
rootDomain: args.rootDomain,
|
|
67
|
+
stream: args.stream,
|
|
68
|
+
vanityRootFrom: args.vanityRootFrom,
|
|
69
|
+
});
|
|
70
|
+
if (error)
|
|
71
|
+
return toolError(error.message);
|
|
72
|
+
return toolResult(data);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (canUse(grantedPermissions, ["domain:write"])) {
|
|
76
|
+
server.registerTool("migma_setup_domain", {
|
|
77
|
+
title: "Set Up Domain (Both Streams)",
|
|
78
|
+
description: "Provision BOTH sending identities on a domain you own in one call: send.<rootDomain> (marketing) and notify.<rootDomain> (transactional), isolating transactional reputation from marketing. Idempotent. Returns DNS records for both identities.",
|
|
79
|
+
inputSchema: z.object({
|
|
80
|
+
rootDomain: z
|
|
81
|
+
.string()
|
|
82
|
+
.describe("The apex domain you own, e.g. 'acme.com'"),
|
|
83
|
+
fromName: z
|
|
84
|
+
.string()
|
|
85
|
+
.optional()
|
|
86
|
+
.describe("Default From display name for the provisioned identities."),
|
|
87
|
+
vanityRootFrom: z
|
|
88
|
+
.boolean()
|
|
89
|
+
.optional()
|
|
90
|
+
.describe("Show the apex domain in the From header when DMARC passes. Defaults to true."),
|
|
91
|
+
}),
|
|
92
|
+
}, async (args) => {
|
|
93
|
+
const { data, error } = await client.domains.setup({
|
|
94
|
+
rootDomain: args.rootDomain,
|
|
95
|
+
fromName: args.fromName,
|
|
96
|
+
vanityRootFrom: args.vanityRootFrom,
|
|
97
|
+
});
|
|
98
|
+
if (error)
|
|
99
|
+
return toolError(error.message);
|
|
100
|
+
return toolResult(data);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
101
103
|
}
|
|
102
104
|
function toolResult(data) {
|
|
103
105
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domains.js","sourceRoot":"","sources":["../../src/tools/domains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"domains.js","sourceRoot":"","sources":["../../src/tools/domains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,UAAU,mBAAmB,CACjC,MAAiB,EACjB,MAAa,EACb,kBAA6B;IAE7B,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;QAChD,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;YACE,KAAK,EAAE,cAAc;YACrB,WAA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CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QACnD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
package/build/tools/export.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { Migma } from "migma";
|
|
3
|
-
export declare function registerExportTools(server: McpServer, client: Migma): void;
|
|
3
|
+
export declare function registerExportTools(server: McpServer, client: Migma, grantedPermissions?: string[]): void;
|
|
4
4
|
//# sourceMappingURL=export.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/tools/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/tools/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAInC,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,KAAK,EACb,kBAAkB,CAAC,EAAE,MAAM,EAAE,QAkI9B"}
|
package/build/tools/export.js
CHANGED
|
@@ -1,83 +1,102 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
description: "Export a generated email as MJML markup.",
|
|
18
|
-
inputSchema: z.object({
|
|
19
|
-
conversationId: z.string().describe("The conversation/generation ID"),
|
|
20
|
-
}),
|
|
21
|
-
}, async (args) => {
|
|
22
|
-
const { data, error } = await client.export.mjml(args.conversationId);
|
|
23
|
-
if (error)
|
|
24
|
-
return toolError(error.message);
|
|
25
|
-
return toolResult(data);
|
|
26
|
-
});
|
|
27
|
-
server.registerTool("migma_export_pdf", {
|
|
28
|
-
title: "Export as PDF",
|
|
29
|
-
description: "Export a generated email as a PDF document.",
|
|
30
|
-
inputSchema: z.object({
|
|
31
|
-
conversationId: z.string().describe("The conversation/generation ID"),
|
|
32
|
-
}),
|
|
33
|
-
}, async (args) => {
|
|
34
|
-
const { data, error } = await client.export.pdf(args.conversationId);
|
|
35
|
-
if (error)
|
|
36
|
-
return toolError(error.message);
|
|
37
|
-
return toolResult(data);
|
|
38
|
-
});
|
|
39
|
-
server.registerTool("migma_export_klaviyo", {
|
|
40
|
-
title: "Export for Klaviyo",
|
|
41
|
-
description: "Export a generated email in Klaviyo-compatible format. Choose between HTML, hybrid, or code export types.",
|
|
42
|
-
inputSchema: z.object({
|
|
43
|
-
conversationId: z.string().describe("The conversation/generation ID"),
|
|
44
|
-
type: z
|
|
45
|
-
.enum(["html", "hybrid", "code"])
|
|
46
|
-
.optional()
|
|
47
|
-
.describe("Klaviyo export type (default: html)"),
|
|
48
|
-
}),
|
|
49
|
-
}, async (args) => {
|
|
50
|
-
const { data, error } = await client.export.klaviyo(args.conversationId, args.type);
|
|
51
|
-
if (error)
|
|
52
|
-
return toolError(error.message);
|
|
53
|
-
return toolResult(data);
|
|
54
|
-
});
|
|
55
|
-
server.registerTool("migma_export_mailchimp", {
|
|
56
|
-
title: "Export for Mailchimp",
|
|
57
|
-
description: "Export a generated email in Mailchimp-compatible format.",
|
|
58
|
-
inputSchema: z.object({
|
|
59
|
-
conversationId: z.string().describe("The conversation/generation ID"),
|
|
60
|
-
}),
|
|
61
|
-
}, async (args) => {
|
|
62
|
-
const { data, error } = await client.export.mailchimp(args.conversationId);
|
|
63
|
-
if (error)
|
|
64
|
-
return toolError(error.message);
|
|
65
|
-
return toolResult(data);
|
|
66
|
-
});
|
|
67
|
-
server.registerTool("migma_export_hubspot", {
|
|
68
|
-
title: "Export for HubSpot",
|
|
69
|
-
description: "Export a generated email in HubSpot-compatible format.",
|
|
70
|
-
inputSchema: z.object({
|
|
71
|
-
conversationId: z.string().describe("The conversation/generation ID"),
|
|
72
|
-
}),
|
|
73
|
-
}, async (args) => {
|
|
74
|
-
const { data, error } = await client.export.hubspot({
|
|
75
|
-
conversationId: args.conversationId,
|
|
2
|
+
import { canUse } from "../permissions.js";
|
|
3
|
+
export function registerExportTools(server, client, grantedPermissions) {
|
|
4
|
+
if (canUse(grantedPermissions, ["email:read"])) {
|
|
5
|
+
server.registerTool("migma_export_html", {
|
|
6
|
+
title: "Export as HTML",
|
|
7
|
+
description: "Export a generated email as production-ready HTML. Returns a download URL.",
|
|
8
|
+
annotations: { readOnlyHint: true },
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
conversationId: z.string().describe("The conversation/generation ID"),
|
|
11
|
+
}),
|
|
12
|
+
}, async (args) => {
|
|
13
|
+
const { data, error } = await client.export.html(args.conversationId);
|
|
14
|
+
if (error)
|
|
15
|
+
return toolError(error.message);
|
|
16
|
+
return toolResult(data);
|
|
76
17
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
18
|
+
}
|
|
19
|
+
if (canUse(grantedPermissions, ["email:read"])) {
|
|
20
|
+
server.registerTool("migma_export_mjml", {
|
|
21
|
+
title: "Export as MJML",
|
|
22
|
+
description: "Export a generated email as MJML markup.",
|
|
23
|
+
annotations: { readOnlyHint: true },
|
|
24
|
+
inputSchema: z.object({
|
|
25
|
+
conversationId: z.string().describe("The conversation/generation ID"),
|
|
26
|
+
}),
|
|
27
|
+
}, async (args) => {
|
|
28
|
+
const { data, error } = await client.export.mjml(args.conversationId);
|
|
29
|
+
if (error)
|
|
30
|
+
return toolError(error.message);
|
|
31
|
+
return toolResult(data);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (canUse(grantedPermissions, ["email:read"])) {
|
|
35
|
+
server.registerTool("migma_export_pdf", {
|
|
36
|
+
title: "Export as PDF",
|
|
37
|
+
description: "Export a generated email as a PDF document.",
|
|
38
|
+
annotations: { readOnlyHint: true },
|
|
39
|
+
inputSchema: z.object({
|
|
40
|
+
conversationId: z.string().describe("The conversation/generation ID"),
|
|
41
|
+
}),
|
|
42
|
+
}, async (args) => {
|
|
43
|
+
const { data, error } = await client.export.pdf(args.conversationId);
|
|
44
|
+
if (error)
|
|
45
|
+
return toolError(error.message);
|
|
46
|
+
return toolResult(data);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (canUse(grantedPermissions, ["email:read"])) {
|
|
50
|
+
server.registerTool("migma_export_klaviyo", {
|
|
51
|
+
title: "Export for Klaviyo",
|
|
52
|
+
description: "Export a generated email in Klaviyo-compatible format. Choose between HTML, hybrid, or code export types.",
|
|
53
|
+
annotations: { readOnlyHint: true },
|
|
54
|
+
inputSchema: z.object({
|
|
55
|
+
conversationId: z.string().describe("The conversation/generation ID"),
|
|
56
|
+
type: z
|
|
57
|
+
.enum(["html", "hybrid", "code"])
|
|
58
|
+
.optional()
|
|
59
|
+
.describe("Klaviyo export type (default: html)"),
|
|
60
|
+
}),
|
|
61
|
+
}, async (args) => {
|
|
62
|
+
const { data, error } = await client.export.klaviyo(args.conversationId, args.type);
|
|
63
|
+
if (error)
|
|
64
|
+
return toolError(error.message);
|
|
65
|
+
return toolResult(data);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (canUse(grantedPermissions, ["email:read"])) {
|
|
69
|
+
server.registerTool("migma_export_mailchimp", {
|
|
70
|
+
title: "Export for Mailchimp",
|
|
71
|
+
description: "Export a generated email in Mailchimp-compatible format.",
|
|
72
|
+
annotations: { readOnlyHint: true },
|
|
73
|
+
inputSchema: z.object({
|
|
74
|
+
conversationId: z.string().describe("The conversation/generation ID"),
|
|
75
|
+
}),
|
|
76
|
+
}, async (args) => {
|
|
77
|
+
const { data, error } = await client.export.mailchimp(args.conversationId);
|
|
78
|
+
if (error)
|
|
79
|
+
return toolError(error.message);
|
|
80
|
+
return toolResult(data);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (canUse(grantedPermissions, ["email:read"])) {
|
|
84
|
+
server.registerTool("migma_export_hubspot", {
|
|
85
|
+
title: "Export for HubSpot",
|
|
86
|
+
description: "Export a generated email in HubSpot-compatible format.",
|
|
87
|
+
annotations: { readOnlyHint: true },
|
|
88
|
+
inputSchema: z.object({
|
|
89
|
+
conversationId: z.string().describe("The conversation/generation ID"),
|
|
90
|
+
}),
|
|
91
|
+
}, async (args) => {
|
|
92
|
+
const { data, error } = await client.export.hubspot({
|
|
93
|
+
conversationId: args.conversationId,
|
|
94
|
+
});
|
|
95
|
+
if (error)
|
|
96
|
+
return toolError(error.message);
|
|
97
|
+
return toolResult(data);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
81
100
|
}
|
|
82
101
|
function toolResult(data) {
|
|
83
102
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/tools/export.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/tools/export.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,UAAU,mBAAmB,CACjC,MAAiB,EACjB,MAAa,EACb,kBAA6B;IAE7B,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;QAC/C,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;YACE,KAAK,EAAE,gBAAgB;YACvB,WAAW,EACT,4E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AE,EAAE;YACb,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;gBAClD,cAAc,EAAE,IAAI,CAAC,cAAc;aACpC,CAAC,CAAC;YACH,IAAI,KAAK;gBAAE,OAAO,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC3C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC,CACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,IAAa;IAC/B,OAAO;QACL,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;SAC/D;KACF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,OAAe;IAChC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QACnD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { Migma } from "migma";
|
|
3
3
|
import type { Config } from "../config.js";
|
|
4
|
-
export declare function registerGenerateTools(server: McpServer, client: Migma, config: Config): void;
|
|
4
|
+
export declare function registerGenerateTools(server: McpServer, client: Migma, config: Config, grantedPermissions?: string[]): void;
|
|
5
5
|
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/tools/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/tools/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAU3C,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,MAAM,EACd,kBAAkB,CAAC,EAAE,MAAM,EAAE,QA+Q9B"}
|