@sendinel/mcp-server 1.0.84 → 1.0.86
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/tools/analytics.js +2 -2
- package/build/tools/campaigns.js +7 -50
- package/package.json +1 -1
package/build/tools/analytics.js
CHANGED
|
@@ -331,7 +331,6 @@ export function registerAnalyticsTools(server) {
|
|
|
331
331
|
description: 'List all projects accessible to this API key. Returns project ID, name, plan, and associated organization. Useful for orchestrators managing multiple products through a single Sendinel account.',
|
|
332
332
|
inputSchema: {},
|
|
333
333
|
}, async () => {
|
|
334
|
-
const projectId = getProjectId();
|
|
335
334
|
const ctx = requestContext();
|
|
336
335
|
if (ctx?.channel === 'mcp_oauth_session' && ctx.actorId) {
|
|
337
336
|
const [{ data: directAccess, error: directError }, { data: ownedOrgs, error: ownerError }] = await Promise.all([
|
|
@@ -384,10 +383,11 @@ export function registerAnalyticsTools(server) {
|
|
|
384
383
|
name: project.name,
|
|
385
384
|
org_id: project.org_id,
|
|
386
385
|
org_name: project.org_id ? orgNames.get(project.org_id) ?? null : null,
|
|
387
|
-
active: project.id === projectId,
|
|
386
|
+
active: project.id === ctx.projectId,
|
|
388
387
|
})),
|
|
389
388
|
});
|
|
390
389
|
}
|
|
390
|
+
const projectId = getProjectId();
|
|
391
391
|
// API keys are scoped to a single project, but an organization can have multiple projects.
|
|
392
392
|
// Look up the org for this project, then list all projects in that org.
|
|
393
393
|
const { data: project, error: projErr } = await adminDb()
|
package/build/tools/campaigns.js
CHANGED
|
@@ -2223,62 +2223,19 @@ Do not include body_html in your response; Sendinel renders body_html from block
|
|
|
2223
2223
|
idempotentHint: true,
|
|
2224
2224
|
openWorldHint: false,
|
|
2225
2225
|
},
|
|
2226
|
-
description: 'Preview email
|
|
2226
|
+
description: 'Preview email through the real send renderer using sample contact data; unresolved_tags lists remaining tags. Provide content via step_id, draft_id, or raw body_html/subject.',
|
|
2227
2227
|
inputSchema: {
|
|
2228
|
+
site_id: z.string().uuid().optional().describe('Site UUID for sender tags and footers'),
|
|
2228
2229
|
step_id: z.string().uuid().optional().describe('Campaign step UUID'),
|
|
2229
2230
|
draft_id: z.string().uuid().optional().describe('AI draft UUID'),
|
|
2230
2231
|
subject: z.string().optional().describe('Raw subject'),
|
|
2231
2232
|
body_html: z.string().optional().describe('Raw HTML'),
|
|
2232
2233
|
},
|
|
2233
|
-
}, async ({ step_id, draft_id, subject, body_html }) => {
|
|
2234
|
-
const
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
if (!subj && !html) {
|
|
2239
|
-
if (step_id) {
|
|
2240
|
-
const { data: step, error } = await db()
|
|
2241
|
-
.from('campaign_steps')
|
|
2242
|
-
.select('subject, body_html, body_text')
|
|
2243
|
-
.eq('id', step_id)
|
|
2244
|
-
.maybeSingle();
|
|
2245
|
-
if (error || !step)
|
|
2246
|
-
return txt('Error: Step not found');
|
|
2247
|
-
subj = step.subject;
|
|
2248
|
-
html = step.body_html ?? '';
|
|
2249
|
-
text = step.body_text ?? '';
|
|
2250
|
-
}
|
|
2251
|
-
else if (draft_id) {
|
|
2252
|
-
const { data: draft, error } = await db()
|
|
2253
|
-
.from('ai_drafts')
|
|
2254
|
-
.select('subject, body_html, body_text')
|
|
2255
|
-
.eq('id', draft_id)
|
|
2256
|
-
.eq('project_id', projectId)
|
|
2257
|
-
.maybeSingle();
|
|
2258
|
-
if (error || !draft)
|
|
2259
|
-
return txt('Error: Draft not found');
|
|
2260
|
-
subj = draft.subject;
|
|
2261
|
-
html = draft.body_html ?? '';
|
|
2262
|
-
text = draft.body_text ?? '';
|
|
2263
|
-
}
|
|
2264
|
-
else {
|
|
2265
|
-
return txt('Provide step_id, draft_id, or raw subject/body_html.');
|
|
2266
|
-
}
|
|
2267
|
-
}
|
|
2268
|
-
const { data: sample } = await db()
|
|
2269
|
-
.from('subscribers')
|
|
2270
|
-
.select('id, email, first_name, last_name')
|
|
2271
|
-
.eq('project_id', projectId)
|
|
2272
|
-
.eq('global_unsubscribed', false)
|
|
2273
|
-
.order('created_at', { ascending: true })
|
|
2274
|
-
.limit(1)
|
|
2275
|
-
.maybeSingle();
|
|
2276
|
-
const contact = sample ?? { email: 'preview@example.com', first_name: 'Jane' };
|
|
2277
|
-
const resolve = (t) => t
|
|
2278
|
-
.replace(/\{\{first_name\}\}/g, contact.first_name || 'there')
|
|
2279
|
-
.replace(/\{\{email\}\}/g, contact.email)
|
|
2280
|
-
.replace(/\{\{unsubscribe_url\}\}/g, '#unsubscribe-preview');
|
|
2281
|
-
return j({ subject: resolve(subj), body_html: resolve(html), body_text: resolve(text), sample_contact: contact });
|
|
2234
|
+
}, async ({ step_id, draft_id, subject, body_html, site_id }) => {
|
|
2235
|
+
const result = await callSendinelV1('/api/v1/campaigns/preview', {
|
|
2236
|
+
body: { step_id, draft_id, subject, body_html, site_id },
|
|
2237
|
+
});
|
|
2238
|
+
return result.ok ? j(result.data) : j({ error: result.error, status: result.status });
|
|
2282
2239
|
});
|
|
2283
2240
|
server.registerTool('send_test_email', {
|
|
2284
2241
|
title: 'Send Test Email',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendinel/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.86",
|
|
4
4
|
"description": "AI-controlled email operations control plane for campaigns, contacts, segments, analytics, and multi-provider sending via MCP.",
|
|
5
5
|
"mcpName": "ai.sendinel/mcp-server",
|
|
6
6
|
"type": "module",
|