@sendinel/mcp-server 1.0.87 → 1.0.89

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 CHANGED
@@ -12,7 +12,7 @@ AI-controlled email operations control plane for campaigns, contacts, segments,
12
12
 
13
13
  ## Tool groups
14
14
 
15
- Sendinel currently exposes 35 tool groups and 336 tools (gateway mode exposes 4 meta-tools, sharing how_to with full mode). These counts are checked against the tool registry in CI, so this table matches what ships.
15
+ Sendinel currently exposes 35 tool groups and 337 tools (gateway mode exposes 4 meta-tools, sharing how_to with full mode). These counts are checked against the tool registry in CI, so this table matches what ships.
16
16
 
17
17
  | Group | Count | Purpose |
18
18
  |-------|-------|---------|
@@ -32,7 +32,7 @@ Sendinel currently exposes 35 tool groups and 336 tools (gateway mode exposes 4
32
32
  | `content` | 14 | Content blocks, gated asset links, blog ingest and auto-publish, sources |
33
33
  | `data` | 19 | Platform connectors, imports, API keys, migration jobs, notifications, tenant export |
34
34
  | `data-proposals` | 3 | Data-derived campaign proposal generation, listing, approval |
35
- | `delivery-ops` | 23 | Domains, DNSBL, deliverability diagnostics, queue, DLQ, exports, blackout dates |
35
+ | `delivery-ops` | 24 | Domains, DNSBL, deliverability diagnostics, queue, DLQ, exports, blackout dates |
36
36
  | `drafts` | 6 | Draft create/approve/reject and draft-to-campaign promotion |
37
37
  | `forms` | 3 | Form creation, listing, stats |
38
38
  | `gdpr` | 4 | Contact data deletion and GDPR log |
@@ -1,4 +1,4 @@
1
- export { FALLBACK_MODEL_IDS, MODEL_REGISTRY, ROLE, getAnthropicFastModelId, getAnthropicFrontierModelId, getAnthropicModelId, getAnthropicReasoningModelId, getModelIdForRole, resolveModel, type ModelMetadata, type ModelRole, type ResolvedModel, } from '@desler/models';
1
+ export { FALLBACK_MODEL_IDS, HAIKU_4_5_MODEL_ID, MODEL_REGISTRY, ROLE, getAnthropicFastModelId, getAnthropicHaiku45ModelId, getAnthropicFrontierModelId, getAnthropicModelId, getAnthropicReasoningModelId, getModelIdForRole, resolveModel, type ModelMetadata, type ModelRole, type ResolvedModel, } from '@desler/models';
2
2
  import { type ModelRole, type ResolvedModel } from '@desler/models';
3
3
  export declare const DEFAULT_ANTHROPIC_MODEL_ID: string;
4
4
  export declare const DEFAULT_ANTHROPIC_FAST_MODEL_ID: string;
@@ -1,4 +1,4 @@
1
- export { FALLBACK_MODEL_IDS, MODEL_REGISTRY, ROLE, getAnthropicFastModelId, getAnthropicFrontierModelId, getAnthropicModelId, getAnthropicReasoningModelId, getModelIdForRole, resolveModel, } from '@desler/models';
1
+ export { FALLBACK_MODEL_IDS, HAIKU_4_5_MODEL_ID, MODEL_REGISTRY, ROLE, getAnthropicFastModelId, getAnthropicHaiku45ModelId, getAnthropicFrontierModelId, getAnthropicModelId, getAnthropicReasoningModelId, getModelIdForRole, resolveModel, } from '@desler/models';
2
2
  import { MODEL_REGISTRY, resolveModel } from '@desler/models';
3
3
  import { adminDb } from './db.js';
4
4
  export const DEFAULT_ANTHROPIC_MODEL_ID = MODEL_REGISTRY.default.id;
@@ -10,6 +10,7 @@ import { fireWebhookEvent } from './webhook-events.js';
10
10
  * Tier 2 (protected) — Requires dashboard approval + typed confirmation. Irreversible data ops.
11
11
  */
12
12
  const GATED_ACTIONS = new Set([
13
+ 'recheck_domain_dns', // live provider verification may request an EE certificate
13
14
  'draft_agent_reply',
14
15
  'create_agent_mailbox',
15
16
  'launch_campaign', // sends real emails
package/build/server.js CHANGED
@@ -80,6 +80,7 @@ export const ALL_TOOL_GROUPS = Object.keys(GROUP_REGISTRY);
80
80
  // ── Scope enforcement ─────────────────────────────────────────────────────
81
81
  // Maps tool names to required scope. Mirrors dashboard's WRITE_TOOLS/ADMIN_TOOLS.
82
82
  const WRITE_TOOLS = new Set([
83
+ 'recheck_domain_dns',
83
84
  'mark_agent_message', 'draft_agent_reply', 'create_agent_mailbox',
84
85
  'add_subscriber', 'import_subscribers', 'update_subscriber', 'bulk_update_subscribers',
85
86
  'create_subscriber_view', 'update_subscriber_view', 'delete_subscriber_view',
@@ -1,4 +1,4 @@
1
- import { anthropicResponseText, assertUsableStopReason } from '@sendinel/domain';
1
+ import { anthropicRequiredText } from '@sendinel/domain';
2
2
  import { z } from 'zod';
3
3
  import Anthropic from '@anthropic-ai/sdk';
4
4
  import { adminDb, db } from '../db.js';
@@ -6,6 +6,8 @@ import { getProjectId } from '../project.js';
6
6
  import { buildVoicePrompt, deriveTemplateVariables } from '../lib/voice.js';
7
7
  import { getAnthropicFastModelId } from '../anthropic-model.js';
8
8
  import { BLOCK_GENERATION_SCHEMA, blocksToHtml, blocksToText, normalizeComposerBlocks } from '../lib/composer-blocks.js';
9
+ // Haiku 5.5 (fast role) thinks before answering; thinking counts toward max_tokens (#4193).
10
+ const FAST_MIN_MAX_TOKENS = 8000;
9
11
  const j = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
10
12
  const HEX6 = /^#[0-9A-Fa-f]{6}$/;
11
13
  function stringArray(value) {
@@ -77,7 +79,7 @@ export function registerCompoundTools(server) {
77
79
  try {
78
80
  const msg = await getAnthropicClient().messages.create({
79
81
  model: getAnthropicFastModelId(),
80
- max_tokens: 4096,
82
+ max_tokens: FAST_MIN_MAX_TOKENS,
81
83
  messages: [{
82
84
  role: 'user',
83
85
  content: `You are writing a ${num_steps}-step email campaign for "${site?.name ?? 'our product'}".
@@ -100,8 +102,7 @@ Do not include body_html. Sendinel renders body_html from blocks.
100
102
  Respond with a JSON array.`,
101
103
  }],
102
104
  });
103
- assertUsableStopReason(msg.stop_reason);
104
- const raw = anthropicResponseText(msg);
105
+ const raw = anthropicRequiredText(msg);
105
106
  steps = extractJsonArray(raw).map((step, index) => {
106
107
  const blocks = normalizeComposerBlocks(step.blocks, brandVisual.resolvedButtonColor);
107
108
  return {
@@ -197,7 +198,7 @@ Respond with a JSON array.`,
197
198
  try {
198
199
  const msg = await getAnthropicClient().messages.create({
199
200
  model: getAnthropicFastModelId(),
200
- max_tokens: 4096,
201
+ max_tokens: FAST_MIN_MAX_TOKENS,
201
202
  messages: [{
202
203
  role: 'user',
203
204
  content: `Write an email for "${site?.name ?? 'our product'}".
@@ -210,8 +211,7 @@ Do not include body_html. Sendinel renders body_html from blocks.
210
211
  Respond with JSON: { "subject": "...", "blocks": [...], "body_text": "..." }`,
211
212
  }],
212
213
  });
213
- assertUsableStopReason(msg.stop_reason);
214
- const raw = anthropicResponseText(msg);
214
+ const raw = anthropicRequiredText(msg);
215
215
  const parsed = extractJsonObject(raw);
216
216
  const blocks = normalizeComposerBlocks(parsed.blocks, brandVisual.resolvedButtonColor);
217
217
  if (!blocks.length)
@@ -296,7 +296,7 @@ Respond with JSON: { "subject": "...", "blocks": [...], "body_text": "..." }`,
296
296
  };
297
297
  const analysisMsg = await getAnthropicClient().messages.create({
298
298
  model: getAnthropicFastModelId(),
299
- max_tokens: 2048,
299
+ max_tokens: FAST_MIN_MAX_TOKENS,
300
300
  messages: [{
301
301
  role: 'user',
302
302
  content: `You are a deliverability engineer. Diagnose this email delivery issue.
@@ -308,8 +308,7 @@ ${JSON.stringify(diagnosticData, null, 2)}
308
308
  Identify the most likely root cause and give 3-5 concise actionable next steps.`,
309
309
  }],
310
310
  });
311
- assertUsableStopReason(analysisMsg.stop_reason);
312
- const analysis = anthropicResponseText(analysisMsg);
311
+ const analysis = anthropicRequiredText(analysisMsg);
313
312
  return j({
314
313
  diagnostic_data: diagnosticData,
315
314
  analysis,
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import dns from 'node:dns/promises';
3
- import { cancelSendQueueRows, findReplayableEnrollmentDlqRows, listSendQueueRows, replayEnrollmentDlqRows, retrySendQueueRows, } from '@sendinel/domain';
3
+ import { cancelSendQueueRows, computeDomainReadiness, findReplayableEnrollmentDlqRows, listSendQueueRows, replayEnrollmentDlqRows, retrySendQueueRows, } from '@sendinel/domain';
4
4
  import { logAudit } from '../audit.js';
5
5
  import { adminDb, db } from '../db.js';
6
6
  import { assertChannelCanExecute, checkApproval, currentChannelContext, requestApproval, withApproval } from '../lib/action-approvals.js';
@@ -141,7 +141,7 @@ export function registerDeliveryOpsTools(server) {
141
141
  idempotentHint: true,
142
142
  openWorldHint: false,
143
143
  },
144
- description: 'Return stored DNS verification status for a sending domain. This does not perform a live DNS refresh.',
144
+ description: 'Returns stored SPF/DKIM/DMARC from the latest health check; does NOT query DNS live. Use recheck_domain_dns for a live re-check.',
145
145
  inputSchema: { domain_id: z.string().uuid() },
146
146
  }, async ({ domain_id }) => {
147
147
  const { data, error } = await db().from('domains')
@@ -170,6 +170,40 @@ export function registerDeliveryOpsTools(server) {
170
170
  : null;
171
171
  return j({ spf, dkim, dmarc, all_verified: allVerified });
172
172
  });
173
+ server.registerTool('recheck_domain_dns', {
174
+ title: 'Recheck Domain DNS Live',
175
+ annotations: {
176
+ readOnlyHint: false,
177
+ destructiveHint: false,
178
+ idempotentHint: true,
179
+ openWorldHint: true,
180
+ },
181
+ description: 'Perform a live provider/DNS verification via the domains:write API and persist domain status and Elastic Email tracking observations. Returns Sendinel readiness; raw EE TrackingStatus is advisory and may remain Broken even when ready. Standard approval applies: call without approval_id, then repeat with the same domain_id and the approved approval_id. Failed checks return an error, not a readiness verdict.',
182
+ inputSchema: {
183
+ domain_id: z.string().uuid(),
184
+ approval_id: z.string().uuid().optional().describe('Call without this to request approval, then repeat with the approved approval_id.'),
185
+ },
186
+ }, withApproval('recheck_domain_dns', async ({ domain_id }) => {
187
+ try {
188
+ const result = await callSendinelV1(`/api/v1/domains/${domain_id}/verify`, { method: 'POST' });
189
+ if (!result.ok)
190
+ return j({ error: v1ErrorMessage(result.error), status: result.status });
191
+ const { data, error } = await db().schema('email').from('domains')
192
+ .select('id, name, provider, status, dns_records, verified_at')
193
+ .eq('project_id', getProjectId())
194
+ .eq('id', domain_id)
195
+ .maybeSingle();
196
+ if (error)
197
+ return j({ error: error.message });
198
+ if (!data)
199
+ return j({ error: 'Domain not found after verification', code: 'NOT_FOUND' });
200
+ return j({ domain_id, checked_live: true, status: data.status, verified_at: data.verified_at,
201
+ readiness: computeDomainReadiness(data) });
202
+ }
203
+ catch (error) {
204
+ return j({ error: error instanceof Error ? error.message : 'Domain recheck failed' });
205
+ }
206
+ }));
173
207
  server.registerTool('dnsbl_check', {
174
208
  title: 'DNSBL Check',
175
209
  annotations: {
@@ -763,28 +797,36 @@ export function registerDeliveryOpsTools(server) {
763
797
  idempotentHint: true,
764
798
  openWorldHint: false,
765
799
  },
766
- description: 'List sending domains configured for the project and their current verification status.',
800
+ description: 'List sending domains with Sendinel readiness (ready true/false/null, reasons, provider_detail). Raw provider values, including EE tracking_status_raw, are labelled detail only and do not drive readiness.',
767
801
  inputSchema: { site_id: z.string().uuid().optional() },
768
802
  }, async ({ site_id }) => {
769
803
  const projectId = getProjectId();
770
- let domainQuery = db().from('domains')
804
+ let domainQuery = db().schema('email').from('domains')
771
805
  .select('id, name, provider, provider_id, region, status, dns_records, verified_at, created_at')
772
806
  .eq('project_id', projectId)
773
807
  .order('created_at', { ascending: false });
774
808
  if (site_id) {
775
- const { data: site } = await db().from('sites')
809
+ const { data: site, error: siteError } = await db().schema('email').from('sites')
776
810
  .select('domain_id')
777
811
  .eq('id', site_id)
778
812
  .eq('project_id', projectId)
779
813
  .maybeSingle();
780
- if (!site?.domain_id)
814
+ if (siteError)
815
+ return j({ error: siteError.message });
816
+ if (!site)
817
+ return j({ error: 'Site not found', code: 'NOT_FOUND' });
818
+ if (!site.domain_id)
781
819
  return j({ domains: [], count: 0 });
782
820
  domainQuery = domainQuery.eq('id', site.domain_id);
783
821
  }
784
822
  const { data, error } = await domainQuery;
785
823
  if (error)
786
824
  return j({ error: error.message });
787
- return j({ domains: data ?? [], count: data?.length ?? 0 });
825
+ if (!data)
826
+ return j({ error: 'Domain query returned no result' });
827
+ return j({ domains: data.map((domain) => ({
828
+ ...domain, readiness: computeDomainReadiness(domain),
829
+ })), count: data.length });
788
830
  });
789
831
  server.registerTool('register_domain', {
790
832
  title: 'Register Domain',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendinel/mcp-server",
3
- "version": "1.0.87",
3
+ "version": "1.0.89",
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",