@sendora/mcp 1.15.4 → 1.15.6
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/dist/errors.js +2 -0
- package/dist/generated/docs.json +1 -1
- package/dist/generated/screens/domain-records.html +1 -1
- package/dist/generated/screens/message-timeline.html +1 -1
- package/dist/tools/broadcast-input.js +8 -15
- package/dist/tools/message-fields.js +32 -18
- package/dist/tools/send-input.js +5 -7
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { address, attachment, attachmentBytes, builtSize, customHeaders, MAX_ATTACHMENT_BYTES, MAX_MESSAGE_BYTES, MAX_RECIPIENTS, metadata, substitutions, tag, } from './message-fields.js';
|
|
2
|
+
import { address, atMost, attachment, attachmentBytes, builtSize, customHeaders, MAX_ATTACHMENT_BYTES, MAX_MESSAGE_BYTES, MAX_RECIPIENTS, metadata, recipients, substitutions, tag, toRecipients, } from './message-fields.js';
|
|
3
3
|
/*
|
|
4
4
|
* What send_broadcast takes (docs/design/mcp.md §4.2): the API's broadcast
|
|
5
5
|
* request as packages/domain/src/broadcast-request.ts has it, on the rules
|
|
@@ -11,14 +11,13 @@ import { address, attachment, attachmentBytes, builtSize, customHeaders, MAX_ATT
|
|
|
11
11
|
* refuse the same inputs with the same issues (§13 E05).
|
|
12
12
|
*/
|
|
13
13
|
const MAX_BROADCAST_ENTRIES = 100;
|
|
14
|
+
const TOO_MANY_ENTRIES = 'at most 100 messages from here; a real list is sent by code with an SDK';
|
|
15
|
+
const TOO_MANY_ATTACHMENTS = 'at most 20 attachments per broadcast';
|
|
14
16
|
const entry = z
|
|
15
17
|
.object({
|
|
16
|
-
to:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.describe('Recipients of this message; at most 50 across to, cc and bcc.'),
|
|
20
|
-
cc: z.array(address).optional().describe('Copied recipients, shown in the message.'),
|
|
21
|
-
bcc: z.array(address).optional().describe('Blind-copied recipients.'),
|
|
18
|
+
to: toRecipients.describe('Recipients of this message; at most 50 across to, cc and bcc.'),
|
|
19
|
+
cc: recipients.optional().describe('Copied recipients, shown in the message.'),
|
|
20
|
+
bcc: recipients.optional().describe('Blind-copied recipients.'),
|
|
22
21
|
metadata: metadata
|
|
23
22
|
.optional()
|
|
24
23
|
.describe("Up to 20 key-value pairs for this message, merged over the broadcast's."),
|
|
@@ -54,9 +53,7 @@ export const broadcastInput = z
|
|
|
54
53
|
headers: customHeaders
|
|
55
54
|
.optional()
|
|
56
55
|
.describe('Custom headers on every message. Headers Sendora sets itself, the List-Unsubscribe pair included, are refused.'),
|
|
57
|
-
attachments: z
|
|
58
|
-
.array(attachment)
|
|
59
|
-
.max(20, 'at most 20 attachments per broadcast')
|
|
56
|
+
attachments: atMost(20, TOO_MANY_ATTACHMENTS, z.array(attachment).max(20, TOO_MANY_ATTACHMENTS))
|
|
60
57
|
.optional()
|
|
61
58
|
.describe('At most 20, sent with every message, together at most 5 MB decoded.'),
|
|
62
59
|
tag: tag.describe('A label of up to 100 characters, on the broadcast and every message.'),
|
|
@@ -71,11 +68,7 @@ export const broadcastInput = z
|
|
|
71
68
|
.boolean()
|
|
72
69
|
.optional()
|
|
73
70
|
.describe("Whether the links of every message are tracked, whatever the stream's switch in get_server says; left out, the stream decides. true is refused until an administrator has first switched tracking on in the dashboard."),
|
|
74
|
-
messages: z
|
|
75
|
-
.array(entry)
|
|
76
|
-
.min(1)
|
|
77
|
-
.max(MAX_BROADCAST_ENTRIES, 'at most 100 messages from here; a real list is sent by code with an SDK')
|
|
78
|
-
.describe('One entry per message, at most 100.'),
|
|
71
|
+
messages: atMost(MAX_BROADCAST_ENTRIES, TOO_MANY_ENTRIES, z.array(entry).min(1).max(MAX_BROADCAST_ENTRIES, TOO_MANY_ENTRIES)).describe('One entry per message, at most 100.'),
|
|
79
72
|
})
|
|
80
73
|
.refine((input) => input.text !== undefined || input.html !== undefined, {
|
|
81
74
|
message: 'text or html is required',
|
|
@@ -62,17 +62,36 @@ export function isDeniedHeader(name) {
|
|
|
62
62
|
const lower = name.toLowerCase();
|
|
63
63
|
return DENIED_HEADERS.has(lower) || DENIED_HEADER_PREFIXES.some((each) => lower.startsWith(each));
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
function countOf(value) {
|
|
66
|
+
if (Array.isArray(value)) {
|
|
67
|
+
return value.length;
|
|
68
|
+
}
|
|
69
|
+
return typeof value === 'object' && value !== null ? Object.keys(value).length : 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Counts a list's or record's entries before `schema` reads them. Zod reads every entry before it
|
|
73
|
+
* counts them, and a short request can hold millions that each become an issue.
|
|
74
|
+
*/
|
|
75
|
+
export function atMost(max, message, schema) {
|
|
76
|
+
return z.preprocess((value, context) => {
|
|
77
|
+
if (countOf(value) > max) {
|
|
78
|
+
context.addIssue({ code: 'custom', message });
|
|
79
|
+
return z.NEVER;
|
|
80
|
+
}
|
|
81
|
+
return value;
|
|
82
|
+
}, schema);
|
|
83
|
+
}
|
|
84
|
+
const TOO_MANY_RECIPIENTS = 'at most 50 recipients per message';
|
|
85
|
+
export const recipients = atMost(MAX_RECIPIENTS, TOO_MANY_RECIPIENTS, z.array(address));
|
|
86
|
+
/** The `to` of a message, which needs a recipient where `cc` and `bcc` need none. */
|
|
87
|
+
export const toRecipients = atMost(MAX_RECIPIENTS, TOO_MANY_RECIPIENTS, z.array(address).min(1));
|
|
88
|
+
const headersRecord = z
|
|
66
89
|
.record(z.string(), z
|
|
67
90
|
.string()
|
|
68
91
|
.regex(HEADER_VALUE, 'header values are 1 to 998 characters without control characters'))
|
|
69
92
|
.superRefine((values, ctx) => {
|
|
70
|
-
const names = Object.keys(values);
|
|
71
|
-
if (names.length > 20) {
|
|
72
|
-
ctx.addIssue({ code: 'custom', message: 'at most 20 headers per message' });
|
|
73
|
-
}
|
|
74
93
|
const seen = new Set();
|
|
75
|
-
for (const name of
|
|
94
|
+
for (const name of Object.keys(values)) {
|
|
76
95
|
const lower = name.toLowerCase();
|
|
77
96
|
if (!HEADER_NAME.test(name)) {
|
|
78
97
|
ctx.addIssue({
|
|
@@ -90,17 +109,14 @@ export const customHeaders = z
|
|
|
90
109
|
seen.add(lower);
|
|
91
110
|
}
|
|
92
111
|
});
|
|
112
|
+
export const customHeaders = atMost(20, 'at most 20 headers per message', headersRecord);
|
|
93
113
|
const METADATA_KEY = /^[A-Za-z0-9_.-]{1,40}$/;
|
|
94
|
-
|
|
114
|
+
const metadataRecord = z
|
|
95
115
|
.record(z.string(), z
|
|
96
116
|
.string()
|
|
97
117
|
.regex(new RegExp(`^[^${CONTROL}]{0,500}$`, 'u'), 'metadata values are at most 500 characters without control characters'))
|
|
98
118
|
.superRefine((values, ctx) => {
|
|
99
|
-
const
|
|
100
|
-
if (keys.length > 20) {
|
|
101
|
-
ctx.addIssue({ code: 'custom', message: 'at most 20 metadata entries per message' });
|
|
102
|
-
}
|
|
103
|
-
for (const key of keys) {
|
|
119
|
+
for (const key of Object.keys(values)) {
|
|
104
120
|
if (!METADATA_KEY.test(key)) {
|
|
105
121
|
ctx.addIssue({
|
|
106
122
|
code: 'custom',
|
|
@@ -110,17 +126,14 @@ export const metadata = z
|
|
|
110
126
|
}
|
|
111
127
|
}
|
|
112
128
|
});
|
|
129
|
+
export const metadata = atMost(20, 'at most 20 metadata entries per message', metadataRecord);
|
|
113
130
|
const SUBSTITUTION_KEY = /^[A-Za-z0-9_]{1,40}$/;
|
|
114
|
-
|
|
131
|
+
const substitutionsRecord = z
|
|
115
132
|
.record(z.string(), z
|
|
116
133
|
.string()
|
|
117
134
|
.regex(new RegExp(`^[^${CONTROL}]{0,500}$`, 'u'), 'substitution values are at most 500 characters without control characters'))
|
|
118
135
|
.superRefine((values, ctx) => {
|
|
119
|
-
const
|
|
120
|
-
if (keys.length > 20) {
|
|
121
|
-
ctx.addIssue({ code: 'custom', message: 'at most 20 substitutions per message' });
|
|
122
|
-
}
|
|
123
|
-
for (const key of keys) {
|
|
136
|
+
for (const key of Object.keys(values)) {
|
|
124
137
|
if (!SUBSTITUTION_KEY.test(key)) {
|
|
125
138
|
ctx.addIssue({
|
|
126
139
|
code: 'custom',
|
|
@@ -137,6 +150,7 @@ export const substitutions = z
|
|
|
137
150
|
}
|
|
138
151
|
}
|
|
139
152
|
});
|
|
153
|
+
export const substitutions = atMost(20, 'at most 20 substitutions per message', substitutionsRecord);
|
|
140
154
|
export const tag = z
|
|
141
155
|
.string()
|
|
142
156
|
.trim()
|
package/dist/tools/send-input.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { address, attachment, attachmentBytes, builtSize, customHeaders, MAX_ATTACHMENT_BYTES, MAX_MESSAGE_BYTES, MAX_RECIPIENTS, metadata, tag, } from './message-fields.js';
|
|
2
|
+
import { address, atMost, attachment, attachmentBytes, builtSize, customHeaders, MAX_ATTACHMENT_BYTES, MAX_MESSAGE_BYTES, MAX_RECIPIENTS, metadata, recipients, tag, toRecipients, } from './message-fields.js';
|
|
3
3
|
/*
|
|
4
4
|
* What send_email takes (docs/design/mcp.md §4.2): the API's send request as
|
|
5
5
|
* packages/domain/src/send-request.ts has it, on the rules of
|
|
@@ -15,18 +15,16 @@ export const sendInput = z
|
|
|
15
15
|
.uuid()
|
|
16
16
|
.optional()
|
|
17
17
|
.describe('The stream it goes on, from get_server; the default transactional stream when left out.'),
|
|
18
|
-
to:
|
|
19
|
-
cc:
|
|
20
|
-
bcc:
|
|
18
|
+
to: toRecipients.describe('Recipients; at most 50 across to, cc and bcc.'),
|
|
19
|
+
cc: recipients.optional().describe('Copied recipients, shown in the message.'),
|
|
20
|
+
bcc: recipients.optional().describe('Blind-copied recipients.'),
|
|
21
21
|
subject: z.string().min(1).max(998).describe('The subject line, 1 to 998 characters.'),
|
|
22
22
|
text: z.string().min(1).optional().describe('The plain-text part; text or html is required.'),
|
|
23
23
|
html: z.string().min(1).optional().describe('The HTML part.'),
|
|
24
24
|
headers: customHeaders
|
|
25
25
|
.optional()
|
|
26
26
|
.describe('Custom headers by name, at most 20. Headers Sendora sets itself, such as From, Subject and Content-*, are refused.'),
|
|
27
|
-
attachments: z
|
|
28
|
-
.array(attachment)
|
|
29
|
-
.max(20, 'at most 20 attachments per message')
|
|
27
|
+
attachments: atMost(20, 'at most 20 attachments per message', z.array(attachment).max(20, 'at most 20 attachments per message'))
|
|
30
28
|
.optional()
|
|
31
29
|
.describe('At most 20, together at most 5 MB decoded.'),
|
|
32
30
|
tag: tag.describe('A label of up to 100 characters, returned with the message and its events.'),
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** This package's version, held equal to its package.json by a test. */
|
|
2
|
-
export const MCP_VERSION = '1.15.
|
|
2
|
+
export const MCP_VERSION = '1.15.6';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendora/mcp",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.6",
|
|
4
4
|
"description": "The official MCP server for Sendora: its documentation and API for coding agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@modelcontextprotocol/server": "^2.1.0",
|
|
27
27
|
"zod": "^4.6.2",
|
|
28
|
-
"@sendora/sdk": "^5.
|
|
28
|
+
"@sendora/sdk": "^5.8.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@anthropic-ai/mcpb": "2.1.2",
|