@netsendo/mcp-client 1.5.0 → 1.6.0
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 +126 -3
- package/dist/api-client.d.ts +10 -0
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +20 -1
- package/dist/api-client.js.map +1 -1
- package/dist/config.d.ts +1 -9
- package/dist/config.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/tools/automations.d.ts +12 -0
- package/dist/tools/automations.d.ts.map +1 -0
- package/dist/tools/automations.js +184 -0
- package/dist/tools/automations.js.map +1 -0
- package/dist/tools/campaign-extras.d.ts +175 -0
- package/dist/tools/campaign-extras.d.ts.map +1 -0
- package/dist/tools/campaign-extras.js +283 -0
- package/dist/tools/campaign-extras.js.map +1 -0
- package/dist/tools/campaigns.d.ts.map +1 -1
- package/dist/tools/campaigns.js +81 -93
- package/dist/tools/campaigns.js.map +1 -1
- package/dist/tools/custom-fields.d.ts +12 -0
- package/dist/tools/custom-fields.d.ts.map +1 -0
- package/dist/tools/custom-fields.js +94 -0
- package/dist/tools/custom-fields.js.map +1 -0
- package/dist/tools/forms.d.ts +10 -0
- package/dist/tools/forms.d.ts.map +1 -0
- package/dist/tools/forms.js +163 -0
- package/dist/tools/forms.js.map +1 -0
- package/dist/tools/funnels.d.ts.map +1 -1
- package/dist/tools/funnels.js +20 -8
- package/dist/tools/funnels.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +16 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/list-import.js +4 -4
- package/dist/tools/list-import.js.map +1 -1
- package/dist/tools/lists.d.ts.map +1 -1
- package/dist/tools/lists.js +206 -97
- package/dist/tools/lists.js.map +1 -1
- package/dist/tools/notifications.js +1 -1
- package/dist/tools/notifications.js.map +1 -1
- package/dist/tools/subscribers.js +2 -2
- package/dist/tools/subscribers.js.map +1 -1
- package/dist/tools/system-content.d.ts +12 -0
- package/dist/tools/system-content.d.ts.map +1 -0
- package/dist/tools/system-content.js +150 -0
- package/dist/tools/system-content.js.map +1 -0
- package/dist/tools/tags.d.ts +11 -0
- package/dist/tools/tags.d.ts.map +1 -0
- package/dist/tools/tags.js +61 -0
- package/dist/tools/tags.js.map +1 -0
- package/dist/tools/templates.d.ts +10 -0
- package/dist/tools/templates.d.ts.map +1 -0
- package/dist/tools/templates.js +294 -0
- package/dist/tools/templates.js.map +1 -0
- package/dist/tools/webhooks.d.ts +11 -0
- package/dist/tools/webhooks.d.ts.map +1 -0
- package/dist/tools/webhooks.js +130 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/types.d.ts +18 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - System Emails & System Pages Tools
|
|
3
|
+
*
|
|
4
|
+
* The automatic emails (double opt-in, welcome, unsubscribe confirmations,
|
|
5
|
+
* owner notification) and the pages shown at the end of signup / activation /
|
|
6
|
+
* unsubscribe / preference flows. Each slug has one instance-wide GLOBAL
|
|
7
|
+
* default and optional per-list OVERRIDES (copy-on-write).
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { ok, fail, compact } from './helpers.js';
|
|
11
|
+
const COPY_ON_WRITE = `How overrides work (copy-on-write):
|
|
12
|
+
- Without list_id you work on the GLOBAL default (used by every list without its own version). Editing globals requires the account admin's API key (team members get 403).
|
|
13
|
+
- With list_id you work on that list: reads return the list's override if it exists (source="list", is_custom=true), otherwise the global (source="global"). The first update for a list creates the override (fields you omit are copied from the global); later updates edit it. reset_* removes the override so the list falls back to the global.
|
|
14
|
+
- Records are addressed by slug + optional list_id; responses also carry the row id and global_id.
|
|
15
|
+
- Content is HTML and is stored as sent (no sanitising), exactly like the panel editor. Permissions: lists:read to read, lists:write to change.`;
|
|
16
|
+
const EMAIL_SLUGS = `System email slugs:
|
|
17
|
+
- signup_confirmation — double opt-in email sent right after signup; MUST contain [[activation-link]]
|
|
18
|
+
- activation_confirmation — sent after the subscriber clicked the activation link
|
|
19
|
+
- subscription_welcome — welcome email after a signup without confirmation (single opt-in)
|
|
20
|
+
- already_active_resubscribe — an active subscriber signed up again
|
|
21
|
+
- inactive_resubscribe — an inactive/unsubscribed contact signed up again
|
|
22
|
+
- preference_confirm — confirm a preference change; MUST contain [[confirm-link]] (if switched off a built-in text is sent instead)
|
|
23
|
+
- data_edit_access — link to edit subscription data; uses [[edit-link]]
|
|
24
|
+
- unsubscribe_request — confirm an unsubscribe request; MUST contain [[unsubscribe-link]] (if switched off a built-in text is sent instead)
|
|
25
|
+
- unsubscribed_confirmation — sent after unsubscribing; may use [[resubscribe-link]]
|
|
26
|
+
- new_subscriber_notification — sent to the LIST OWNER (not the subscriber) on each signup
|
|
27
|
+
- activation_email, welcome_email — legacy, not sent by current flows
|
|
28
|
+
Placeholders in every system email (subject and body): [[list-name]], [[email]], [[first-name]]/[[fname]], [[!fname]] (Polish vocative), [[last-name]]/[[lname]], [[phone]], [[date]], plus custom fields and {{male|female}} forms (see get_system_email → placeholders.available).`;
|
|
29
|
+
const PAGE_SLUGS = `System page slugs:
|
|
30
|
+
- signup_success — after a successful form signup
|
|
31
|
+
- signup_exists / signup_exists_active / signup_exists_inactive — address already on the list (generic / active / still waiting for activation)
|
|
32
|
+
- signup_error — form signup failed
|
|
33
|
+
- activation_success / activation_error — activation link valid / invalid or expired
|
|
34
|
+
- unsubscribe_confirm — confirmation step before unsubscribing; uses [[unsubscribe-link]]
|
|
35
|
+
- unsubscribe_confirm_sent — after the unsubscribe confirmation email was sent
|
|
36
|
+
- unsubscribe_success / unsubscribe_error
|
|
37
|
+
- preference_confirm_sent / preference_update_success — preference change submitted / confirmed
|
|
38
|
+
Pages may use [[list-name]] and the subscriber placeholders ([[email]], [[fname]], custom fields...).`;
|
|
39
|
+
const listIdField = z.number().int().positive().optional()
|
|
40
|
+
.describe('Contact list ID. Omit to work on the global default.');
|
|
41
|
+
const slugField = (kind) => z.string().regex(/^[A-Za-z0-9_-]+$/)
|
|
42
|
+
.describe(`${kind} slug, e.g. from list_${kind.replace(' ', '_')}s`);
|
|
43
|
+
async function call(promise) {
|
|
44
|
+
try {
|
|
45
|
+
return ok(await promise);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
return fail(error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function registerSystemContentTools(server, api) {
|
|
52
|
+
// ---------------------------------------------------------------- emails
|
|
53
|
+
server.tool('list_system_emails', `List the automatic system emails (double opt-in, welcome, unsubscribe confirmation, owner notification...) as seen by one list, or the global defaults.
|
|
54
|
+
|
|
55
|
+
Each item: id, slug, name, description (what triggers it), subject, is_active, source ("list" = this list's own override, "global" = inherited default), is_custom, contact_list_id, global_id. Body content is omitted unless include_content=true — call get_system_email for one email with its body and placeholders.
|
|
56
|
+
|
|
57
|
+
${EMAIL_SLUGS}
|
|
58
|
+
|
|
59
|
+
${COPY_ON_WRITE}`, {
|
|
60
|
+
list_id: listIdField,
|
|
61
|
+
include_content: z.boolean().optional().describe('Include the HTML body of every email (default: false)'),
|
|
62
|
+
}, async ({ list_id, include_content }) => call(api.request('get', '/system-emails', {
|
|
63
|
+
params: compact({ list_id, include_content: include_content ? 1 : undefined }),
|
|
64
|
+
})));
|
|
65
|
+
server.tool('get_system_email', `Get one system email (subject, HTML content, is_active) as resolved for a list — its override if it has one, else the global default — plus placeholders: for_this_slug (links only this email receives, e.g. [[activation-link]]), built_in (always available) and available (all standard, system and custom-field placeholders of the account). Call this before update_system_email so you edit the current text.
|
|
66
|
+
|
|
67
|
+
${EMAIL_SLUGS}`, {
|
|
68
|
+
slug: slugField('system email'),
|
|
69
|
+
list_id: listIdField,
|
|
70
|
+
}, async ({ slug, list_id }) => call(api.request('get', `/system-emails/${encodeURIComponent(slug)}`, {
|
|
71
|
+
params: compact({ list_id }),
|
|
72
|
+
})));
|
|
73
|
+
server.tool('update_system_email', `Change a system email's subject, HTML content and/or is_active. Send only the fields you want to change.
|
|
74
|
+
|
|
75
|
+
With list_id: the first call creates that list's override (status 201, meta.created_override=true; omitted fields are copied from the global), later calls edit it. Without list_id: edits the GLOBAL default for all lists without an override — account admin only, and globals cannot be switched off (is_active=false without list_id is rejected).
|
|
76
|
+
|
|
77
|
+
Keep the required link placeholder of the slug (signup_confirmation → [[activation-link]], unsubscribe_request → [[unsubscribe-link]], preference_confirm → [[confirm-link]], data_edit_access → [[edit-link]]), otherwise subscribers cannot complete the flow.
|
|
78
|
+
|
|
79
|
+
${COPY_ON_WRITE}`, {
|
|
80
|
+
slug: slugField('system email'),
|
|
81
|
+
list_id: listIdField,
|
|
82
|
+
subject: z.string().max(255).optional().describe('Email subject; placeholders allowed'),
|
|
83
|
+
content: z.string().optional().describe('Full HTML body; stored as sent'),
|
|
84
|
+
is_active: z.boolean().optional().describe('Only with list_id: false stops sending this email for that list'),
|
|
85
|
+
}, async ({ slug, ...body }) => call(api.request('put', `/system-emails/${encodeURIComponent(slug)}`, {
|
|
86
|
+
data: compact(body),
|
|
87
|
+
})));
|
|
88
|
+
server.tool('set_system_email_active', `Switch one system email on or off for ONE list (e.g. stop sending unsubscribed_confirmation or new_subscriber_notification for a list). Creates the list override from the global default if the list has none. Global defaults always stay active, so list_id is required. To bring back the global text and state entirely, use reset_system_email instead.
|
|
89
|
+
|
|
90
|
+
Note: unsubscribe_request and preference_confirm are confirmations the flow needs — switching them off makes NetSendo send a built-in fallback text, not nothing.`, {
|
|
91
|
+
slug: slugField('system email'),
|
|
92
|
+
list_id: z.number().int().positive().describe('Contact list ID (required)'),
|
|
93
|
+
is_active: z.boolean().describe('true = send this email for the list, false = do not send it'),
|
|
94
|
+
}, async ({ slug, list_id, is_active }) => call(api.request('put', `/system-emails/${encodeURIComponent(slug)}/active`, {
|
|
95
|
+
data: { list_id, is_active },
|
|
96
|
+
})));
|
|
97
|
+
server.tool('reset_system_email', `Delete a list's override of a system email so the list uses the global default again (subject, content and active state). list_id is required — global defaults cannot be deleted. Returns the global the list now uses; meta.deleted=false means the list had no override.`, {
|
|
98
|
+
slug: slugField('system email'),
|
|
99
|
+
list_id: z.number().int().positive().describe('Contact list ID (required)'),
|
|
100
|
+
}, async ({ slug, list_id }) => call(api.request('delete', `/system-emails/${encodeURIComponent(slug)}`, {
|
|
101
|
+
params: { list_id },
|
|
102
|
+
})));
|
|
103
|
+
// ----------------------------------------------------------------- pages
|
|
104
|
+
server.tool('list_system_pages', `List the system pages — the HTML pages NetSendo shows subscribers at the end of signup, activation, unsubscribe and preference flows — as seen by one list, or the global defaults.
|
|
105
|
+
|
|
106
|
+
Each item: id, slug, name, description (when it is shown), title, access (public/private), url, source ("list" | "global"), is_custom, contact_list_id, global_id. Content is omitted unless include_content=true.
|
|
107
|
+
|
|
108
|
+
${PAGE_SLUGS}
|
|
109
|
+
|
|
110
|
+
${COPY_ON_WRITE}`, {
|
|
111
|
+
list_id: listIdField,
|
|
112
|
+
include_content: z.boolean().optional().describe('Include the HTML body of every page (default: false)'),
|
|
113
|
+
}, async ({ list_id, include_content }) => call(api.request('get', '/system-pages', {
|
|
114
|
+
params: compact({ list_id, include_content: include_content ? 1 : undefined }),
|
|
115
|
+
})));
|
|
116
|
+
server.tool('get_system_page', `Get one system page (title, HTML content, access, url) as resolved for a list — its override if present, else the global — plus placeholders (for_this_slug, built_in, available). Call this before update_system_page.
|
|
117
|
+
|
|
118
|
+
NetSendo displays these pages automatically at the end of its flows; "url" is the address the panel shows for the page.
|
|
119
|
+
|
|
120
|
+
${PAGE_SLUGS}`, {
|
|
121
|
+
slug: slugField('system page'),
|
|
122
|
+
list_id: listIdField,
|
|
123
|
+
}, async ({ slug, list_id }) => call(api.request('get', `/system-pages/${encodeURIComponent(slug)}`, {
|
|
124
|
+
params: compact({ list_id }),
|
|
125
|
+
})));
|
|
126
|
+
server.tool('update_system_page', `Change a system page's title, HTML content, access and (list overrides only) slug. Send only the fields you want to change.
|
|
127
|
+
|
|
128
|
+
With list_id: the first call creates the list's override (201, meta.created_override=true; omitted fields copied from the global), later calls edit it. Without list_id: edits the GLOBAL default — account admin only; a global's slug can never change.
|
|
129
|
+
|
|
130
|
+
slug: avoid changing it. The signup/activation/unsubscribe flows look pages up by their standard slug, so a renamed override is no longer shown — the list then gets the global default (meta.warnings says so). After a rename, address the page by its new slug.
|
|
131
|
+
|
|
132
|
+
${COPY_ON_WRITE}`, {
|
|
133
|
+
slug: slugField('system page'),
|
|
134
|
+
list_id: listIdField,
|
|
135
|
+
title: z.string().max(255).optional().describe('Page title (browser tab / heading); placeholders allowed'),
|
|
136
|
+
content: z.string().optional().describe('Full HTML body; stored as sent'),
|
|
137
|
+
access: z.enum(['public', 'private']).optional().describe('Visibility flag kept with the page (default: copied from the global, usually public)'),
|
|
138
|
+
new_slug: z.string().regex(/^[A-Za-z0-9_-]+$/).max(100).optional()
|
|
139
|
+
.describe('Only with list_id: rename the list override (letters, digits, - and _). Usually leave unset.'),
|
|
140
|
+
}, async ({ slug, new_slug, ...body }) => call(api.request('put', `/system-pages/${encodeURIComponent(slug)}`, {
|
|
141
|
+
data: compact({ ...body, slug: new_slug }),
|
|
142
|
+
})));
|
|
143
|
+
server.tool('reset_system_page', `Delete a list's override of a system page so the list uses the global default again. list_id is required — global defaults cannot be deleted. Returns the global the list now uses; meta.deleted=false means the list had no override.`, {
|
|
144
|
+
slug: slugField('system page'),
|
|
145
|
+
list_id: z.number().int().positive().describe('Contact list ID (required)'),
|
|
146
|
+
}, async ({ slug, list_id }) => call(api.request('delete', `/system-pages/${encodeURIComponent(slug)}`, {
|
|
147
|
+
params: { list_id },
|
|
148
|
+
})));
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=system-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-content.js","sourceRoot":"","sources":["../../src/tools/system-content.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,M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AAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;aAC/D,QAAQ,CAAC,8FAA8F,CAAC;KAC5G,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CACpC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAwB,KAAK,EAAE,iBAAiB,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE;QAC1F,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;KAC3C,CAAC,CAAC,CACN,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,wOAAwO,EACxO;QACE,IAAI,EAAE,SAAS,CAAC,aAAa,CAAC;QAC9B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;KAC5E,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAC1B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAwB,QAAQ,EAAE,iBAAiB,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE;QAC7F,MAAM,EAAE,EAAE,OAAO,EAAE;KACpB,CAAC,CAAC,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - Tag Tools
|
|
3
|
+
*
|
|
4
|
+
* Create, rename/recolour and delete tags. Listing lives in lists.ts
|
|
5
|
+
* (list_tags); assigning tags to people is sync_subscriber_tags /
|
|
6
|
+
* tag_list_members.
|
|
7
|
+
*/
|
|
8
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
|
+
import type { NetSendoApiClient } from '../api-client.js';
|
|
10
|
+
export declare function registerTagTools(server: McpServer, api: NetSendoApiClient): void;
|
|
11
|
+
//# sourceMappingURL=tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/tools/tags.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAiB1D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,iBAAiB,QA4DzE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - Tag Tools
|
|
3
|
+
*
|
|
4
|
+
* Create, rename/recolour and delete tags. Listing lives in lists.ts
|
|
5
|
+
* (list_tags); assigning tags to people is sync_subscriber_tags /
|
|
6
|
+
* tag_list_members.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { compact, fail, ok } from './helpers.js';
|
|
10
|
+
const color = z
|
|
11
|
+
.string()
|
|
12
|
+
.regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/)
|
|
13
|
+
.describe('Hex colour shown in the panel, e.g. "#22c55e" (default "#3b82f6")');
|
|
14
|
+
export function registerTagTools(server, api) {
|
|
15
|
+
server.tool('create_tag', `Create a tag in the account. Tag names are unique per account (a duplicate is rejected with 422) — call list_tags first to reuse an existing one.
|
|
16
|
+
|
|
17
|
+
Tags are referenced BY NAME elsewhere: sync_subscriber_tags / tag_list_members assign them, funnels can start on tag_added (trigger_tag) and check tag_exists, automations react to subscriber.tag_added. Requires the lists:write permission.`, {
|
|
18
|
+
name: z.string().min(1).max(255).describe('Tag name, e.g. "vip" or "webinar-2026-10"'),
|
|
19
|
+
color: color.optional(),
|
|
20
|
+
description: z.string().max(1000).optional().describe('What the tag means (shown in the panel)'),
|
|
21
|
+
}, async (input) => {
|
|
22
|
+
try {
|
|
23
|
+
const res = await api.request('post', '/tags', { data: compact(input) });
|
|
24
|
+
return ok({ success: true, message: res.message, tag: res.data });
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return fail(error);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
server.tool('update_tag', `Rename a tag or change its colour / description. Only the fields you pass are changed. Renaming keeps it on every subscriber, but funnels, automations and conditions that refer to the OLD name are not rewritten — check them after a rename. Requires lists:write.`, {
|
|
31
|
+
tag_id: z.number().int().describe('Tag ID (from list_tags)'),
|
|
32
|
+
name: z.string().min(1).max(255).optional().describe('New name (must stay unique in the account)'),
|
|
33
|
+
color: color.optional(),
|
|
34
|
+
description: z.string().max(1000).nullable().optional().describe('New description; null clears it'),
|
|
35
|
+
}, async ({ tag_id, ...changes }) => {
|
|
36
|
+
try {
|
|
37
|
+
const res = await api.request('patch', `/tags/${tag_id}`, { data: compact(changes) });
|
|
38
|
+
return ok({ success: true, message: res.message, tag: res.data });
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return fail(error);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
server.tool('delete_tag', `Delete a tag. It is removed from every subscriber, contact list and message that carries it; the subscribers themselves stay. No webhooks or automations fire for this removal.
|
|
45
|
+
|
|
46
|
+
If the tag is still assigned to subscribers the API answers 409 with subscribers_count — tell the user how many people carry it and re-run with confirm=true only after they approve. Requires lists:write.`, {
|
|
47
|
+
tag_id: z.number().int().describe('Tag ID (from list_tags)'),
|
|
48
|
+
confirm: z.boolean().optional().describe('Set true to delete a tag that is still assigned to subscribers'),
|
|
49
|
+
}, async ({ tag_id, confirm }) => {
|
|
50
|
+
try {
|
|
51
|
+
const res = await api.request('delete', `/tags/${tag_id}`, {
|
|
52
|
+
params: confirm ? { confirm: 1 } : undefined,
|
|
53
|
+
});
|
|
54
|
+
return ok({ success: true, ...res });
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
return fail(error, 'The tag is still assigned to subscribers. Tell the user how many, and re-run with confirm=true once they approve.');
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/tools/tags.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAWjD,MAAM,KAAK,GAAG,CAAC;KACZ,MAAM,EAAE;KACR,KAAK,CAAC,sCAAsC,CAAC;KAC7C,QAAQ,CAAC,mEAAmE,CAAC,CAAC;AAEjF,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,GAAsB;IACxE,MAAM,CAAC,IAAI,CACT,YAAY,EACZ;;+OAE2O,EAC3O;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,2CAA2C,CAAC;QACtF,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;QACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;KACjG,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,OAAO,CAAoC,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC5G,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QACpE,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AC,yBAAyB,CAAC;QAC5D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gEAAgE,CAAC;KAC3G,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;QAC5B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,OAAO,CAA0B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE;gBAClF,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;aAC7C,CAAC,CAAC;YACH,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,KAAK,EAAE,mHAAmH,CAAC,CAAC;QAC1I,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - Email Template Tools
|
|
3
|
+
*
|
|
4
|
+
* Tools for listing, reading, creating, editing, duplicating and previewing
|
|
5
|
+
* email templates, their categories, and the visual builder's saved blocks.
|
|
6
|
+
*/
|
|
7
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
|
+
import type { NetSendoApiClient } from '../api-client.js';
|
|
9
|
+
export declare function registerTemplateTools(server: McpServer, api: NetSendoApiClient): void;
|
|
10
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/tools/templates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AA0F1D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,iBAAiB,QAsS9E"}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - Email Template Tools
|
|
3
|
+
*
|
|
4
|
+
* Tools for listing, reading, creating, editing, duplicating and previewing
|
|
5
|
+
* email templates, their categories, and the visual builder's saved blocks.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { ok, fail, compact } from './helpers.js';
|
|
9
|
+
const BLOCK_TYPES = [
|
|
10
|
+
'header',
|
|
11
|
+
'text',
|
|
12
|
+
'image',
|
|
13
|
+
'button',
|
|
14
|
+
'divider',
|
|
15
|
+
'spacer',
|
|
16
|
+
'columns',
|
|
17
|
+
'product',
|
|
18
|
+
'product_grid',
|
|
19
|
+
'social',
|
|
20
|
+
'footer',
|
|
21
|
+
];
|
|
22
|
+
const TEMPLATE_TYPES = ['email', 'insert', 'signature'];
|
|
23
|
+
const blockSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
id: z.string().optional().describe('Block id; generated when omitted'),
|
|
26
|
+
type: z.enum(BLOCK_TYPES).describe('Block type (see list_template_block_types)'),
|
|
27
|
+
content: z.record(z.string(), z.unknown()).optional().describe('Block content, e.g. text: {html}, button: {text, href, backgroundColor}'),
|
|
28
|
+
settings: z.record(z.string(), z.unknown()).optional().describe('Block style settings (backgroundColor, padding, margin, borderRadius)'),
|
|
29
|
+
})
|
|
30
|
+
.passthrough();
|
|
31
|
+
const jsonStructureSchema = z
|
|
32
|
+
.object({
|
|
33
|
+
blocks: z.array(blockSchema).describe('Ordered builder blocks, top to bottom'),
|
|
34
|
+
})
|
|
35
|
+
.passthrough();
|
|
36
|
+
const templateFields = {
|
|
37
|
+
description: z.string().max(255).nullable().optional().describe('Internal description'),
|
|
38
|
+
preheader: z.string().max(500).nullable().optional().describe('Inbox preview text; placeholders allowed'),
|
|
39
|
+
type: z
|
|
40
|
+
.enum(TEMPLATE_TYPES)
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("'email' (default) = full email template; 'insert' / 'signature' = reusable HTML snippets shown in the editor's Inserts menu"),
|
|
43
|
+
content: z
|
|
44
|
+
.string()
|
|
45
|
+
.nullable()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe('Full email HTML (inline CSS, table layout recommended). This is what the message editor loads when the template is chosen. Pass null to clear it so the builder blocks are used instead'),
|
|
48
|
+
content_plain: z.string().nullable().optional().describe('Optional plain-text version'),
|
|
49
|
+
json_structure: jsonStructureSchema
|
|
50
|
+
.nullable()
|
|
51
|
+
.optional()
|
|
52
|
+
.describe('Visual-builder structure {blocks: [...]}. MJML is regenerated from it on save. Only needed if the template should be editable block-by-block in the drag & drop builder'),
|
|
53
|
+
settings: z
|
|
54
|
+
.record(z.string(), z.unknown())
|
|
55
|
+
.nullable()
|
|
56
|
+
.optional()
|
|
57
|
+
.describe('Builder global settings: width (600), background_color, content_background, font_family, primary_color, secondary_color, text_color, link_color'),
|
|
58
|
+
category_id: z.number().nullable().optional().describe('Category ID from list_template_categories'),
|
|
59
|
+
category: z.string().max(50).nullable().optional().describe('Category slug (filled automatically from category_id)'),
|
|
60
|
+
};
|
|
61
|
+
const USAGE_NOTE = `HOW A TEMPLATE IS USED IN A CAMPAIGN:
|
|
62
|
+
A campaign sends its own 'content', not the template. To build a campaign from a template, call get_template and pass its 'html' as 'content' (and 'preheader') to create_campaign / update_campaign. Builder-only templates (editor='builder', html=null) only have MJML, which the panel compiles in the browser — for API use prefer HTML templates (set 'content').
|
|
63
|
+
|
|
64
|
+
PLACEHOLDERS (call list_placeholders for the account's custom fields):
|
|
65
|
+
[[first_name]]/[[fname]], [[last_name]], [[email]], [[phone]], [[!fname]] (Polish vocative), [[unsubscribe_link]] (always include), [[unsubscribe_global]], [[manage]], custom fields as [[field_name]], gender forms {{male|female}}.`;
|
|
66
|
+
export function registerTemplateTools(server, api) {
|
|
67
|
+
// ---------------------------------------------------------------------
|
|
68
|
+
// Templates
|
|
69
|
+
// ---------------------------------------------------------------------
|
|
70
|
+
server.tool('list_templates', `List email templates: the account's own templates plus the read-only system starter templates.
|
|
71
|
+
|
|
72
|
+
Each item: id, name, description, preheader, type, category, category_id, is_system, editable, editor ('html' = has HTML content, 'builder' = drag & drop blocks only, 'empty'), has_html, has_blocks, updated_at. Use get_template for the full HTML / builder structure.
|
|
73
|
+
|
|
74
|
+
Filters: search (name/description), category (slug, e.g. newsletter, promotional, transactional, ecommerce, welcome, notification), category_id, source ('own' | 'system' | 'all', default all), type ('email' default | 'insert' | 'signature' | 'all').`, {
|
|
75
|
+
search: z.string().optional().describe('Search in name and description'),
|
|
76
|
+
category: z.string().optional().describe('Category slug'),
|
|
77
|
+
category_id: z.number().optional().describe('Category ID (list_template_categories)'),
|
|
78
|
+
source: z.enum(['own', 'system', 'all']).optional().describe("'own', 'system' (starter templates) or 'all' (default)"),
|
|
79
|
+
type: z.enum([...TEMPLATE_TYPES, 'all']).optional().describe("Template type (default 'email')"),
|
|
80
|
+
page: z.number().min(1).optional().describe('Page number (default 1)'),
|
|
81
|
+
per_page: z.number().min(1).max(100).optional().describe('Results per page (1-100, default 25)'),
|
|
82
|
+
}, async (params) => {
|
|
83
|
+
try {
|
|
84
|
+
const result = await api.request('get', '/templates', {
|
|
85
|
+
params: compact(params),
|
|
86
|
+
});
|
|
87
|
+
return ok({
|
|
88
|
+
templates: result.data.map((t) => ({
|
|
89
|
+
id: t.id,
|
|
90
|
+
name: t.name,
|
|
91
|
+
description: t.description,
|
|
92
|
+
type: t.type,
|
|
93
|
+
category: t.category,
|
|
94
|
+
category_id: t.category_id,
|
|
95
|
+
is_system: t.is_system,
|
|
96
|
+
editable: t.editable,
|
|
97
|
+
editor: t.editor,
|
|
98
|
+
updated_at: t.updated_at,
|
|
99
|
+
})),
|
|
100
|
+
pagination: {
|
|
101
|
+
page: result.meta.current_page,
|
|
102
|
+
total_pages: result.meta.last_page,
|
|
103
|
+
total: result.meta.total,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
return fail(error);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
server.tool('get_template', `Get one template with its full body: 'html' (the HTML content, or null for builder-only templates), 'mjml' (generated from the builder blocks), 'json_structure' (builder blocks), 'settings' (with defaults), preheader, category, is_system/editable and used_by_messages (own campaigns that reference it).
|
|
112
|
+
|
|
113
|
+
${USAGE_NOTE}`, {
|
|
114
|
+
template_id: z.number().describe('Template ID'),
|
|
115
|
+
}, async ({ template_id }) => {
|
|
116
|
+
try {
|
|
117
|
+
const result = await api.request('get', `/templates/${template_id}`);
|
|
118
|
+
return ok(result.data);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
return fail(error);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
server.tool('create_template', `Create an email template in the account.
|
|
125
|
+
|
|
126
|
+
Usually send 'content' = complete email HTML (inline CSS, 600px table layout). Such a template is used as-is by the campaign editor; note the drag & drop builder only edits block templates, so an HTML template opened in the builder shows an empty canvas — keep editing HTML templates with update_template.
|
|
127
|
+
Alternatively send 'json_structure' = {blocks: [{type, content, settings}]} to create a builder template (see list_template_block_types for block types and their default content); MJML is generated automatically. If both are sent, 'content' takes precedence in the campaign editor.
|
|
128
|
+
|
|
129
|
+
${USAGE_NOTE}`, {
|
|
130
|
+
name: z.string().max(255).describe('Template name'),
|
|
131
|
+
...templateFields,
|
|
132
|
+
}, async (params) => {
|
|
133
|
+
try {
|
|
134
|
+
const result = await api.request('post', '/templates', { data: compact(params) });
|
|
135
|
+
return ok(result.data);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
return fail(error);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
server.tool('update_template', `Update an own template (partial update — only the fields you pass change). System starter templates are read-only: call duplicate_template first and edit the copy.
|
|
142
|
+
|
|
143
|
+
Sending json_structure or settings regenerates the MJML. Sending content: null removes the HTML so the builder blocks are used again. Campaigns that were already created from this template keep their own copy of the content and are not changed.`, {
|
|
144
|
+
template_id: z.number().describe('Template ID'),
|
|
145
|
+
name: z.string().max(255).optional().describe('New name'),
|
|
146
|
+
...templateFields,
|
|
147
|
+
}, async ({ template_id, ...fields }) => {
|
|
148
|
+
try {
|
|
149
|
+
const result = await api.request('put', `/templates/${template_id}`, {
|
|
150
|
+
data: compact(fields),
|
|
151
|
+
});
|
|
152
|
+
return ok(result.data);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
return fail(error);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
server.tool('delete_template', `Delete an own template (soft delete, same as the panel). Campaigns created from it keep their content; the response reports used_by_messages. System templates cannot be deleted.`, {
|
|
159
|
+
template_id: z.number().describe('Template ID'),
|
|
160
|
+
}, async ({ template_id }) => {
|
|
161
|
+
try {
|
|
162
|
+
const result = await api.request('delete', `/templates/${template_id}`);
|
|
163
|
+
return ok(result.data);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
return fail(error);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
server.tool('duplicate_template', `Copy an own or system starter template into the account and return the editable copy (name defaults to "<name> (kopia)"). This is the way to customise a system template.`, {
|
|
170
|
+
template_id: z.number().describe('Template ID to copy'),
|
|
171
|
+
name: z.string().max(255).optional().describe('Name for the copy'),
|
|
172
|
+
}, async ({ template_id, name }) => {
|
|
173
|
+
try {
|
|
174
|
+
const result = await api.request('post', `/templates/${template_id}/duplicate`, {
|
|
175
|
+
data: compact({ name }),
|
|
176
|
+
});
|
|
177
|
+
return ok(result.data);
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
return fail(error);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
server.tool('preview_template', `Render a template's placeholders for one of the account's subscribers (subscriber_id) or for sample data (default: Jan Kowalski, jan.kowalski@example.com; override with 'sample'). Unsubscribe/manage links are real signed links for a subscriber and '#preview-…' for sample data; pass list_id to get the list-specific unsubscribe link.
|
|
184
|
+
|
|
185
|
+
Returns html (HTML templates) or mjml (builder-only templates), the rendered preheader, placeholders_used, and unknown_placeholders (placeholders that no field provides — fix these before sending). Nothing is sent or saved.`, {
|
|
186
|
+
template_id: z.number().describe('Template ID'),
|
|
187
|
+
subscriber_id: z.number().optional().describe('Render for this subscriber'),
|
|
188
|
+
list_id: z.number().optional().describe('List context for the unsubscribe link and custom fields'),
|
|
189
|
+
sample: z
|
|
190
|
+
.object({
|
|
191
|
+
email: z.string().optional(),
|
|
192
|
+
first_name: z.string().optional(),
|
|
193
|
+
last_name: z.string().optional(),
|
|
194
|
+
phone: z.string().optional(),
|
|
195
|
+
gender: z.enum(['male', 'female']).optional(),
|
|
196
|
+
})
|
|
197
|
+
.optional()
|
|
198
|
+
.describe('Sample subscriber values when no subscriber_id is given'),
|
|
199
|
+
}, async ({ template_id, ...data }) => {
|
|
200
|
+
try {
|
|
201
|
+
const result = await api.request('post', `/templates/${template_id}/preview`, {
|
|
202
|
+
data: compact(data),
|
|
203
|
+
});
|
|
204
|
+
return ok(result.data);
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
return fail(error);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
server.tool('list_template_categories', 'List template categories (system categories such as newsletter, promotional, ecommerce, welcome, transactional, notification, plus the account\'s own). Use the id as category_id in create_template / update_template, or the slug as the list_templates category filter.', {}, async () => {
|
|
211
|
+
try {
|
|
212
|
+
const result = await api.request('get', '/template-categories');
|
|
213
|
+
return ok(result.data);
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
return fail(error);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
// ---------------------------------------------------------------------
|
|
220
|
+
// Builder blocks
|
|
221
|
+
// ---------------------------------------------------------------------
|
|
222
|
+
server.tool('list_template_block_types', `List the drag & drop builder block types (${BLOCK_TYPES.join(', ')}) with their default content and settings. Use this as the schema reference when writing a template's json_structure: each block is {type, content, settings}; 'columns' blocks hold nested blocks in content.columnBlocks (an array per column).`, {}, async () => {
|
|
223
|
+
try {
|
|
224
|
+
const result = await api.request('get', '/template-blocks/types');
|
|
225
|
+
return ok(result);
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
return fail(error);
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
server.tool('list_template_blocks', "List saved blocks (the builder sidebar's \"Saved blocks\"): the account's own blocks plus global blocks (read-only). Each block can be inserted into a template's json_structure.blocks as {type, content, settings}.", {
|
|
232
|
+
type: z.enum(BLOCK_TYPES).optional().describe('Filter by block type'),
|
|
233
|
+
search: z.string().optional().describe('Search by name'),
|
|
234
|
+
page: z.number().min(1).optional().describe('Page number (default 1)'),
|
|
235
|
+
per_page: z.number().min(1).max(100).optional().describe('Results per page (1-100, default 25)'),
|
|
236
|
+
}, async (params) => {
|
|
237
|
+
try {
|
|
238
|
+
const result = await api.request('get', '/template-blocks', { params: compact(params) });
|
|
239
|
+
return ok({
|
|
240
|
+
blocks: result.data,
|
|
241
|
+
pagination: {
|
|
242
|
+
page: result.meta.current_page,
|
|
243
|
+
total_pages: result.meta.last_page,
|
|
244
|
+
total: result.meta.total,
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
return fail(error);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
server.tool('create_template_block', 'Save a reusable builder block (e.g. a branded header, footer or CTA button) so it appears under "Saved blocks" in the template builder. content follows the block type\'s shape from list_template_block_types.', {
|
|
253
|
+
name: z.string().max(255).describe('Block name'),
|
|
254
|
+
type: z.enum(BLOCK_TYPES).describe('Block type'),
|
|
255
|
+
content: z.record(z.string(), z.unknown()).describe('Block content'),
|
|
256
|
+
settings: z.record(z.string(), z.unknown()).nullable().optional().describe('Block style settings (defaults applied when omitted)'),
|
|
257
|
+
}, async (params) => {
|
|
258
|
+
try {
|
|
259
|
+
const result = await api.request('post', '/template-blocks', { data: compact(params) });
|
|
260
|
+
return ok(result.data);
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
return fail(error);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
server.tool('update_template_block', 'Update an own saved block (name, content and/or settings). Global blocks are read-only. Templates that already contain the block are not changed.', {
|
|
267
|
+
block_id: z.number().describe('Saved block ID'),
|
|
268
|
+
name: z.string().max(255).optional().describe('New name'),
|
|
269
|
+
content: z.record(z.string(), z.unknown()).optional().describe('New content (replaces the whole content object)'),
|
|
270
|
+
settings: z.record(z.string(), z.unknown()).nullable().optional().describe('New settings'),
|
|
271
|
+
}, async ({ block_id, ...fields }) => {
|
|
272
|
+
try {
|
|
273
|
+
const result = await api.request('put', `/template-blocks/${block_id}`, {
|
|
274
|
+
data: compact(fields),
|
|
275
|
+
});
|
|
276
|
+
return ok(result.data);
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
return fail(error);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
server.tool('delete_template_block', 'Delete an own saved block. Templates that already contain it are not changed.', {
|
|
283
|
+
block_id: z.number().describe('Saved block ID'),
|
|
284
|
+
}, async ({ block_id }) => {
|
|
285
|
+
try {
|
|
286
|
+
const result = await api.request('delete', `/template-blocks/${block_id}`);
|
|
287
|
+
return ok(result.data);
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
return fail(error);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/tools/templates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,EA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,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QACrB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,OAAO,CAAoB,QAAQ,EAAE,oBAAoB,QAAQ,EAAE,CAAC,CAAC;YAC9F,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - Webhook Tools
|
|
3
|
+
*
|
|
4
|
+
* Outgoing webhooks: NetSendo POSTs a signed JSON payload to a URL whenever
|
|
5
|
+
* one of the subscribed events happens (subscriber changes, tags, email/SMS,
|
|
6
|
+
* Stripe purchases).
|
|
7
|
+
*/
|
|
8
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
|
+
import type { NetSendoApiClient } from '../api-client.js';
|
|
10
|
+
export declare function registerWebhookTools(server: McpServer, api: NetSendoApiClient): void;
|
|
11
|
+
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/tools/webhooks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AA4B1D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,iBAAiB,QA0J7E"}
|