@buzzposter/mcp 0.1.6 → 0.1.7

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
@@ -262,6 +262,9 @@ var BuzzPosterClient = class {
262
262
  async getDefaultAudience() {
263
263
  return this.request("GET", "/api/v1/audiences/default");
264
264
  }
265
+ async createAudience(data) {
266
+ return this.request("POST", "/api/v1/audiences", data);
267
+ }
265
268
  async updateAudience(id, data) {
266
269
  return this.request("PUT", `/api/v1/audiences/${id}`, data);
267
270
  }
@@ -2134,16 +2137,17 @@ function registerAudienceTools(server2, client2) {
2134
2137
  );
2135
2138
  server2.tool(
2136
2139
  "update_audience",
2137
- `Update an existing audience profile. Only the fields you provide will be changed; omitted fields are left as-is.
2140
+ `Create or update a target audience profile. This is an upsert \u2014 if no audience_id is provided it will try to update the default audience, or create a new one if none exists. Only the fields you provide will be changed; omitted fields are left as-is.
2138
2141
 
2139
2142
  USAGE GUIDELINES:
2140
2143
  - Call get_audience first to see the current state before making changes
2141
2144
  - Always set confirmed=false first to preview the changes, then confirmed=true after user approval
2142
2145
  - When updating array fields (pain_points, motivations, preferred_platforms), include the FULL array (existing + new items), not just the new ones
2146
+ - Omit audience_id to update the default audience or create a new one if none exists
2143
2147
  - Max limits: name 100 chars, description 500 chars`,
2144
2148
  {
2145
- audience_id: z9.string().describe("The audience ID to update (required)"),
2146
- name: z9.string().max(100).optional().describe("Audience profile name (e.g. 'SaaS Founders', 'Health-Conscious Millennials')"),
2149
+ audience_id: z9.string().optional().describe("Audience ID to update. Omit to update the default audience, or create one if none exists."),
2150
+ name: z9.string().max(100).optional().describe("Audience profile name (e.g. 'SaaS Founders', 'Health-Conscious Millennials'). Required when creating a new audience."),
2147
2151
  description: z9.string().max(500).optional().describe("Brief description of who this audience is"),
2148
2152
  demographics: z9.string().optional().describe("Demographic details \u2014 age range, location, income level, education, etc."),
2149
2153
  pain_points: z9.array(z9.string()).optional().describe("Problems and frustrations the audience faces. Send the FULL list, not just additions."),
@@ -2185,10 +2189,33 @@ USAGE GUIDELINES:
2185
2189
  isError: true
2186
2190
  };
2187
2191
  }
2192
+ let targetId = args.audience_id;
2193
+ let isCreating = false;
2194
+ if (!targetId) {
2195
+ try {
2196
+ const defaultAudience = await client2.getDefaultAudience();
2197
+ targetId = String(defaultAudience.id);
2198
+ } catch {
2199
+ isCreating = true;
2200
+ }
2201
+ }
2202
+ if (isCreating && !payload.name) {
2203
+ return {
2204
+ content: [
2205
+ {
2206
+ type: "text",
2207
+ text: "No audience exists yet. Provide a **name** to create one (e.g. name: 'SaaS Founders')."
2208
+ }
2209
+ ],
2210
+ isError: true
2211
+ };
2212
+ }
2188
2213
  if (args.confirmed !== true) {
2189
2214
  const lines2 = [];
2190
- lines2.push("## Audience Update Preview");
2191
- lines2.push(`**Audience ID:** ${args.audience_id}`);
2215
+ lines2.push(isCreating ? "## New Audience Preview" : "## Audience Update Preview");
2216
+ if (!isCreating) {
2217
+ lines2.push(`**Audience ID:** ${targetId}`);
2218
+ }
2192
2219
  lines2.push("");
2193
2220
  if (payload.name) {
2194
2221
  lines2.push(`**Name:** ${payload.name}`);
@@ -2246,9 +2273,15 @@ USAGE GUIDELINES:
2246
2273
  content: [{ type: "text", text: lines2.join("\n") }]
2247
2274
  };
2248
2275
  }
2249
- const result = await client2.updateAudience(args.audience_id, payload);
2276
+ let result;
2277
+ if (isCreating) {
2278
+ if (payload.isDefault === void 0) payload.isDefault = true;
2279
+ result = await client2.createAudience(payload);
2280
+ } else {
2281
+ result = await client2.updateAudience(targetId, payload);
2282
+ }
2250
2283
  const lines = [];
2251
- lines.push(`Audience "${result.name}" has been updated successfully.`);
2284
+ lines.push(`Audience "${result.name}" has been ${isCreating ? "created" : "updated"} successfully.`);
2252
2285
  lines.push("");
2253
2286
  const summary = [];
2254
2287
  if (payload.name) summary.push("name");
@@ -2260,7 +2293,7 @@ USAGE GUIDELINES:
2260
2293
  if (payload.toneNotes) summary.push("tone notes");
2261
2294
  if (payload.contentPreferences) summary.push("content preferences");
2262
2295
  if (payload.isDefault !== void 0) summary.push("default status");
2263
- lines.push(`**Updated:** ${summary.join(", ")}`);
2296
+ lines.push(`**${isCreating ? "Created with" : "Updated"}:** ${summary.join(", ")}`);
2264
2297
  return {
2265
2298
  content: [{ type: "text", text: lines.join("\n") }]
2266
2299
  };
package/dist/tools.d.ts CHANGED
@@ -76,6 +76,7 @@ declare class BuzzPosterClient {
76
76
  updateBrandVoice(data: Record<string, unknown>): Promise<unknown>;
77
77
  getAudience(id: string): Promise<unknown>;
78
78
  getDefaultAudience(): Promise<unknown>;
79
+ createAudience(data: Record<string, unknown>): Promise<unknown>;
79
80
  updateAudience(id: string, data: Record<string, unknown>): Promise<unknown>;
80
81
  getTemplate(id?: string): Promise<unknown>;
81
82
  listTemplates(): Promise<unknown>;
package/dist/tools.js CHANGED
@@ -256,6 +256,9 @@ var BuzzPosterClient = class {
256
256
  async getDefaultAudience() {
257
257
  return this.request("GET", "/api/v1/audiences/default");
258
258
  }
259
+ async createAudience(data) {
260
+ return this.request("POST", "/api/v1/audiences", data);
261
+ }
259
262
  async updateAudience(id, data) {
260
263
  return this.request("PUT", `/api/v1/audiences/${id}`, data);
261
264
  }
@@ -2864,16 +2867,17 @@ function registerAudienceTools(server, client) {
2864
2867
  );
2865
2868
  server.tool(
2866
2869
  "update_audience",
2867
- `Update an existing audience profile. Only the fields you provide will be changed; omitted fields are left as-is.
2870
+ `Create or update a target audience profile. This is an upsert \u2014 if no audience_id is provided it will try to update the default audience, or create a new one if none exists. Only the fields you provide will be changed; omitted fields are left as-is.
2868
2871
 
2869
2872
  USAGE GUIDELINES:
2870
2873
  - Call get_audience first to see the current state before making changes
2871
2874
  - Always set confirmed=false first to preview the changes, then confirmed=true after user approval
2872
2875
  - When updating array fields (pain_points, motivations, preferred_platforms), include the FULL array (existing + new items), not just the new ones
2876
+ - Omit audience_id to update the default audience or create a new one if none exists
2873
2877
  - Max limits: name 100 chars, description 500 chars`,
2874
2878
  {
2875
- audience_id: z10.string().describe("The audience ID to update (required)"),
2876
- name: z10.string().max(100).optional().describe("Audience profile name (e.g. 'SaaS Founders', 'Health-Conscious Millennials')"),
2879
+ audience_id: z10.string().optional().describe("Audience ID to update. Omit to update the default audience, or create one if none exists."),
2880
+ name: z10.string().max(100).optional().describe("Audience profile name (e.g. 'SaaS Founders', 'Health-Conscious Millennials'). Required when creating a new audience."),
2877
2881
  description: z10.string().max(500).optional().describe("Brief description of who this audience is"),
2878
2882
  demographics: z10.string().optional().describe("Demographic details \u2014 age range, location, income level, education, etc."),
2879
2883
  pain_points: z10.array(z10.string()).optional().describe("Problems and frustrations the audience faces. Send the FULL list, not just additions."),
@@ -2915,10 +2919,33 @@ USAGE GUIDELINES:
2915
2919
  isError: true
2916
2920
  };
2917
2921
  }
2922
+ let targetId = args.audience_id;
2923
+ let isCreating = false;
2924
+ if (!targetId) {
2925
+ try {
2926
+ const defaultAudience = await client.getDefaultAudience();
2927
+ targetId = String(defaultAudience.id);
2928
+ } catch {
2929
+ isCreating = true;
2930
+ }
2931
+ }
2932
+ if (isCreating && !payload.name) {
2933
+ return {
2934
+ content: [
2935
+ {
2936
+ type: "text",
2937
+ text: "No audience exists yet. Provide a **name** to create one (e.g. name: 'SaaS Founders')."
2938
+ }
2939
+ ],
2940
+ isError: true
2941
+ };
2942
+ }
2918
2943
  if (args.confirmed !== true) {
2919
2944
  const lines2 = [];
2920
- lines2.push("## Audience Update Preview");
2921
- lines2.push(`**Audience ID:** ${args.audience_id}`);
2945
+ lines2.push(isCreating ? "## New Audience Preview" : "## Audience Update Preview");
2946
+ if (!isCreating) {
2947
+ lines2.push(`**Audience ID:** ${targetId}`);
2948
+ }
2922
2949
  lines2.push("");
2923
2950
  if (payload.name) {
2924
2951
  lines2.push(`**Name:** ${payload.name}`);
@@ -2976,9 +3003,15 @@ USAGE GUIDELINES:
2976
3003
  content: [{ type: "text", text: lines2.join("\n") }]
2977
3004
  };
2978
3005
  }
2979
- const result = await client.updateAudience(args.audience_id, payload);
3006
+ let result;
3007
+ if (isCreating) {
3008
+ if (payload.isDefault === void 0) payload.isDefault = true;
3009
+ result = await client.createAudience(payload);
3010
+ } else {
3011
+ result = await client.updateAudience(targetId, payload);
3012
+ }
2980
3013
  const lines = [];
2981
- lines.push(`Audience "${result.name}" has been updated successfully.`);
3014
+ lines.push(`Audience "${result.name}" has been ${isCreating ? "created" : "updated"} successfully.`);
2982
3015
  lines.push("");
2983
3016
  const summary = [];
2984
3017
  if (payload.name) summary.push("name");
@@ -2990,7 +3023,7 @@ USAGE GUIDELINES:
2990
3023
  if (payload.toneNotes) summary.push("tone notes");
2991
3024
  if (payload.contentPreferences) summary.push("content preferences");
2992
3025
  if (payload.isDefault !== void 0) summary.push("default status");
2993
- lines.push(`**Updated:** ${summary.join(", ")}`);
3026
+ lines.push(`**${isCreating ? "Created with" : "Updated"}:** ${summary.join(", ")}`);
2994
3027
  return {
2995
3028
  content: [{ type: "text", text: lines.join("\n") }]
2996
3029
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buzzposter/mcp",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "BuzzPoster MCP server - Social media, newsletters, and media hosting for Claude Desktop",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",