shipmail-mcp 0.4.0 → 0.5.2
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 +24 -17
- package/dist/capabilities.d.ts +158 -0
- package/dist/capabilities.js +511 -0
- package/dist/index.js +977 -77
- package/dist/server.d.ts +1 -2
- package/dist/server.js +924 -67
- package/package.json +2 -2
- package/server.json +2 -2
- package/smithery.yaml +1 -1
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
// src/capabilities.ts
|
|
2
|
+
import { API_KEY_SCOPES, apiKeyScopesGrant } from "shipmail/api-key-scopes";
|
|
3
|
+
var MCP_CAPABILITY_VERSION = "1.0.0";
|
|
4
|
+
var MCP_PERMISSION_GROUP_NAMES = [
|
|
5
|
+
"account_status",
|
|
6
|
+
"mail_read",
|
|
7
|
+
"drafts",
|
|
8
|
+
"mail_organize",
|
|
9
|
+
"send_mail",
|
|
10
|
+
"calendar_read",
|
|
11
|
+
"calendar_write",
|
|
12
|
+
"booking_pages",
|
|
13
|
+
"forwarding",
|
|
14
|
+
"webhooks",
|
|
15
|
+
"credentials",
|
|
16
|
+
"mailbox_export",
|
|
17
|
+
"domain_admin",
|
|
18
|
+
"mailbox_admin",
|
|
19
|
+
"newsletters",
|
|
20
|
+
"audiences",
|
|
21
|
+
"suppressions",
|
|
22
|
+
"partner_admin"
|
|
23
|
+
];
|
|
24
|
+
var MCP_MEMBER_PERMISSION_GROUP_NAMES = [
|
|
25
|
+
"account_status",
|
|
26
|
+
"mail_read",
|
|
27
|
+
"drafts",
|
|
28
|
+
"mail_organize",
|
|
29
|
+
"send_mail",
|
|
30
|
+
"calendar_read",
|
|
31
|
+
"calendar_write"
|
|
32
|
+
];
|
|
33
|
+
var MCP_PERMISSION_GROUPS = [
|
|
34
|
+
{
|
|
35
|
+
name: "account_status",
|
|
36
|
+
label: "Account status",
|
|
37
|
+
description: "Check whether the ShipMail API is available.",
|
|
38
|
+
scopes: [],
|
|
39
|
+
persistent: false
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "mail_read",
|
|
43
|
+
label: "Read mail",
|
|
44
|
+
description: "Read mailboxes, messages, threads, folders, identities, and import status.",
|
|
45
|
+
scopes: ["mailboxes:read", "messages:read", "threads:read"],
|
|
46
|
+
persistent: false
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "drafts",
|
|
50
|
+
label: "Create drafts",
|
|
51
|
+
description: "Create reply drafts whose recipients are derived by ShipMail.",
|
|
52
|
+
scopes: ["drafts:write"],
|
|
53
|
+
persistent: false
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "mail_organize",
|
|
57
|
+
label: "Organize mail",
|
|
58
|
+
description: "Update message state, move messages, and delete messages already in Trash or Junk.",
|
|
59
|
+
scopes: ["messages:write"],
|
|
60
|
+
persistent: false
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "send_mail",
|
|
64
|
+
label: "Send mail",
|
|
65
|
+
description: "Send new messages and replies to recipients allowed by the connection policy.",
|
|
66
|
+
scopes: ["messages:send"],
|
|
67
|
+
persistent: false
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "calendar_read",
|
|
71
|
+
label: "Read calendar",
|
|
72
|
+
description: "Read calendar events and availability.",
|
|
73
|
+
scopes: ["calendar:read"],
|
|
74
|
+
persistent: false
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "calendar_write",
|
|
78
|
+
label: "Manage calendar",
|
|
79
|
+
description: "Create, update, and delete calendar events.",
|
|
80
|
+
scopes: ["calendar:write"],
|
|
81
|
+
persistent: false
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "booking_pages",
|
|
85
|
+
label: "Booking pages",
|
|
86
|
+
description: "Read and manage public booking pages.",
|
|
87
|
+
scopes: ["booking_pages:read", "booking_pages:write"],
|
|
88
|
+
persistent: true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "forwarding",
|
|
92
|
+
label: "Mailbox forwarding",
|
|
93
|
+
description: "Read and manage persistent forwarding destinations.",
|
|
94
|
+
scopes: ["mailbox_forwarding:read", "mailbox_forwarding:write"],
|
|
95
|
+
persistent: true
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "webhooks",
|
|
99
|
+
label: "Webhooks",
|
|
100
|
+
description: "Read and manage persistent webhook destinations and deliveries.",
|
|
101
|
+
scopes: ["webhooks:read", "webhooks:write"],
|
|
102
|
+
persistent: true
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "credentials",
|
|
106
|
+
label: "Mailbox credentials",
|
|
107
|
+
description: "List, create, and revoke mailbox app passwords.",
|
|
108
|
+
scopes: ["mailbox_credentials:read", "mailbox_credentials:write"],
|
|
109
|
+
persistent: true
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "mailbox_export",
|
|
113
|
+
label: "Mailbox export",
|
|
114
|
+
description: "Create and retrieve mailbox content exports.",
|
|
115
|
+
scopes: ["mailboxes:export"],
|
|
116
|
+
persistent: true
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "domain_admin",
|
|
120
|
+
label: "Domain administration",
|
|
121
|
+
description: "Read and manage domains and DNS verification.",
|
|
122
|
+
scopes: ["domains:read", "domains:write"],
|
|
123
|
+
persistent: true
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "mailbox_admin",
|
|
127
|
+
label: "Mailbox administration",
|
|
128
|
+
description: "Create, change, suspend, import, and delete mailboxes and mailbox settings.",
|
|
129
|
+
scopes: ["mailboxes:read", "mailboxes:write"],
|
|
130
|
+
persistent: true
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: "newsletters",
|
|
134
|
+
label: "Newsletters",
|
|
135
|
+
description: "Read, create, test, schedule, and manage newsletter campaigns.",
|
|
136
|
+
scopes: ["newsletters:read", "newsletters:write"],
|
|
137
|
+
persistent: false
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "audiences",
|
|
141
|
+
label: "Audiences",
|
|
142
|
+
description: "Read and manage newsletter audiences and subscribers.",
|
|
143
|
+
scopes: ["audiences:read", "audiences:write"],
|
|
144
|
+
persistent: false
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "suppressions",
|
|
148
|
+
label: "Suppressions",
|
|
149
|
+
description: "Read and remove suppressed recipient addresses.",
|
|
150
|
+
scopes: ["suppressions:read", "suppressions:write"],
|
|
151
|
+
persistent: false
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "partner_admin",
|
|
155
|
+
label: "Partner administration",
|
|
156
|
+
description: "Manage delegated partner organizations, credential grants, and usage.",
|
|
157
|
+
scopes: [
|
|
158
|
+
"partner:organizations:read",
|
|
159
|
+
"partner:organizations:write",
|
|
160
|
+
"partner:organizations:access",
|
|
161
|
+
"partner:mailbox_credentials:issue",
|
|
162
|
+
"partner:usage:read"
|
|
163
|
+
],
|
|
164
|
+
persistent: true
|
|
165
|
+
}
|
|
166
|
+
];
|
|
167
|
+
var CAPABILITY_ROWS = [
|
|
168
|
+
["shipmail_status", "getStatus", "public"],
|
|
169
|
+
["shipmail_create_domain", "createDomain", "domains:write"],
|
|
170
|
+
["shipmail_list_domains", "listDomains", "domains:read"],
|
|
171
|
+
["shipmail_get_domain", "getDomain", "domains:read"],
|
|
172
|
+
["shipmail_get_domain_dns_records", "getDomainDnsRecords", "domains:read"],
|
|
173
|
+
["shipmail_update_domain", "updateDomain", "domains:write"],
|
|
174
|
+
["shipmail_delete_domain", "deleteDomain", "domains:write"],
|
|
175
|
+
["shipmail_verify_domain", "verifyDomain", "domains:write"],
|
|
176
|
+
["shipmail_search_domains", "searchDomains", "domains:read"],
|
|
177
|
+
["shipmail_create_mailbox", "createMailbox", "mailboxes:write"],
|
|
178
|
+
["shipmail_list_mailboxes", "listMailboxes", "mailboxes:read"],
|
|
179
|
+
["shipmail_get_mailbox", "getMailbox", "mailboxes:read"],
|
|
180
|
+
["shipmail_list_mailbox_app_passwords", "listMailboxAppPasswords", "mailbox_credentials:read"],
|
|
181
|
+
["shipmail_create_mailbox_app_password", "createMailboxAppPassword", "mailbox_credentials:write"],
|
|
182
|
+
["shipmail_revoke_mailbox_app_password", "revokeMailboxAppPassword", "mailbox_credentials:write"],
|
|
183
|
+
["shipmail_suspend_mailbox", "suspendMailbox", "mailboxes:write"],
|
|
184
|
+
["shipmail_resume_mailbox", "resumeMailbox", "mailboxes:write"],
|
|
185
|
+
["shipmail_create_mailbox_export", "createMailboxExport", "mailboxes:export"],
|
|
186
|
+
["shipmail_get_mailbox_export", "getMailboxExport", "mailboxes:export"],
|
|
187
|
+
["shipmail_update_mailbox", "updateMailbox", "mailboxes:write"],
|
|
188
|
+
["shipmail_delete_mailbox", "deleteMailbox", "mailboxes:write"],
|
|
189
|
+
["shipmail_list_mailbox_folders", "listMailboxFolders", "mailboxes:read"],
|
|
190
|
+
["shipmail_create_mailbox_folder", "createMailboxFolder", "mailboxes:write"],
|
|
191
|
+
["shipmail_update_mailbox_folder", "updateMailboxFolder", "mailboxes:write"],
|
|
192
|
+
["shipmail_delete_mailbox_folder", "deleteMailboxFolder", "mailboxes:write"],
|
|
193
|
+
["shipmail_list_mailbox_identities", "listMailboxIdentities", "mailboxes:read"],
|
|
194
|
+
["shipmail_list_mailbox_inbox_messages", "listMailboxInboxMessages", "messages:read"],
|
|
195
|
+
["shipmail_get_mailbox_inbox_message", "getMailboxInboxMessage", "messages:read"],
|
|
196
|
+
["shipmail_list_mailbox_inbox_threads", "listMailboxInboxThreads", "messages:read"],
|
|
197
|
+
["shipmail_get_mailbox_inbox_thread", "getMailboxInboxThread", "messages:read"],
|
|
198
|
+
[
|
|
199
|
+
"shipmail_update_inbox_thread_reply_state",
|
|
200
|
+
"updateMailboxInboxThreadReplyState",
|
|
201
|
+
"messages:write"
|
|
202
|
+
],
|
|
203
|
+
["shipmail_create_inbox_reply_draft", "createMailboxInboxReplyDraft", "drafts:write"],
|
|
204
|
+
["shipmail_send_inbox_reply_draft", "sendMailboxInboxReplyDraft", "messages:send"],
|
|
205
|
+
["shipmail_reply_to_inbox_message", "replyToMailboxInboxMessage", "messages:send"],
|
|
206
|
+
["shipmail_reply_to_inbox_thread", "replyToMailboxInboxThread", "messages:send"],
|
|
207
|
+
["shipmail_update_inbox_message", "updateMailboxInboxMessage", "messages:write"],
|
|
208
|
+
["shipmail_move_inbox_message", "moveMailboxInboxMessage", "messages:write"],
|
|
209
|
+
["shipmail_delete_inbox_message", "deleteMailboxInboxMessage", "messages:write"],
|
|
210
|
+
["shipmail_list_mailbox_forwarding", "listMailboxForwarding", "mailbox_forwarding:read"],
|
|
211
|
+
["shipmail_create_mailbox_forwarding", "createMailboxForwarding", "mailbox_forwarding:write"],
|
|
212
|
+
["shipmail_delete_mailbox_forwarding", "deleteMailboxForwarding", "mailbox_forwarding:write"],
|
|
213
|
+
["shipmail_reset_mailbox_password", "resetMailboxPassword", "mailboxes:write"],
|
|
214
|
+
["shipmail_set_auto_reply", "updateAutoReply", "mailboxes:write"],
|
|
215
|
+
["shipmail_set_spam_filter", "updateSpamFilter", "mailboxes:write"],
|
|
216
|
+
["shipmail_create_mailbox_import", "createMailboxImport", "mailboxes:write"],
|
|
217
|
+
["shipmail_list_mailbox_imports", "listMailboxImports", "mailboxes:read"],
|
|
218
|
+
["shipmail_get_mailbox_import", "getMailboxImport", "mailboxes:read"],
|
|
219
|
+
["shipmail_cancel_mailbox_import", "cancelMailboxImport", "mailboxes:write"],
|
|
220
|
+
["shipmail_undo_mailbox_import", "undoMailboxImport", "mailboxes:write"],
|
|
221
|
+
["shipmail_inject_sandbox_inbound", "injectSandboxInbound", "messages:write"],
|
|
222
|
+
["shipmail_list_messages", "listMessages", "messages:read"],
|
|
223
|
+
["shipmail_compose_message_with_file", "prepareStagedAttachmentUpload", "messages:send"],
|
|
224
|
+
["shipmail_prepare_staged_attachment_upload", "prepareStagedAttachmentUpload", "messages:send"],
|
|
225
|
+
["shipmail_send_message", "sendMessage", "messages:send"],
|
|
226
|
+
["shipmail_list_scheduled_messages", "listScheduledMessages", "messages:read"],
|
|
227
|
+
["shipmail_get_scheduled_message", "getScheduledMessage", "messages:read"],
|
|
228
|
+
["shipmail_update_scheduled_message", "updateScheduledMessage", "messages:send"],
|
|
229
|
+
["shipmail_cancel_scheduled_message", "cancelScheduledMessage", "messages:send"],
|
|
230
|
+
["shipmail_get_message", "getMessage", "messages:read"],
|
|
231
|
+
["shipmail_reply_to_message", "replyToMessage", "messages:send"],
|
|
232
|
+
["shipmail_list_threads", "listThreads", "threads:read"],
|
|
233
|
+
["shipmail_get_thread", "getThread", "threads:read"],
|
|
234
|
+
["shipmail_reply_to_thread", "replyToThread", "messages:send"],
|
|
235
|
+
["shipmail_create_reply_scan", "createReplyScan", "messages:read"],
|
|
236
|
+
["shipmail_get_reply_scan", "getReplyScan", "messages:read"],
|
|
237
|
+
["shipmail_list_reply_scan_results", "listReplyScanResults", "messages:read"],
|
|
238
|
+
["shipmail_create_webhook", "createWebhook", "webhooks:write"],
|
|
239
|
+
["shipmail_list_webhooks", "listWebhooks", "webhooks:read"],
|
|
240
|
+
["shipmail_get_webhook", "getWebhook", "webhooks:read"],
|
|
241
|
+
["shipmail_update_webhook", "updateWebhook", "webhooks:write"],
|
|
242
|
+
["shipmail_delete_webhook", "deleteWebhook", "webhooks:write"],
|
|
243
|
+
["shipmail_rotate_webhook_secret", "rotateWebhookSecret", "webhooks:write"],
|
|
244
|
+
["shipmail_test_webhook", "testWebhook", "webhooks:write"],
|
|
245
|
+
["shipmail_list_webhook_deliveries", "listWebhookDeliveries", "webhooks:read"],
|
|
246
|
+
["shipmail_get_webhook_delivery", "getWebhookDelivery", "webhooks:read"],
|
|
247
|
+
["shipmail_replay_webhook_delivery", "replayWebhookDelivery", "webhooks:write"],
|
|
248
|
+
["shipmail_list_suppressions", "listSuppressions", "suppressions:read"],
|
|
249
|
+
["shipmail_remove_suppression", "removeSuppression", "suppressions:write"],
|
|
250
|
+
["shipmail_create_audience", "createAudience", "audiences:write"],
|
|
251
|
+
["shipmail_list_audiences", "listAudiences", "audiences:read"],
|
|
252
|
+
["shipmail_get_audience", "getAudience", "audiences:read"],
|
|
253
|
+
["shipmail_update_audience", "updateAudience", "audiences:write"],
|
|
254
|
+
["shipmail_delete_audience", "deleteAudience", "audiences:write"],
|
|
255
|
+
["shipmail_add_subscriber", "addSubscriber", "audiences:write"],
|
|
256
|
+
["shipmail_add_subscribers_batch", "addSubscribersBatch", "audiences:write"],
|
|
257
|
+
["shipmail_list_subscribers", "listSubscribers", "audiences:read"],
|
|
258
|
+
["shipmail_get_subscriber", "getSubscriber", "audiences:read"],
|
|
259
|
+
["shipmail_get_subscriber_by_email", "getSubscriberByEmail", "audiences:read"],
|
|
260
|
+
["shipmail_update_subscriber", "updateSubscriber", "audiences:write"],
|
|
261
|
+
["shipmail_unsubscribe_subscriber", "unsubscribeSubscriber", "audiences:write"],
|
|
262
|
+
["shipmail_resubscribe_subscriber", "resubscribeSubscriber", "audiences:write"],
|
|
263
|
+
["shipmail_remove_subscriber", "removeSubscriber", "audiences:write"],
|
|
264
|
+
["shipmail_list_newsletter_domains", "listNewsletterDomains", "newsletters:read"],
|
|
265
|
+
["shipmail_create_newsletter", "createNewsletter", "newsletters:write"],
|
|
266
|
+
[
|
|
267
|
+
"shipmail_create_newsletter_from_changelog",
|
|
268
|
+
"createNewsletterFromChangelog",
|
|
269
|
+
"newsletters:write"
|
|
270
|
+
],
|
|
271
|
+
["shipmail_list_newsletters", "listNewsletters", "newsletters:read"],
|
|
272
|
+
["shipmail_get_newsletter", "getNewsletter", "newsletters:read"],
|
|
273
|
+
["shipmail_update_newsletter", "updateNewsletter", "newsletters:write"],
|
|
274
|
+
["shipmail_list_newsletter_assets", "listNewsletterAssets", "newsletters:read"],
|
|
275
|
+
["shipmail_register_newsletter_asset", "uploadNewsletterAsset", "newsletters:write"],
|
|
276
|
+
["shipmail_preview_newsletter", "previewNewsletter", "newsletters:read"],
|
|
277
|
+
["shipmail_run_newsletter_preflight", "runNewsletterPreflight", "newsletters:write"],
|
|
278
|
+
["shipmail_send_newsletter_test", "sendNewsletterTest", "newsletters:write"],
|
|
279
|
+
["shipmail_schedule_newsletter", "scheduleNewsletter", "newsletters:write"],
|
|
280
|
+
["shipmail_cancel_newsletter", "cancelNewsletter", "newsletters:write"],
|
|
281
|
+
["shipmail_resume_newsletter", "resumeNewsletter", "newsletters:write"],
|
|
282
|
+
["shipmail_list_calendar_events", "listCalendarEvents", "calendar:read"],
|
|
283
|
+
["shipmail_create_calendar_event", "createCalendarEvent", "calendar:write"],
|
|
284
|
+
["shipmail_get_calendar_event", "getCalendarEvent", "calendar:read"],
|
|
285
|
+
["shipmail_update_calendar_event", "updateCalendarEvent", "calendar:write"],
|
|
286
|
+
["shipmail_delete_calendar_event", "deleteCalendarEvent", "calendar:write"],
|
|
287
|
+
["shipmail_get_calendar_availability", "getCalendarAvailability", "calendar:read"],
|
|
288
|
+
["shipmail_list_booking_pages", "listBookingPages", "booking_pages:read"],
|
|
289
|
+
["shipmail_create_booking_page", "createBookingPage", "booking_pages:write"],
|
|
290
|
+
["shipmail_get_booking_page", "getBookingPage", "booking_pages:read"],
|
|
291
|
+
["shipmail_update_booking_page", "updateBookingPage", "booking_pages:write"],
|
|
292
|
+
["shipmail_delete_booking_page", "deleteBookingPage", "booking_pages:write"],
|
|
293
|
+
["shipmail_list_partner_organizations", "listPartnerOrganizations", "partner:organizations:read"],
|
|
294
|
+
[
|
|
295
|
+
"shipmail_create_partner_organization",
|
|
296
|
+
"createPartnerOrganization",
|
|
297
|
+
"partner:organizations:write"
|
|
298
|
+
],
|
|
299
|
+
["shipmail_get_partner_organization", "getPartnerOrganization", "partner:organizations:read"],
|
|
300
|
+
[
|
|
301
|
+
"shipmail_update_partner_organization",
|
|
302
|
+
"updatePartnerOrganization",
|
|
303
|
+
"partner:organizations:write"
|
|
304
|
+
],
|
|
305
|
+
[
|
|
306
|
+
"shipmail_resend_partner_ownership_invitation",
|
|
307
|
+
"resendPartnerOwnershipInvitation",
|
|
308
|
+
"partner:organizations:write"
|
|
309
|
+
],
|
|
310
|
+
[
|
|
311
|
+
"shipmail_suspend_partner_organization",
|
|
312
|
+
"suspendPartnerOrganization",
|
|
313
|
+
"partner:organizations:write"
|
|
314
|
+
],
|
|
315
|
+
[
|
|
316
|
+
"shipmail_resume_partner_organization",
|
|
317
|
+
"resumePartnerOrganization",
|
|
318
|
+
"partner:organizations:write"
|
|
319
|
+
],
|
|
320
|
+
[
|
|
321
|
+
"shipmail_offboard_partner_organization",
|
|
322
|
+
"offboardPartnerOrganization",
|
|
323
|
+
"partner:organizations:write"
|
|
324
|
+
],
|
|
325
|
+
[
|
|
326
|
+
"shipmail_list_partner_mailbox_credential_grants",
|
|
327
|
+
"listPartnerMailboxCredentialGrants",
|
|
328
|
+
"partner:mailbox_credentials:issue"
|
|
329
|
+
],
|
|
330
|
+
[
|
|
331
|
+
"shipmail_consume_partner_mailbox_credential_grant",
|
|
332
|
+
"consumePartnerMailboxCredentialGrant",
|
|
333
|
+
"partner:mailbox_credentials:issue"
|
|
334
|
+
],
|
|
335
|
+
["shipmail_get_partner_usage", "getPartnerUsage", "partner:usage:read"]
|
|
336
|
+
];
|
|
337
|
+
var MEMBER_GROUPS = new Set(
|
|
338
|
+
MCP_MEMBER_PERMISSION_GROUP_NAMES
|
|
339
|
+
);
|
|
340
|
+
var DESTRUCTIVE_PREFIXES = [
|
|
341
|
+
"shipmail_delete_",
|
|
342
|
+
"shipmail_remove_",
|
|
343
|
+
"shipmail_revoke_",
|
|
344
|
+
"shipmail_offboard_",
|
|
345
|
+
"shipmail_cancel_"
|
|
346
|
+
];
|
|
347
|
+
var DESTRUCTIVE_TOOLS = /* @__PURE__ */ new Set([
|
|
348
|
+
"shipmail_create_mailbox_app_password",
|
|
349
|
+
"shipmail_create_mailbox_export",
|
|
350
|
+
"shipmail_rotate_webhook_secret",
|
|
351
|
+
"shipmail_consume_partner_mailbox_credential_grant"
|
|
352
|
+
]);
|
|
353
|
+
var EXTERNAL_WRITE_TOOLS = /* @__PURE__ */ new Set([
|
|
354
|
+
"shipmail_send_message",
|
|
355
|
+
"shipmail_send_inbox_reply_draft",
|
|
356
|
+
"shipmail_reply_to_inbox_message",
|
|
357
|
+
"shipmail_reply_to_inbox_thread",
|
|
358
|
+
"shipmail_reply_to_message",
|
|
359
|
+
"shipmail_reply_to_thread",
|
|
360
|
+
"shipmail_create_mailbox_forwarding",
|
|
361
|
+
"shipmail_create_webhook",
|
|
362
|
+
"shipmail_update_webhook",
|
|
363
|
+
"shipmail_test_webhook",
|
|
364
|
+
"shipmail_replay_webhook_delivery",
|
|
365
|
+
"shipmail_send_newsletter_test",
|
|
366
|
+
"shipmail_schedule_newsletter",
|
|
367
|
+
"shipmail_create_calendar_event",
|
|
368
|
+
"shipmail_update_calendar_event",
|
|
369
|
+
"shipmail_update_scheduled_message"
|
|
370
|
+
]);
|
|
371
|
+
var SERVER_DERIVED_RECIPIENT_TOOLS = /* @__PURE__ */ new Set([
|
|
372
|
+
"shipmail_send_inbox_reply_draft",
|
|
373
|
+
"shipmail_reply_to_inbox_message",
|
|
374
|
+
"shipmail_reply_to_inbox_thread",
|
|
375
|
+
"shipmail_reply_to_message",
|
|
376
|
+
"shipmail_reply_to_thread"
|
|
377
|
+
]);
|
|
378
|
+
var CALLER_SUPPLIED_RECIPIENT_TOOLS = /* @__PURE__ */ new Set([
|
|
379
|
+
"shipmail_send_message",
|
|
380
|
+
"shipmail_create_mailbox_forwarding",
|
|
381
|
+
"shipmail_create_webhook",
|
|
382
|
+
"shipmail_update_webhook",
|
|
383
|
+
"shipmail_send_newsletter_test",
|
|
384
|
+
"shipmail_create_calendar_event",
|
|
385
|
+
"shipmail_update_calendar_event",
|
|
386
|
+
"shipmail_update_scheduled_message"
|
|
387
|
+
]);
|
|
388
|
+
var OPEN_WORLD_READ_SCOPES = /* @__PURE__ */ new Set([
|
|
389
|
+
"messages:read",
|
|
390
|
+
"threads:read",
|
|
391
|
+
"webhooks:read"
|
|
392
|
+
]);
|
|
393
|
+
function permissionGroupFor(toolName, requiredScope) {
|
|
394
|
+
if (requiredScope === "public") return "account_status";
|
|
395
|
+
if (requiredScope.startsWith("partner:")) return "partner_admin";
|
|
396
|
+
if (requiredScope.startsWith("domains:")) return "domain_admin";
|
|
397
|
+
if (requiredScope.startsWith("mailbox_credentials:")) return "credentials";
|
|
398
|
+
if (requiredScope.startsWith("mailbox_forwarding:")) return "forwarding";
|
|
399
|
+
if (requiredScope === "mailboxes:export") return "mailbox_export";
|
|
400
|
+
if (requiredScope === "drafts:write") return "drafts";
|
|
401
|
+
if (requiredScope === "messages:send") return "send_mail";
|
|
402
|
+
if (requiredScope === "messages:write") return "mail_organize";
|
|
403
|
+
if (requiredScope === "messages:read" || requiredScope === "threads:read") return "mail_read";
|
|
404
|
+
if (requiredScope === "calendar:read") return "calendar_read";
|
|
405
|
+
if (requiredScope === "calendar:write") return "calendar_write";
|
|
406
|
+
if (requiredScope.startsWith("booking_pages:")) return "booking_pages";
|
|
407
|
+
if (requiredScope.startsWith("webhooks:")) return "webhooks";
|
|
408
|
+
if (requiredScope.startsWith("newsletters:")) return "newsletters";
|
|
409
|
+
if (requiredScope.startsWith("audiences:")) return "audiences";
|
|
410
|
+
if (requiredScope.startsWith("suppressions:")) return "suppressions";
|
|
411
|
+
if (requiredScope === "mailboxes:read") {
|
|
412
|
+
return toolName.includes("_import") ? "mailbox_admin" : "mail_read";
|
|
413
|
+
}
|
|
414
|
+
return "mailbox_admin";
|
|
415
|
+
}
|
|
416
|
+
function effectFor(toolName) {
|
|
417
|
+
if (toolName === "shipmail_status" || toolName === "shipmail_compose_message_with_file" || toolName.startsWith("shipmail_list_") || toolName.startsWith("shipmail_get_") || toolName.startsWith("shipmail_search_") || toolName.startsWith("shipmail_preview_")) {
|
|
418
|
+
return "read";
|
|
419
|
+
}
|
|
420
|
+
if (DESTRUCTIVE_TOOLS.has(toolName)) return "destructive";
|
|
421
|
+
if (EXTERNAL_WRITE_TOOLS.has(toolName)) return "external_write";
|
|
422
|
+
if (DESTRUCTIVE_PREFIXES.some((prefix) => toolName.startsWith(prefix))) return "destructive";
|
|
423
|
+
return "local_write";
|
|
424
|
+
}
|
|
425
|
+
function recipientControlFor(toolName) {
|
|
426
|
+
if (SERVER_DERIVED_RECIPIENT_TOOLS.has(toolName)) return "server_derived";
|
|
427
|
+
if (CALLER_SUPPLIED_RECIPIENT_TOOLS.has(toolName)) return "caller_supplied";
|
|
428
|
+
return "none";
|
|
429
|
+
}
|
|
430
|
+
function durationFor(toolName) {
|
|
431
|
+
if (toolName.includes("app_password") || toolName.includes("credential_grant") || toolName === "shipmail_rotate_webhook_secret") {
|
|
432
|
+
return "credential";
|
|
433
|
+
}
|
|
434
|
+
if (toolName.includes("forwarding") || toolName.includes("webhook") || toolName.includes("booking_page")) {
|
|
435
|
+
return "persistent";
|
|
436
|
+
}
|
|
437
|
+
if (toolName === "shipmail_send_message" || toolName.includes("schedule_") || toolName.includes("scheduled_message")) {
|
|
438
|
+
return "scheduled";
|
|
439
|
+
}
|
|
440
|
+
return "one_shot";
|
|
441
|
+
}
|
|
442
|
+
function idempotencyFor(toolName, effect) {
|
|
443
|
+
if (effect === "read") return "none";
|
|
444
|
+
if (toolName === "shipmail_create_mailbox_app_password" || toolName === "shipmail_consume_partner_mailbox_credential_grant" || toolName === "shipmail_prepare_staged_attachment_upload") {
|
|
445
|
+
return "forbidden";
|
|
446
|
+
}
|
|
447
|
+
if (DESTRUCTIVE_PREFIXES.some((prefix) => toolName.startsWith(prefix)) || toolName.startsWith("shipmail_suspend_") || toolName.startsWith("shipmail_resume_")) {
|
|
448
|
+
return "resource_key";
|
|
449
|
+
}
|
|
450
|
+
return "api_header";
|
|
451
|
+
}
|
|
452
|
+
function defineCapability(row) {
|
|
453
|
+
const [toolName, operationId, requiredScope] = row;
|
|
454
|
+
const permissionGroup = permissionGroupFor(toolName, requiredScope);
|
|
455
|
+
const effect = effectFor(toolName);
|
|
456
|
+
const recipientControl = recipientControlFor(toolName);
|
|
457
|
+
const openWorldHint = effect === "external_write" || recipientControl !== "none" || requiredScope !== "public" && OPEN_WORLD_READ_SCOPES.has(requiredScope);
|
|
458
|
+
return {
|
|
459
|
+
toolName,
|
|
460
|
+
operationId,
|
|
461
|
+
requiredScope,
|
|
462
|
+
permissionGroup,
|
|
463
|
+
allowedRoles: MEMBER_GROUPS.has(permissionGroup) ? ["owner", "member"] : ["owner"],
|
|
464
|
+
effect,
|
|
465
|
+
recipientControl,
|
|
466
|
+
duration: durationFor(toolName),
|
|
467
|
+
idempotency: idempotencyFor(toolName, effect),
|
|
468
|
+
annotations: {
|
|
469
|
+
readOnlyHint: effect === "read",
|
|
470
|
+
destructiveHint: effect === "external_write" || effect === "destructive",
|
|
471
|
+
openWorldHint
|
|
472
|
+
},
|
|
473
|
+
auditAction: effect === "read" ? null : "api.mutation",
|
|
474
|
+
transports: {
|
|
475
|
+
hostedOAuth: permissionGroup !== "partner_admin",
|
|
476
|
+
directApiKeyHttp: true,
|
|
477
|
+
stdio: toolName !== "shipmail_compose_message_with_file" && toolName !== "shipmail_prepare_staged_attachment_upload"
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
var MCP_CAPABILITIES = CAPABILITY_ROWS.map(defineCapability);
|
|
482
|
+
var MCP_TOOL_NAMES = CAPABILITY_ROWS.map(([toolName]) => toolName);
|
|
483
|
+
function getMcpCapability(toolName) {
|
|
484
|
+
return MCP_CAPABILITIES.find((capability) => capability.toolName === toolName);
|
|
485
|
+
}
|
|
486
|
+
function getAllowedMcpToolNames(grantedScopes, transport) {
|
|
487
|
+
return new Set(
|
|
488
|
+
MCP_CAPABILITIES.filter(
|
|
489
|
+
(capability) => capability.transports[transport] && apiKeyScopesGrant(grantedScopes, capability.requiredScope)
|
|
490
|
+
).map((capability) => capability.toolName)
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
function permissionGroupsToScopes(groupNames) {
|
|
494
|
+
const scopes = /* @__PURE__ */ new Set();
|
|
495
|
+
for (const group of MCP_PERMISSION_GROUPS) {
|
|
496
|
+
if (!groupNames.includes(group.name)) continue;
|
|
497
|
+
for (const scope of group.scopes) scopes.add(scope);
|
|
498
|
+
}
|
|
499
|
+
return API_KEY_SCOPES.filter((scope) => scope !== "*" && scopes.has(scope));
|
|
500
|
+
}
|
|
501
|
+
export {
|
|
502
|
+
MCP_CAPABILITIES,
|
|
503
|
+
MCP_CAPABILITY_VERSION,
|
|
504
|
+
MCP_MEMBER_PERMISSION_GROUP_NAMES,
|
|
505
|
+
MCP_PERMISSION_GROUPS,
|
|
506
|
+
MCP_PERMISSION_GROUP_NAMES,
|
|
507
|
+
MCP_TOOL_NAMES,
|
|
508
|
+
getAllowedMcpToolNames,
|
|
509
|
+
getMcpCapability,
|
|
510
|
+
permissionGroupsToScopes
|
|
511
|
+
};
|