@cmo-so/mcp 0.2.0 → 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.
Files changed (2) hide show
  1. package/dist/cmo-mcp.mjs +435 -36
  2. package/package.json +1 -1
package/dist/cmo-mcp.mjs CHANGED
@@ -7199,7 +7199,7 @@ var require_dist = __commonJS({
7199
7199
  // package.json
7200
7200
  var package_default = {
7201
7201
  name: "@cmo-so/cli",
7202
- version: "0.2.0",
7202
+ version: "0.3.0",
7203
7203
  description: "CMO.so on the command line: your websites, ideas, blog posts, LinkedIn queue and results, plus a local MCP server for Claude Desktop, Cursor and other MCP clients.",
7204
7204
  type: "module",
7205
7205
  license: "MIT",
@@ -7530,7 +7530,7 @@ function dataUrl(type, bytes) {
7530
7530
  }
7531
7531
 
7532
7532
  // ../../packages/api-client/src/domains.ts
7533
- var MEMORY_CHANNELS = ["general", "blog", "linkedin", "facebook"];
7533
+ var MEMORY_CHANNELS = ["general", "blog", "linkedin", "facebook", "instagram", "google_business"];
7534
7534
  function addWebsite(api2, url) {
7535
7535
  return api2.request("/v1/domains", {
7536
7536
  method: "POST",
@@ -7649,8 +7649,15 @@ function domainApi(api2, domain) {
7649
7649
  approveSocial: (id) => post(`${base}/social/${id}/approve`),
7650
7650
  skipSocial: (id) => post(`${base}/social/${id}/skip`),
7651
7651
  /** Post it on LinkedIn now, not at the next posting time (even while posting is paused). */
7652
- publishSocialNow: (id) => post(`${base}/social/${id}/publish`),
7652
+ /** Post it now. `background`: the reply comes at once (status "publishing") and it goes out behind the
7653
+ * scenes (a notice when it's out); 409 `picture_busy` while its picture is being made. */
7654
+ publishSocialNow: (id, opts = {}) => post(
7655
+ `${base}/social/${id}/publish`,
7656
+ opts.background ? { background: true } : void 0
7657
+ ),
7653
7658
  /** Take a posted LinkedIn post down (its likes and comments go with it). */
7659
+ /** How a posted Instagram post is doing (read from Instagram, kept 15 minutes; `refresh` reads again). */
7660
+ socialInsights: (id, refresh = false) => api2.request(`${base}/social/${id}/insights${refresh ? "?refresh=true" : ""}`),
7654
7661
  deletePostedSocial: (id) => api2.request(`${base}/social/${id}/published`, { method: "DELETE" }),
7655
7662
  /** Change a posted LinkedIn post and put it up again: the old one comes down, the new text goes out now. */
7656
7663
  republishSocial: (id, socialCopy) => post(`${base}/social/${id}/republish`, socialCopy ? { social_copy: socialCopy } : {}),
@@ -7686,10 +7693,10 @@ function domainApi(api2, domain) {
7686
7693
  /** The template library, searchable. */
7687
7694
  socialTemplates: (search = "") => api2.request(`${base}/social/templates?search=${encodeURIComponent(search)}`),
7688
7695
  socialTemplatePreview: (key) => api2.request(`${base}/social/templates/${encodeURIComponent(key)}/preview`),
7689
- socialSetupTemplates: (keys2, writing) => api2.request(`${base}/social/setup/templates`, {
7696
+ socialSetupTemplates: (keys2, writing2) => api2.request(`${base}/social/setup/templates`, {
7690
7697
  method: "PUT",
7691
7698
  headers: { "Content-Type": "application/json" },
7692
- body: JSON.stringify({ keys: keys2, writing })
7699
+ body: JSON.stringify({ keys: keys2, writing: writing2 })
7693
7700
  }),
7694
7701
  socialSetupSchedule: (schedule) => api2.request(`${base}/social/setup/schedule`, {
7695
7702
  method: "PUT",
@@ -7731,6 +7738,32 @@ function domainApi(api2, domain) {
7731
7738
  }
7732
7739
  ),
7733
7740
  disconnectFacebook: (connectionId) => api2.request(`${base}/social/facebook/${connectionId}`, { method: "DELETE" }),
7741
+ /** Instagram connects through the Facebook sign-in (the accounts linked to your Pages): the same link;
7742
+ * back with ?facebook=connected, then `channels` says whether an Instagram account was found. */
7743
+ connectInstagram: (returnTo = "close") => post(`${base}/social/instagram/connect`, { return_to: returnTo }),
7744
+ /** Your Instagram accounts here (each with the Facebook Page it posts through), and the chosen one. */
7745
+ instagramAccounts: () => api2.request(`${base}/social/instagram/accounts`),
7746
+ chooseInstagramAccount: (connectionId) => api2.request(
7747
+ `${base}/social/instagram/account`,
7748
+ {
7749
+ method: "PUT",
7750
+ headers: { "Content-Type": "application/json" },
7751
+ body: JSON.stringify({ connection_id: connectionId })
7752
+ }
7753
+ ),
7754
+ disconnectInstagram: (connectionId) => api2.request(`${base}/social/instagram/${connectionId}`, { method: "DELETE" }),
7755
+ /** A Google sign-in link for this website's Google Business Profile; back with ?google_business=connected
7756
+ * (or none / error&message=…). Every profile the account can post to is saved; this website's is picked. */
7757
+ connectGoogleBusiness: (returnTo = "close") => post(`${base}/social/google_business/connect`, {
7758
+ return_to: returnTo
7759
+ }),
7760
+ /** Your Google Business profiles here (name, address, website), and the one this website posts to. */
7761
+ googleBusinessLocations: () => api2.request(`${base}/social/google_business/locations`),
7762
+ chooseGoogleBusinessLocation: (connectionId) => put(
7763
+ `${base}/social/google_business/location`,
7764
+ { connection_id: connectionId }
7765
+ ),
7766
+ disconnectGoogleBusiness: (connectionId) => api2.request(`${base}/social/google_business/${connectionId}`, { method: "DELETE" }),
7734
7767
  /** One channel's own pause switch (pauseSocial / resumeSocial hold every channel). */
7735
7768
  setChannelPaused: (channel, paused) => post(`${base}/social/channels/${channel}/${paused ? "pause" : "resume"}`),
7736
7769
  /** How often one channel posts. */
@@ -7740,14 +7773,56 @@ function domainApi(api2, domain) {
7740
7773
  ),
7741
7774
  /** Start a new picture for the post in the background (one AI generation); `replace` stops the one
7742
7775
  * already running; `instruction` (up to 300 characters) steers it: "gold border, our logo". */
7776
+ // `mode: "edit"` changes the post's current picture as `instruction` says. Another picture
7777
+ // being made here: this one waits its turn (status queued).
7778
+ // `count: 4` makes a set of 4 pictures from one storyboard (one AI generation), with words on each in
7779
+ // `textEffect` (an id from socialTextEffects; omit = Maggie picks).
7743
7780
  regenerateSocialImage: (id, opts = {}) => post(`${base}/social/${id}/image/regenerate`, {
7781
+ ...opts.style ? { style: opts.style } : {},
7744
7782
  ...opts.replace ? { replace: true } : {},
7783
+ ...opts.instruction?.trim() ? { instruction: opts.instruction.trim() } : {},
7784
+ ...opts.mode === "edit" ? { mode: "edit" } : {},
7785
+ ...opts.count && opts.count > 1 ? { count: opts.count } : {},
7786
+ ...opts.textEffect ? { text_effect: opts.textEffect } : {}
7787
+ }),
7788
+ /** Change a picture Maggie made without a new one (free): the words on each picture, its style, its text
7789
+ * style, the order of a set, or drop pictures from it. `words` follow the new order when `order` is given. */
7790
+ editSocialPicture: (id, changes) => api2.request(`${base}/social/${id}/picture`, {
7791
+ method: "PATCH",
7792
+ headers: { "Content-Type": "application/json" },
7793
+ body: JSON.stringify(changes)
7794
+ }),
7795
+ /** A title and a line on your own photo(s) in your look (Maggie plans the words; no AI picture, free). */
7796
+ wordsOnPhoto: (id, style = "real_photo") => post(`${base}/social/${id}/picture/words`, { style }),
7797
+ /** The brand's picture look (made the first time it's asked for). */
7798
+ socialLook: () => api2.request(`${base}/social/look`),
7799
+ updateSocialLook: (changes) => put(`${base}/social/look`, changes),
7800
+ /** Maggie looks again and suggests a new look (one AI generation). */
7801
+ suggestSocialLook: () => post(`${base}/social/look/suggest`, {}),
7802
+ /** A sample picture of a style in the brand's look: a data: URL. */
7803
+ socialLookSample: (style) => api2.request(`${base}/social/look/sample?style=${encodeURIComponent(style)}`),
7804
+ /** The text effects for the words on a set of pictures, each with a sample picture. */
7805
+ socialTextEffects: () => api2.request(`${base}/social/text-effects`),
7806
+ /** Your own photo (base64 JPEG) as the post's picture: no AI, no charge; only before it goes out.
7807
+ * With `instruction`, Maggie changes the photo as it says, in the background (one AI generation). */
7808
+ uploadSocialPhoto: (id, photo, opts = {}) => post(`${base}/social/${id}/image`, {
7809
+ photo,
7745
7810
  ...opts.instruction?.trim() ? { instruction: opts.instruction.trim() } : {}
7746
7811
  }),
7747
- /** Your own photo (base64 JPEG) as the post's picture: no AI, no charge; only before it goes out. */
7748
- uploadSocialPhoto: (id, photo) => post(`${base}/social/${id}/image`, { photo }),
7749
- /** Stop the picture being made (it's thrown away). */
7750
- stopSocialImage: () => api2.request(`${base}/social/image-job`, { method: "DELETE" }),
7812
+ /** A new picture for every post here without one (or these), one after another in the background. */
7813
+ fillSocialImages: (opts = {}) => post(
7814
+ `${base}/social/images/fill`,
7815
+ {
7816
+ ...opts.item_ids ? { item_ids: opts.item_ids } : {},
7817
+ ...opts.instruction?.trim() ? { instruction: opts.instruction.trim() } : {},
7818
+ ...opts.count && opts.count > 1 ? { count: opts.count } : {},
7819
+ ...opts.textEffect ? { text_effect: opts.textEffect } : {}
7820
+ }
7821
+ ),
7822
+ /** Stop the picture being made (it's thrown away; the next in line starts). `all` empties the line too. */
7823
+ stopSocialImage: (all = false) => api2.request(`${base}/social/image-job${all ? "?all=true" : ""}`, {
7824
+ method: "DELETE"
7825
+ }),
7751
7826
  /** Maggie changes the post as asked, in 3-255 characters (one AI generation). */
7752
7827
  rewriteSocial: (id, instruction) => post(`${base}/social/${id}/rewrite`, { instruction }),
7753
7828
  /** Maggie plans and writes a series; it waits for one OK. */
@@ -7760,13 +7835,35 @@ function domainApi(api2, domain) {
7760
7835
  brief: brief2,
7761
7836
  ...channels ? { channels } : {}
7762
7837
  }),
7838
+ // In the background: the answer is the job at once; watch `write_jobs` in GET /social.
7839
+ startSocialFromPhotos: (photos, brief2 = "", channels) => post(`${base}/social/from-photos`, {
7840
+ photos,
7841
+ brief: brief2,
7842
+ background: true,
7843
+ ...channels ? { channels } : {}
7844
+ }),
7845
+ startSocialFromPost: (sourcePostId, channels) => post(`${base}/social/from-post`, {
7846
+ source_post_id: sourcePostId,
7847
+ background: true,
7848
+ ...channels ? { channels } : {}
7849
+ }),
7850
+ startSocialPlan: (days, timezone, channels) => post(`${base}/social/plan`, {
7851
+ days,
7852
+ timezone,
7853
+ background: true,
7854
+ ...channels ? { channels } : {}
7855
+ }),
7856
+ startWriteSocialIdea: (id, channels) => post(`${base}/social/ideas/${id}/write`, {
7857
+ background: true,
7858
+ ...channels ? { channels } : {}
7859
+ }),
7763
7860
  /** Disconnect the website's LinkedIn account. */
7764
7861
  disconnectLinkedIn: (connectionId) => api2.request(`${base}/social/linkedin/${connectionId}`, { method: "DELETE" }),
7765
7862
  /** Published articles a LinkedIn post can be made from. */
7766
7863
  socialSources: (search = "") => api2.request(
7767
7864
  `${base}/social/sources?search=${encodeURIComponent(search)}`
7768
7865
  ),
7769
- /** Maggie writes a LinkedIn draft about one article. */
7866
+ /** Maggie writes a post about one article for each channel; `failed` lists a channel that could not be written while the others were. */
7770
7867
  socialFromPost: (sourcePostId, channels) => post(`${base}/social/from-post`, {
7771
7868
  source_post_id: sourcePostId,
7772
7869
  ...channels ? { channels } : {}
@@ -7825,6 +7922,12 @@ function domainApi(api2, domain) {
7825
7922
  headers: { "Content-Type": "application/json" },
7826
7923
  body: JSON.stringify({ publish_mode: mode })
7827
7924
  }),
7925
+ /** A Google Business post's button (LEARN_MORE, BOOK, ORDER, SHOP, SIGN_UP, CALL); "" = Learn more. */
7926
+ setSocialButton: (id, ctaType) => api2.request(`${base}/social/${id}`, {
7927
+ method: "PATCH",
7928
+ headers: { "Content-Type": "application/json" },
7929
+ body: JSON.stringify({ cta_type: ctaType })
7930
+ }),
7828
7931
  resumeSocial: () => post(`${base}/social/resume`),
7829
7932
  pauseAutopilot: () => post(`${base}/autopilot/pause`),
7830
7933
  resumeAutopilot: () => post(`${base}/autopilot/resume`),
@@ -7832,6 +7935,9 @@ function domainApi(api2, domain) {
7832
7935
  visibility: () => api2.request(`${base}/visibility`),
7833
7936
  searchConsole: (period2 = "30d") => api2.request(`${base}/search-console?period=${period2}`),
7834
7937
  searchConsoleQueries: (period2 = "30d", filter = "top", limit = 20) => api2.request(`${base}/search-console/queries?period=${period2}&filter=${filter}&limit=${limit}`),
7938
+ /** A Google sign-in link that connects Search Console for this website (open it in a
7939
+ * browser; back at returnTo with ?gsc=connected or ?gsc=error&message=…). 10 minutes. */
7940
+ connectSearchConsole: (returnTo = "close") => post(`${base}/search-console/connect`, { return_to: returnTo }),
7835
7941
  /** Fresh numbers from Google now; at most once an hour per website. */
7836
7942
  syncSearchConsole: () => post(`${base}/search-console/sync`),
7837
7943
  contentPerformance: (sort = "clicks", band, limit = 20) => api2.request(
@@ -9776,7 +9882,7 @@ var brief = (m) => ({
9776
9882
  var memoryTools = [
9777
9883
  tool({
9778
9884
  name: "memory_get",
9779
- description: "The user's Maggie Memory on this website: their saved taste per channel (general, blog, linkedin, facebook) as prefer / always / never items, each with an id. Already in your instructions when it is on; read it to answer what you remember or to find an id to forget.",
9885
+ description: "The user's Maggie Memory on this website: their saved taste per channel (general, blog, linkedin, facebook, instagram, google_business) as prefer / always / never items, each with an id. Already in your instructions when it is on; read it to answer what you remember or to find an id to forget.",
9780
9886
  parameters: none,
9781
9887
  group: "memory",
9782
9888
  need: own,
@@ -10074,9 +10180,21 @@ var reportTools = [
10074
10180
  };
10075
10181
  }
10076
10182
  }),
10183
+ tool({
10184
+ name: "gsc_connect_link",
10185
+ description: "A Google sign-in link for the user to connect Google Search Console for this website (or reconnect). Give them the link to open; never ask for their Google password. They must sign in with a Google account that can see this website in Search Console; if it can't, the page says which account and how to add it.",
10186
+ parameters: none,
10187
+ group: "reports",
10188
+ need: { resource: "autopilot", level: "write" },
10189
+ risk: "W1",
10190
+ run: async (ctx) => {
10191
+ const out = await ws(ctx).connectSearchConsole("close");
10192
+ return { url: out.url, expires_in_seconds: out.expires_in_seconds };
10193
+ }
10194
+ }),
10077
10195
  tool({
10078
10196
  name: "gsc_performance_get",
10079
- description: "Google Search Console for the period (30d, 90d or 12m): clicks, impressions, CTR and average position, with the change against the period before, the daily trend and the top pages.",
10197
+ description: "Google Search Console for the period (30d, 90d or 12m): clicks, impressions, CTR and average position, with the change against the period before (clicks and impressions as a ratio: -0.25 = 25% fewer, null when there was nothing before; ctr in points as a fraction; position in places, lower is better), the daily trend and the top pages.",
10080
10198
  parameters: { type: "object", properties: { period: { type: "string", enum: periods } } },
10081
10199
  group: "reports",
10082
10200
  need: read4,
@@ -10243,7 +10361,7 @@ var reportTools = [
10243
10361
  var read5 = { resource: "autopilot", level: "read" };
10244
10362
  var write5 = { resource: "autopilot", level: "write" };
10245
10363
  var moves2 = ["up", "down", "top"];
10246
- var CHANNEL_KEYS = ["linkedin", "facebook"];
10364
+ var CHANNEL_KEYS = ["linkedin", "facebook", "instagram", "google_business"];
10247
10365
  var channelsParam = {
10248
10366
  type: "array",
10249
10367
  items: { type: "string", enum: CHANNEL_KEYS },
@@ -10253,6 +10371,13 @@ var channelsOf = (value) => {
10253
10371
  const list2 = Array.isArray(value) ? value.map((v) => String(v).toLowerCase()).filter((v) => CHANNEL_KEYS.includes(v)) : [];
10254
10372
  return list2.length ? list2 : void 0;
10255
10373
  };
10374
+ var writing = (job) => ({
10375
+ job_id: job.id,
10376
+ status: "writing",
10377
+ posts_expected: job.expected,
10378
+ channels: job.channels,
10379
+ note: "Maggie is writing in the background (a minute or two). Tell the user they'll be told when it's ready; social_write_status says when it's done."
10380
+ });
10256
10381
  var item = (i) => ({
10257
10382
  id: i.id,
10258
10383
  channel: i.provider || "linkedin",
@@ -10371,7 +10496,7 @@ var socialTools = [
10371
10496
  }),
10372
10497
  tool({
10373
10498
  name: "social_image_new",
10374
- description: "Make a new picture for a LinkedIn post that hasn't gone out (uses 1 AI generation). It is made in the background, on the user's own ChatGPT when their Maggie Bridge has images on, else by CMO.so; it takes up to a couple of minutes and appears on the post by itself (check with social_image_status). One picture is made at a time per website: if another is being made this fails with image_busy; only pass replace: true when the user agrees to stop that one. A post written from an article gets its own picture (from its text and the article's title) and then goes out as that picture.",
10499
+ description: "Make a new picture for a social post that hasn't gone out, or change its current one (mode: edit, as `instruction` says). Uses 1 AI generation. It is made in the background, on the user's own ChatGPT when their Maggie Bridge has images on, else by CMO.so; it takes up to a couple of minutes and appears on the post by itself (check with social_image_status). One picture is made at a time per website: while another is being made this one waits in line (status queued). It fails with image_busy only when this post already has one being made or in line; pass replace: true only when the user agrees to stop the one being made and make this one now. A post written from an article gets its own picture (from its text and the article's title) and then goes out as that picture. Every new picture carries a short title and line set on it; count: 4 makes a set of 4 pictures that tell one story (still 1 AI generation, drawn as one storyboard and cut); LinkedIn and Facebook post a set together as a collage. text_effect picks the style of those words (an id from social_text_effects); leave it out to let Maggie pick. style picks the picture style (an id from social_look: photo_headline, editorial, duotone, illustrated, bold_type, infographic); leave it out and Maggie takes turns with the brand's 3. bold_type and infographic make no AI picture (big words or a list in the brand's look) and cost nothing.",
10375
10500
  parameters: {
10376
10501
  type: "object",
10377
10502
  properties: {
@@ -10380,6 +10505,23 @@ var socialTools = [
10380
10505
  instruction: {
10381
10506
  type: "string",
10382
10507
  description: "What the user wants in the picture, in their words (up to 300 characters), e.g. 'gold border, our logo, Future 100 \xB7 2025'. Leave out when they gave no direction."
10508
+ },
10509
+ mode: {
10510
+ type: "string",
10511
+ enum: ["new", "edit"],
10512
+ description: "edit: change the post's current picture as the instruction says (it must have one)"
10513
+ },
10514
+ count: {
10515
+ type: "integer",
10516
+ description: "1 (default) or 4: a set of 4 pictures telling one story, a line of words on each"
10517
+ },
10518
+ text_effect: {
10519
+ type: "string",
10520
+ description: "For a set: the words' style id from social_text_effects (omit = Maggie picks)"
10521
+ },
10522
+ style: {
10523
+ type: "string",
10524
+ description: "Picture style id from social_look (omit = Maggie picks from the brand's 3)"
10383
10525
  }
10384
10526
  },
10385
10527
  required: ["id"]
@@ -10388,36 +10530,253 @@ var socialTools = [
10388
10530
  need: write5,
10389
10531
  risk: "W2",
10390
10532
  gates: ["VER", "CR"],
10391
- run: async (ctx, { id, replace, instruction }) => {
10533
+ run: async (ctx, { id, replace, instruction, mode, count, text_effect, style }) => {
10392
10534
  const out = await ws(ctx).regenerateSocialImage(Number(id), {
10393
10535
  replace: replace === true,
10536
+ ...typeof style === "string" && style.trim() && mode !== "edit" ? { style: style.trim() } : {},
10537
+ ...mode === "edit" ? { mode: "edit" } : {},
10538
+ ...Number(count) === 4 && mode !== "edit" ? { count: 4 } : {},
10539
+ ...typeof text_effect === "string" && text_effect.trim() ? { textEffect: text_effect.trim() } : {},
10394
10540
  ...typeof instruction === "string" && instruction.trim() ? { instruction: instruction.trim().slice(0, 300) } : {}
10395
10541
  });
10396
10542
  return {
10397
10543
  id: out.id,
10398
10544
  image_job: out.image_job,
10399
- note: "Making it in the background; it shows on the post when ready."
10545
+ note: out.image_job?.status === "queued" ? "In line after the picture being made now; it shows on the post when ready." : "Making it in the background; it shows on the post when ready."
10546
+ };
10547
+ }
10548
+ }),
10549
+ tool({
10550
+ name: "social_images_fill",
10551
+ description: "A new picture for every social post here that hasn't gone out and has none (or only these ids), made one after another in the background: 1 AI generation each. A LinkedIn and a Facebook post of the same idea share one picture. Says how many are in line, how many already were, and why it stopped early (the line is full, or the day's AI generations ran out). Preview the count first.",
10552
+ parameters: {
10553
+ type: "object",
10554
+ properties: {
10555
+ ids: { type: "array", items: { type: "integer" }, description: "Only these posts (from social_list)" },
10556
+ instruction: { type: "string", description: "What the user wants in every picture, up to 300 characters" }
10557
+ }
10558
+ },
10559
+ group: "social",
10560
+ need: write5,
10561
+ risk: "W2",
10562
+ gates: ["VER", "CR"],
10563
+ run: async (ctx, { ids: ids2, instruction }) => {
10564
+ const out = await ws(ctx).fillSocialImages({
10565
+ ...Array.isArray(ids2) && ids2.length ? { item_ids: ids2.map(Number) } : {},
10566
+ ...typeof instruction === "string" && instruction.trim() ? { instruction: instruction.trim().slice(0, 300) } : {}
10567
+ });
10568
+ return { queued: out.queued, already: out.skipped, stopped_because: out.message, line: out.image_jobs.length };
10569
+ }
10570
+ }),
10571
+ tool({
10572
+ name: "social_text_effects",
10573
+ description: "The styles for the words on a set of pictures (social_image_new with count 4): id, name, family and a sample picture URL. Use when the user wants to choose how the words look ('bold sticker', 'neon', 'gold').",
10574
+ parameters: none,
10575
+ group: "social",
10576
+ need: read5,
10577
+ risk: "R0",
10578
+ run: async (ctx) => {
10579
+ const out = await ws(ctx).socialTextEffects();
10580
+ return { effects: out.effects.map(({ id, name, family }) => ({ id, name, family })), auto: out.auto };
10581
+ }
10582
+ }),
10583
+ tool({
10584
+ name: "social_look",
10585
+ description: "The brand's picture look on this website (made the first time it's asked for): the 3 picture styles Maggie takes turns with, the 5 text styles she picks from per picture, two fonts, the colours (ink, paper, primary, accent, muted), a short description of how its photos look, and things never to show; plus every style, font and text style that can be chosen. Read it before changing the look or when the user asks how their pictures look.",
10586
+ parameters: none,
10587
+ group: "social",
10588
+ need: read5,
10589
+ risk: "R0",
10590
+ run: async (ctx) => {
10591
+ const l = await ws(ctx).socialLook();
10592
+ return {
10593
+ styles: l.styles.map((s) => ({ id: s.id, name: s.name, about: s.about })),
10594
+ text_effects: l.text_effects.map((e) => ({ id: e.id, name: e.name, family: e.family })),
10595
+ fonts: l.fonts,
10596
+ colours: l.colours,
10597
+ description: l.brand_suffix,
10598
+ never: l.never,
10599
+ why: l.suggested.reason ?? null,
10600
+ can_choose: {
10601
+ styles: l.catalogue.styles.map((s) => ({ id: s.id, name: s.name, led: s.led, needs_photo: s.needs_photo })),
10602
+ fonts: l.catalogue.fonts,
10603
+ text_effect_families: [...new Set(l.catalogue.text_effects.map((e) => e.family))]
10604
+ }
10400
10605
  };
10401
10606
  }
10402
10607
  }),
10608
+ tool({
10609
+ name: "social_look_update",
10610
+ description: "Change the brand's picture look: the 3 styles Maggie takes turns with (style_ids, 1-3), the text styles (text_effect_ids, 1-5, ids from social_text_effects), fonts, colours (hex), the description of how photos look, things never to show, or reset: true (back to Maggie's suggestion). New pictures use it; pictures already made keep theirs (social_picture_edit changes one). Preview the change first.",
10611
+ parameters: {
10612
+ type: "object",
10613
+ properties: {
10614
+ style_ids: { type: "array", items: { type: "string" }, description: "1-3 picture style ids" },
10615
+ text_effect_ids: { type: "array", items: { type: "string" }, description: "1-5 text style ids" },
10616
+ font_display: { type: "string", description: "Font for big words (from social_look can_choose.fonts)" },
10617
+ font_body: { type: "string", description: "Font for lines and lists" },
10618
+ colours: {
10619
+ type: "object",
10620
+ description: "Any of these as #RRGGBB",
10621
+ properties: {
10622
+ ink: { type: "string", description: "Text on paper" },
10623
+ paper: { type: "string", description: "The light ground" },
10624
+ primary: { type: "string", description: "The brand colour" },
10625
+ accent: { type: "string", description: "A second colour" },
10626
+ muted: { type: "string", description: "Small text" }
10627
+ }
10628
+ },
10629
+ description: { type: "string", description: "How the brand's photos look, up to 600 characters" },
10630
+ never: { type: "array", items: { type: "string" }, description: "Things never to show (the whole list)" },
10631
+ reset: { type: "boolean", description: "Back to Maggie's suggested look" }
10632
+ }
10633
+ },
10634
+ group: "social",
10635
+ need: write5,
10636
+ risk: "W1",
10637
+ gates: ["VER"],
10638
+ run: async (ctx, a) => {
10639
+ const fonts = {
10640
+ ...a.font_display ? { display: a.font_display } : {},
10641
+ ...a.font_body ? { body: a.font_body } : {}
10642
+ };
10643
+ const l = await ws(ctx).updateSocialLook({
10644
+ ...a.style_ids ? { style_ids: a.style_ids } : {},
10645
+ ...a.text_effect_ids ? { text_effect_ids: a.text_effect_ids } : {},
10646
+ ...Object.keys(fonts).length ? { fonts } : {},
10647
+ ...a.colours ? { colours: a.colours } : {},
10648
+ ...typeof a.description === "string" ? { brand_suffix: a.description } : {},
10649
+ ...a.never ? { never: a.never } : {},
10650
+ ...a.reset ? { reset: true } : {}
10651
+ });
10652
+ return {
10653
+ styles: l.styles.map((s) => s.id),
10654
+ text_effects: l.text_effects.map((e) => e.id),
10655
+ fonts: l.fonts,
10656
+ colours: l.colours
10657
+ };
10658
+ }
10659
+ }),
10660
+ tool({
10661
+ name: "social_picture_edit",
10662
+ description: "Change a picture Maggie made for a post that hasn't gone out, without making a new one (free, a few seconds): the words on each picture (title up to 60 characters, line up to 90), its picture style, its text style, or for a set the order (indexes, 0 = first) or pictures to drop. Only posts whose picture says editable in social_list; a photo style needs the picture's photos (has_photos). Changing the words of one picture: send every picture's words in order. Preview first.",
10663
+ parameters: {
10664
+ type: "object",
10665
+ properties: {
10666
+ id: { type: "integer", description: "The post (from social_list)" },
10667
+ words: {
10668
+ type: "array",
10669
+ items: {
10670
+ type: "object",
10671
+ properties: { headline: { type: "string" }, sub: { type: "string" } },
10672
+ required: ["headline"]
10673
+ },
10674
+ description: "The words on each picture, in order (in the new order when order is given)"
10675
+ },
10676
+ style: { type: "string", description: "A picture style id from social_look" },
10677
+ text_effect: { type: "string", description: "A text style id from social_text_effects" },
10678
+ order: { type: "array", items: { type: "integer" }, description: "The pictures in their new order" },
10679
+ remove: { type: "array", items: { type: "integer" }, description: "Pictures to drop from a set" }
10680
+ },
10681
+ required: ["id"]
10682
+ },
10683
+ group: "social",
10684
+ need: write5,
10685
+ risk: "W1",
10686
+ gates: ["VER"],
10687
+ run: async (ctx, { id, words, style, text_effect, order, remove: remove2 }) => {
10688
+ const out = await ws(ctx).editSocialPicture(Number(id), {
10689
+ ...Array.isArray(words) ? { words: words.map((w) => ({ headline: String(w.headline ?? ""), sub: String(w.sub ?? "") })) } : {},
10690
+ ...style ? { style } : {},
10691
+ ...text_effect ? { text_effect } : {},
10692
+ ...Array.isArray(order) ? { order: order.map(Number) } : {},
10693
+ ...Array.isArray(remove2) ? { remove: remove2.map(Number) } : {}
10694
+ });
10695
+ return { id: out.id, pictures: out.image_urls?.length ? out.image_urls : [out.image_url], picture: out.picture };
10696
+ }
10697
+ }),
10698
+ tool({
10699
+ name: "social_photo_words",
10700
+ description: "Put a title and a line on the user's own photo(s) on a post, in the brand's look: Maggie writes the words from the post (no AI picture, free). Only for a post whose picture is the user's own photo (own_photo in social_list). style: real_photo (default, the photo framed with the words below), product_hero (the words on a card), or another photo style. Then social_picture_edit changes the words. Preview first.",
10701
+ parameters: {
10702
+ type: "object",
10703
+ properties: {
10704
+ id: { type: "integer", description: "The post (from social_list)" },
10705
+ style: {
10706
+ type: "string",
10707
+ description: "real_photo (default), product_hero, photo_headline, editorial, duotone"
10708
+ }
10709
+ },
10710
+ required: ["id"]
10711
+ },
10712
+ group: "social",
10713
+ need: write5,
10714
+ risk: "W1",
10715
+ gates: ["VER"],
10716
+ run: async (ctx, { id, style }) => {
10717
+ const out = await ws(ctx).wordsOnPhoto(Number(id), style || "real_photo");
10718
+ return { id: out.id, picture: out.picture, pictures: out.image_urls?.length ? out.image_urls : [out.image_url] };
10719
+ }
10720
+ }),
10721
+ tool({
10722
+ name: "social_post_insights",
10723
+ description: "How a posted Instagram post is doing: views, reach, likes, comments, saves and shares, read from Instagram (kept 15 minutes; refresh: true reads again). Saves and shares per reach are the best signs of a good post. available: false says why (not posted yet, deleted on Instagram, the account needs reconnecting).",
10724
+ parameters: {
10725
+ type: "object",
10726
+ properties: {
10727
+ id: { type: "integer", description: "A posted Instagram post (from social_list posted)" },
10728
+ refresh: { type: "boolean", description: "Read the numbers again now" }
10729
+ },
10730
+ required: ["id"]
10731
+ },
10732
+ group: "social",
10733
+ need: read5,
10734
+ risk: "R0",
10735
+ run: async (ctx, { id, refresh }) => ws(ctx).socialInsights(Number(id), refresh === true)
10736
+ }),
10737
+ tool({
10738
+ name: "social_write_status",
10739
+ description: "Posts Maggie is writing in the background for this user on this website (from social_from_article, social_plan_days, social_idea_write or the app), and the ones finished in the last 10 minutes: running, done (the new post ids) or failed (why), and any channel that couldn't be written. Look once when the user asks, not in a loop.",
10740
+ parameters: none,
10741
+ group: "social",
10742
+ need: read5,
10743
+ risk: "R0",
10744
+ run: async (ctx) => ({
10745
+ jobs: ((await ws(ctx).social()).write_jobs ?? []).map((j) => ({
10746
+ id: j.id,
10747
+ kind: j.kind,
10748
+ status: j.status,
10749
+ channels: j.channels,
10750
+ expected: j.expected,
10751
+ written: j.item_ids,
10752
+ queued: j.queued,
10753
+ ...j.failed?.length ? { failed: j.failed } : {},
10754
+ ...j.error ? { error: j.error } : {},
10755
+ started_at: j.started_at
10756
+ }))
10757
+ })
10758
+ }),
10403
10759
  tool({
10404
10760
  name: "social_image_status",
10405
- description: "Whether a new LinkedIn picture is being made on this website (which post, since when), or how the last one ended (done, failed with why, stopped) and who drew it (chatgpt or gemini).",
10761
+ description: "The picture being made on this website and those waiting in line (which post, new or edit), or how the last one ended (done, failed with why, stopped) and who drew it (chatgpt or gemini).",
10406
10762
  parameters: none,
10407
10763
  group: "social",
10408
10764
  need: read5,
10409
10765
  risk: "R0",
10410
- run: async (ctx) => ({ image_job: (await ws(ctx).social()).image_job ?? null })
10766
+ run: async (ctx) => {
10767
+ const s = await ws(ctx).social();
10768
+ return { image_job: s.image_job ?? null, line: s.image_jobs ?? [] };
10769
+ }
10411
10770
  }),
10412
10771
  tool({
10413
10772
  name: "social_image_stop",
10414
- description: "Stop the LinkedIn picture being made on this website; the post keeps the picture it had.",
10415
- parameters: none,
10773
+ description: "Stop the picture being made on this website (the post keeps the picture it had; the next in line starts). all: true also empties the line.",
10774
+ parameters: { type: "object", properties: { all: { type: "boolean" } } },
10416
10775
  group: "social",
10417
10776
  need: write5,
10418
10777
  risk: "W1",
10419
10778
  gates: ["VER"],
10420
- run: async (ctx) => ws(ctx).stopSocialImage()
10779
+ run: async (ctx, { all }) => ws(ctx).stopSocialImage(all === true)
10421
10780
  }),
10422
10781
  tool({
10423
10782
  name: "social_move",
@@ -10461,7 +10820,7 @@ var socialTools = [
10461
10820
  }),
10462
10821
  tool({
10463
10822
  name: "social_from_article",
10464
- description: "Maggie writes a post about one published article (id from social_sources_list) for each channel. It waits for the user's OK as a draft, unless their approval mode is auto (then it goes to the front of the queue).",
10823
+ description: "Maggie writes a post about one published article (id from social_sources_list) for each channel. It waits for the user's OK as a draft, unless their approval mode is auto (then it goes to the front of the queue). Written in the background (a minute or two): this returns at once with a job. Tell the user Maggie is writing and they will be told when it's ready; before saying what was written, check social_write_status (then social_list for the posts).",
10465
10824
  parameters: {
10466
10825
  type: "object",
10467
10826
  properties: {
@@ -10475,14 +10834,11 @@ var socialTools = [
10475
10834
  need: write5,
10476
10835
  risk: "W2",
10477
10836
  gates: ["VER", "LI", "LLM"],
10478
- run: async (ctx, { source_id, channels }) => {
10479
- const out = await ws(ctx).socialFromPost(String(source_id), channelsOf(channels));
10480
- return { id: out.id, status: out.status, queued: Boolean(out.queued), text: clip(out.social_copy, 300) };
10481
- }
10837
+ run: async (ctx, { source_id, channels }) => writing((await ws(ctx).startSocialFromPost(String(source_id), channelsOf(channels))).job)
10482
10838
  }),
10483
10839
  tool({
10484
10840
  name: "social_plan_days",
10485
- description: "Maggie writes posts for the next 1\u20137 days from the best recent articles, on each channel. They wait for the user's OK as drafts, unless the user's approval mode is auto (then they are queued in order).",
10841
+ description: "Maggie writes posts for the next 1\u20137 days from the best recent articles, on each channel. They wait for the user's OK as drafts, unless the user's approval mode is auto (then they are queued in order). Written in the background (a minute or two): this returns at once with a job. Tell the user Maggie is writing and they will be told when it's ready; before saying what was written, check social_write_status (then social_list for the posts).",
10486
10842
  parameters: {
10487
10843
  type: "object",
10488
10844
  properties: {
@@ -10496,10 +10852,7 @@ var socialTools = [
10496
10852
  need: write5,
10497
10853
  risk: "W2",
10498
10854
  gates: ["VER", "LI", "LLM"],
10499
- run: async (ctx, { days, timezone, channels }) => {
10500
- const out = await ws(ctx).socialPlan(int(days, 1, 7, 3), timezone || "UTC", channelsOf(channels));
10501
- return { written: out.items.length, queued: Boolean(out.queued), items: out.items.map(item) };
10502
- }
10855
+ run: async (ctx, { days, timezone, channels }) => writing((await ws(ctx).startSocialPlan(int(days, 1, 7, 3), timezone || "UTC", channelsOf(channels))).job)
10503
10856
  }),
10504
10857
  tool({
10505
10858
  name: "social_ideas_list",
@@ -10572,7 +10925,7 @@ var socialTools = [
10572
10925
  }),
10573
10926
  tool({
10574
10927
  name: "social_idea_write",
10575
- description: "Maggie writes one idea's post for each channel (1 credit per post). The user's own idea's posts wait for their OK (queued straight away only in approval mode auto); a campaign's wait for the campaign to start.",
10928
+ description: "Maggie writes one idea's post for each channel (1 credit per post). The user's own idea's posts wait for their OK (queued straight away only in approval mode auto); a campaign's wait for the campaign to start. Written in the background (a minute or two): this returns at once with a job. Tell the user Maggie is writing and they will be told when it's ready; before saying what was written, check social_write_status (then social_list for the posts).",
10576
10929
  parameters: {
10577
10930
  type: "object",
10578
10931
  properties: {
@@ -10586,7 +10939,7 @@ var socialTools = [
10586
10939
  need: write5,
10587
10940
  risk: "W2",
10588
10941
  gates: ["VER", "LI", "CR", "LLM"],
10589
- run: async (ctx, { id, channels }) => ws(ctx).writeSocialIdea(Number(id), void 0, channelsOf(channels))
10942
+ run: async (ctx, { id, channels }) => writing((await ws(ctx).startWriteSocialIdea(Number(id), channelsOf(channels))).job)
10590
10943
  }),
10591
10944
  tool({
10592
10945
  name: "social_idea_brief",
@@ -10883,9 +11236,9 @@ var socialTools = [
10883
11236
  run: async (ctx, { keys: keys2, ...options }) => {
10884
11237
  const api2 = ws(ctx);
10885
11238
  const current = (await api2.socialSetup()).writing;
10886
- const writing = { ...current };
10887
- for (const [k, v] of Object.entries(options)) if (v !== void 0) writing[k] = v;
10888
- return api2.socialSetupTemplates((keys2 ?? []).slice(0, 10), writing);
11239
+ const writing2 = { ...current };
11240
+ for (const [k, v] of Object.entries(options)) if (v !== void 0) writing2[k] = v;
11241
+ return api2.socialSetupTemplates((keys2 ?? []).slice(0, 10), writing2);
10889
11242
  }
10890
11243
  }),
10891
11244
  tool({
@@ -10966,6 +11319,52 @@ var socialTools = [
10966
11319
  const out = await ws(ctx).connectFacebook("close");
10967
11320
  return { url: out.url, expires_in_seconds: out.expires_in_seconds };
10968
11321
  }
11322
+ }),
11323
+ tool({
11324
+ name: "google_business_connect_link",
11325
+ description: "A link for the user to connect their Google Business Profile (or reconnect): they sign in with the Google account that manages the profile; every profile it can post to is saved and the one whose website is this site is picked (else they pick it in the app). Only verified profiles can post. Give them the link to open; never ask for a password. Google posts are short local updates with one photo and a button; Google checks each one before it shows.",
11326
+ parameters: none,
11327
+ group: "social",
11328
+ need: write5,
11329
+ risk: "W1",
11330
+ gates: ["VER"],
11331
+ run: async (ctx) => {
11332
+ const out = await ws(ctx).connectGoogleBusiness("close");
11333
+ return { url: out.url, expires_in_seconds: out.expires_in_seconds };
11334
+ }
11335
+ }),
11336
+ tool({
11337
+ name: "social_google_button",
11338
+ description: "Set the button on a Google Business post that hasn't gone out: LEARN_MORE (default, opens the post's link), BOOK (a booking link), ORDER, SHOP, SIGN_UP, or CALL (calls the profile's phone number; needs no link). Pick the one that matches what the post asks people to do. Preview first.",
11339
+ parameters: {
11340
+ type: "object",
11341
+ properties: {
11342
+ id: { type: "integer", description: "A Google Business post (from social_list)" },
11343
+ button: { type: "string", enum: ["LEARN_MORE", "BOOK", "ORDER", "SHOP", "SIGN_UP", "CALL"] }
11344
+ },
11345
+ required: ["id", "button"]
11346
+ },
11347
+ group: "social",
11348
+ need: write5,
11349
+ risk: "W1",
11350
+ gates: ["VER"],
11351
+ run: async (ctx, { id, button }) => {
11352
+ const out = await ws(ctx).setSocialButton(Number(id), button);
11353
+ return { id: out.id, button: out.cta_type ?? "LEARN_MORE", link: out.cta_url ?? null };
11354
+ }
11355
+ }),
11356
+ tool({
11357
+ name: "instagram_connect_link",
11358
+ description: "A link for the user to connect Instagram (or reconnect). Instagram connects through the Facebook sign-in: only an Instagram professional account (Business or Creator) linked to one of their Facebook Pages can be posted to, so tell them that first. Give them the link to open; never ask for a password. Every Instagram post goes out with its picture (no links in it).",
11359
+ parameters: none,
11360
+ group: "social",
11361
+ need: write5,
11362
+ risk: "W1",
11363
+ gates: ["VER"],
11364
+ run: async (ctx) => {
11365
+ const out = await ws(ctx).connectInstagram("close");
11366
+ return { url: out.url, expires_in_seconds: out.expires_in_seconds };
11367
+ }
10969
11368
  })
10970
11369
  ];
10971
11370
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmo-so/mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "CMO.so's MCP server for Claude Desktop, Cursor, VS Code and other MCP clients: manage your websites, blog posts, LinkedIn queue and results with Maggie.",
5
5
  "type": "module",
6
6
  "license": "MIT",