@sendinel/mcp-server 1.0.127 → 1.0.128

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.
@@ -1,5 +1,6 @@
1
+ import { deliverProjectWebhook } from "@sendinel/domain/sandbox-webhook";
1
2
  import { createHmac, randomUUID } from 'node:crypto';
2
- import { db } from '../db.js';
3
+ import { adminDb, db } from '../db.js';
3
4
  import { getProjectId } from '../project.js';
4
5
  /**
5
6
  * Fire a webhook event to all active subscriptions matching the event type.
@@ -38,7 +39,7 @@ export async function fireWebhookEvent(event, data, projectId) {
38
39
  const signature = createHmac('sha256', sub.secret)
39
40
  .update(body)
40
41
  .digest('hex');
41
- const res = await fetch(sub.url, {
42
+ const res = await deliverProjectWebhook(adminDb(), pid, sub.url, {
42
43
  method: 'POST',
43
44
  headers: {
44
45
  'Content-Type': 'application/json',
@@ -92,7 +92,7 @@ async function readJsonSafe(res) {
92
92
  return res.json().catch(() => ({}));
93
93
  }
94
94
  async function sendViaProvider(provider, credentialsEnc, fromNumber, toNumber, body, webhookUrl, trackingToken) {
95
- await assertProjectAllowsSms(adminDb(), getProjectId());
95
+ await assertProjectAllowsSms(adminDb(), getProjectId(), toNumber);
96
96
  const credentials = parseCredentials(credentialsEnc);
97
97
  const meta = countSmsSegments(body);
98
98
  if (provider === 'twilio') {
@@ -5,7 +5,7 @@ import { db, adminDb } from '../db.js';
5
5
  import { decrypt } from '../crypto.js';
6
6
  import { getProjectId } from '../project.js';
7
7
  import { getAnthropicModelId } from '../anthropic-model.js';
8
- import { AI_MAX_TOKENS, outputConfig, anthropicCheckedText } from '@sendinel/domain';
8
+ import { AI_MAX_TOKENS, outputConfig, anthropicCheckedText, assertProjectSandboxTargets } from '@sendinel/domain';
9
9
  import { buildVoicePrompt } from '../lib/voice.js';
10
10
  import { buildSocialSystemPrompt, buildSocialUserPrompt, parseSocialResponse, selectArchetype, } from '../lib/social-engine/index.js';
11
11
  import { fireWebhookEvent } from '../lib/webhook-events.js';
@@ -40,6 +40,7 @@ function buildSocialTrackedUrl(params) {
40
40
  };
41
41
  }
42
42
  async function scheduleUploadPost(apiKey, params) {
43
+ await assertProjectSandboxTargets(adminDb(), params.projectId, 'social', params.profileId ? [`uploadpost:${params.platform}:${params.profileId}`] : []);
43
44
  const res = await fetch(`${UPLOADPOST_API_BASE}/uploadposts/schedule`, {
44
45
  method: 'POST',
45
46
  headers: {
@@ -47,6 +48,7 @@ async function scheduleUploadPost(apiKey, params) {
47
48
  'Content-Type': 'application/json',
48
49
  },
49
50
  body: JSON.stringify({
51
+ user: params.profileId,
50
52
  platform: params.platform,
51
53
  content: params.link ? `${params.content}\n\n${params.link}` : params.content,
52
54
  scheduled_at: params.scheduledAt?.toISOString(),
@@ -720,7 +722,7 @@ export function registerSocialPostTools(server) {
720
722
  return j({ error: 'Project not found', code: 'NOT_FOUND' });
721
723
  const { data: connection, error: connectionError } = await admin
722
724
  .from('social_platform_connections')
723
- .select('encrypted_access_token')
725
+ .select('encrypted_access_token, account_id')
724
726
  .eq('org_id', project.org_id)
725
727
  .eq('platform', p.publisher)
726
728
  .maybeSingle();
@@ -731,6 +733,8 @@ export function registerSocialPostTools(server) {
731
733
  }
732
734
  try {
733
735
  const result = await publishViaByoPublisher(p.publisher, decrypt(connection.encrypted_access_token), {
736
+ projectId,
737
+ profileId: connection.account_id ?? undefined,
734
738
  content: p.content,
735
739
  platform: campaign.platform,
736
740
  scheduledAt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendinel/mcp-server",
3
- "version": "1.0.127",
3
+ "version": "1.0.128",
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",