@buzzposter/mcp 0.2.3 → 0.3.0

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/index.js CHANGED
@@ -107,6 +107,13 @@ var BuzzPosterClient = class {
107
107
  async deleteMedia(key) {
108
108
  return this.request("DELETE", `/api/v1/media/${encodeURIComponent(key)}`);
109
109
  }
110
+ // Newsletter Preview (no ESP required)
111
+ async createPreview(data) {
112
+ return this.request("POST", "/api/v1/newsletters/preview", data);
113
+ }
114
+ async updatePreview(id, data) {
115
+ return this.request("PUT", `/api/v1/newsletters/preview/${id}`, data);
116
+ }
110
117
  // Newsletter
111
118
  async listSubscribers(params) {
112
119
  return this.request(
@@ -1140,8 +1147,8 @@ function registerNewsletterTools(server2, client2, options = {}) {
1140
1147
  server2,
1141
1148
  "create_newsletter",
1142
1149
  {
1143
- title: "Create Newsletter Draft",
1144
- description: "Push a newsletter to the user's ESP as a draft. Always call get_brand_voice first. Show an HTML preview to the user before calling this. Use table-based layouts, inline CSS only, 600px max width, email-safe fonts only (Arial, Helvetica, Georgia, Verdana), all images must use absolute URLs, keep under 102KB to avoid Gmail clipping. Optionally pass template_id to use an ESP-native template. Use list_esp_templates to discover available templates.",
1150
+ title: "Create Newsletter Preview",
1151
+ description: "Create a newsletter preview. Uploads HTML to a preview URL for review in Newsletter Studio. Does NOT push to ESP \u2014 use push_newsletter_to_esp for that. Always call get_brand_voice first. Use table-based layouts, inline CSS only, 600px max width, email-safe fonts only (Arial, Helvetica, Georgia, Verdana), all images must use absolute URLs, keep under 102KB to avoid Gmail clipping.",
1145
1152
  inputSchema: {
1146
1153
  subject: z5.string().describe("Email subject line"),
1147
1154
  content: z5.string().describe("HTML content of the newsletter"),
@@ -1175,7 +1182,7 @@ function registerNewsletterTools(server2, client2, options = {}) {
1175
1182
  previewText: args.preview_text
1176
1183
  };
1177
1184
  if (args.template_id) payload.templateId = args.template_id;
1178
- const result = await client2.createBroadcast(payload);
1185
+ const result = await client2.createPreview(payload);
1179
1186
  const response = {
1180
1187
  ...result,
1181
1188
  subject: args.subject,
@@ -1191,15 +1198,15 @@ function registerNewsletterTools(server2, client2, options = {}) {
1191
1198
  );
1192
1199
  server2.tool(
1193
1200
  "update_newsletter",
1194
- "Update an existing newsletter draft.",
1201
+ "Update an existing newsletter preview.",
1195
1202
  {
1196
- broadcast_id: z5.string().describe("The broadcast/newsletter ID to update"),
1203
+ preview_id: z5.string().describe("The preview ID to update"),
1197
1204
  subject: z5.string().optional().describe("Updated subject line"),
1198
1205
  content: z5.string().optional().describe("Updated HTML content"),
1199
1206
  preview_text: z5.string().optional().describe("Updated preview text")
1200
1207
  },
1201
1208
  {
1202
- title: "Update Newsletter Draft",
1209
+ title: "Update Newsletter Preview",
1203
1210
  readOnlyHint: false,
1204
1211
  destructiveHint: false,
1205
1212
  idempotentHint: true,
@@ -1210,7 +1217,44 @@ function registerNewsletterTools(server2, client2, options = {}) {
1210
1217
  if (args.subject) data.subject = args.subject;
1211
1218
  if (args.content) data.content = args.content;
1212
1219
  if (args.preview_text) data.previewText = args.preview_text;
1213
- const result = await client2.updateBroadcast(args.broadcast_id, data);
1220
+ const result = await client2.updatePreview(args.preview_id, data);
1221
+ const response = {
1222
+ ...result,
1223
+ subject: args.subject,
1224
+ content: args.content,
1225
+ previewText: args.preview_text
1226
+ };
1227
+ return {
1228
+ content: [
1229
+ { type: "text", text: JSON.stringify(response, null, 2) }
1230
+ ]
1231
+ };
1232
+ }
1233
+ );
1234
+ server2.tool(
1235
+ "push_newsletter_to_esp",
1236
+ "Push a newsletter to the user's ESP as a draft broadcast. Requires ESP to be configured. Use create_newsletter first for preview, then push when the user is happy with the content.",
1237
+ {
1238
+ subject: z5.string().describe("Email subject line"),
1239
+ content: z5.string().describe("HTML content of the newsletter"),
1240
+ preview_text: z5.string().optional().describe("Preview text shown in email clients"),
1241
+ template_id: z5.string().optional().describe("ESP-native template ID")
1242
+ },
1243
+ {
1244
+ title: "Push Newsletter to ESP",
1245
+ readOnlyHint: false,
1246
+ destructiveHint: false,
1247
+ idempotentHint: false,
1248
+ openWorldHint: true
1249
+ },
1250
+ async (args) => {
1251
+ const payload = {
1252
+ subject: args.subject,
1253
+ content: args.content,
1254
+ previewText: args.preview_text
1255
+ };
1256
+ if (args.template_id) payload.templateId = args.template_id;
1257
+ const result = await client2.createBroadcast(payload);
1214
1258
  const response = {
1215
1259
  ...result,
1216
1260
  subject: args.subject,