@sendinel/mcp-server 1.0.164 → 1.0.165
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/org.js +9 -2
- package/package.json +1 -1
package/build/tools/org.js
CHANGED
|
@@ -6,6 +6,7 @@ import { getProjectId } from '../project.js';
|
|
|
6
6
|
import { assertChannelCanExecute, checkApproval, currentChannelContext, requestApproval, withApproval } from '../lib/action-approvals.js';
|
|
7
7
|
import { callSendinelV1 } from '../lib/v1-client.js';
|
|
8
8
|
import { dbToolError } from '../lib/db-error.js';
|
|
9
|
+
import { checkPlanLimit } from '../plan-limits.js';
|
|
9
10
|
const j = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
|
|
10
11
|
const PROVIDER_SWITCH_V1_PROVIDERS = ['resend', 'ses', 'elastic-email'];
|
|
11
12
|
async function callProviderSwitchApi(path, init) {
|
|
@@ -545,9 +546,13 @@ export function registerOrgTools(server) {
|
|
|
545
546
|
const { data: project } = await db().from('projects').select('plan').eq('id', projectId).maybeSingle();
|
|
546
547
|
const plan = project?.plan ?? 'free';
|
|
547
548
|
const limits = PLAN_LIMITS[plan] ?? PLAN_LIMITS.free ?? {};
|
|
548
|
-
const [contacts, sends, { count: sites }] = await Promise.all([
|
|
549
|
+
const [contacts, sends, drafts, { count: sites }] = await Promise.all([
|
|
549
550
|
readPlanUsage(db(), projectId, "contacts"),
|
|
550
551
|
readPlanUsage(db(), projectId, "monthly_sends"),
|
|
552
|
+
checkPlanLimit('ai_drafts').then((result) => ({ data: result, error: null })).catch((error) => ({
|
|
553
|
+
data: null,
|
|
554
|
+
error: error instanceof Error ? error.message : 'Unable to read draft usage',
|
|
555
|
+
})),
|
|
551
556
|
db().from('sites').select('id', { count: 'exact', head: true }).eq('project_id', projectId),
|
|
552
557
|
]);
|
|
553
558
|
if (contacts.error || sends.error || contacts.data?.error || sends.data?.error || !contacts.data || !sends.data) {
|
|
@@ -558,7 +563,9 @@ export function registerOrgTools(server) {
|
|
|
558
563
|
contacts: { used: contacts.data.current, limit: contacts.data.limit },
|
|
559
564
|
monthly_sends: { used: sends.data.current, limit: sends.data.limit },
|
|
560
565
|
sites: { used: sites ?? 0, limit: limits.sites ?? null },
|
|
561
|
-
ai_drafts:
|
|
566
|
+
ai_drafts: typeof drafts.data?.current === 'number'
|
|
567
|
+
? { used: drafts.data.current, limit: limits.ai_drafts ?? null }
|
|
568
|
+
: { used: null, limit: limits.ai_drafts ?? null, reason: 'Unable to read draft usage' },
|
|
562
569
|
log_retention_days: limits.log_retention_days ?? null,
|
|
563
570
|
});
|
|
564
571
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendinel/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.165",
|
|
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",
|