@posty5/mcp 2.0.0 → 2.2.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.mjs CHANGED
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  import { QrPrintPresets, QR_PRINT_DPI_VALUES, presetWidthMm, QR_PRINT_DPI_DEFAULT } from '@posty5/qr-design';
4
4
  import { randomUUID, timingSafeEqual, createHmac, createHash } from 'crypto';
5
5
  import { AuthorizationError, Posty5BulkCreateError, LINK_BULK_TERMINAL_STATUSES, AuthenticationError, NotFoundError, RateLimitError, ConflictError, VersionRequiredError, ValidationError, NetworkError, ServerError, Posty5Error, HttpClient } from '@posty5/core';
6
- import { MAX_COMMENT_LENGTH, MAX_COMMENT_DELAY_MINUTES, MAX_POST_COMMENTS, SocialPublisherPostClient } from '@posty5/social-publisher-post';
6
+ import { MAX_COMMENT_LENGTH, MAX_COMMENT_DELAY_MINUTES, MAX_POST_COMMENTS_TOTAL, MAX_POST_COMMENTS_PER_PLATFORM, SocialPublisherPostClient } from '@posty5/social-publisher-post';
7
7
  import { AccountClient } from '@posty5/account';
8
8
  import { HtmlHostingClient } from '@posty5/html-hosting';
9
9
  import { HtmlHostingFormSubmissionClient } from '@posty5/html-hosting-form-submission';
@@ -75,7 +75,7 @@ var MS_PER_MINUTE = 60 * 1e3;
75
75
  // src/config/instructions.config.ts
76
76
  var SERVER_NAME = "posty5";
77
77
  var SERVER_TITLE = "Posty5";
78
- var PACKAGE_VERSION = "2.0.0";
78
+ var PACKAGE_VERSION = "2.2.0";
79
79
  var SERVER_INSTRUCTIONS = [
80
80
  "Posty5 is a platform for short links, QR codes, hosted HTML pages and social media publishing. These tools act on the Posty5 account this connection belongs to.",
81
81
  "Start with account_get_current to see which account and plan you are working with.",
@@ -1645,9 +1645,11 @@ var SOCIAL_POST_STATUSES = [
1645
1645
  "retrying",
1646
1646
  "removing",
1647
1647
  "removed",
1648
- "removeFailed"
1648
+ "removeFailed",
1649
+ "partiallyRemoved"
1649
1650
  ];
1650
1651
  var SOCIAL_POST_PLATFORMS = ["youtube", "facebook", "instagram", "tiktok"];
1652
+ var SOCIAL_POST_REMOVE_PLATFORMS = ["youtube", "facebook", "instagram", "tiktok", "threads", "twitter"];
1651
1653
  var VIDEO_PLATFORM_BLOCKS = ["youtube", "tiktok", "facebook", "instagram"];
1652
1654
  var SOCIAL_POST_TARGETS = ["workspaceId", "accountId"];
1653
1655
  var TIKTOK_PRIVACY_LEVELS = ["PUBLIC_TO_EVERYONE", "FOLLOWER_OF_CREATOR", "MUTUAL_FOLLOW_FRIENDS", "SELF_ONLY"];
@@ -1667,6 +1669,8 @@ var IMAGE_CAPTION_MAX_LENGTH = 8e3;
1667
1669
  var YOUTUBE_TITLE_MAX_LENGTH = 100;
1668
1670
  var THREADS_TEXT_MAX_LENGTH = 500;
1669
1671
  var TWITTER_TEXT_MAX_WEIGHTED_LENGTH = 280;
1672
+ var MAX_WORKSPACE_DEFAULT_COMMENTS = 10;
1673
+ var COMMENT_POST_TYPES = ["shortVideo", "longVideo", "image", "text"];
1670
1674
 
1671
1675
  // src/core/social-publisher.helper.ts
1672
1676
  function toScheduleConfig(scheduledAt) {
@@ -1690,6 +1694,7 @@ function videoPublishOptions(args) {
1690
1694
  facebook: args.facebook,
1691
1695
  instagram: args.instagram,
1692
1696
  comment: args.comment,
1697
+ allowPostDefaultComments: args.allowPostDefaultComments,
1693
1698
  schedule: args.scheduledAt ? new Date(args.scheduledAt) : void 0,
1694
1699
  tag: args.tag,
1695
1700
  refId: args.refId
@@ -1756,7 +1761,19 @@ var commentsField = z.array(
1756
1761
  imageUrl: z.string().url().optional().describe("A public image to attach \u2014 Facebook only."),
1757
1762
  ...commentFlags
1758
1763
  })
1759
- ).max(MAX_POST_COMMENTS).optional().describe(`Up to ${MAX_POST_COMMENTS} comments posted under the post once it is live, in order. Each is charged separately; see account_get_operation_costs.`);
1764
+ ).max(MAX_POST_COMMENTS_TOTAL).optional().describe(`Up to ${MAX_POST_COMMENTS_PER_PLATFORM} comments per platform (${MAX_POST_COMMENTS_TOTAL} in all), posted under the post once it is live, in order. Each is charged separately; see account_get_operation_costs.`);
1765
+ var allowDefaultCommentsField = z.boolean().optional().describe(
1766
+ "Add the saved default comments (default true): a workspace's defaults for this post type plus account defaults marked applyToWorkspacePosts, or an account's own. They are added after `comments` and charged like any other comment. Send false to add none \u2014 do so when you already put the defaults you want into `comments` (social_workspace_resolve_default_comments lists them)."
1767
+ );
1768
+ var workspaceDefaultCommentField = z.object({
1769
+ _id: z.string().optional().describe("Send it back to edit this default; omit it to add one."),
1770
+ text: z.string().min(1).max(MAX_COMMENT_LENGTH),
1771
+ delayMinutes: z.number().int().min(0).max(MAX_COMMENT_DELAY_MINUTES).optional().describe("Minutes to wait after the post is live. Default 0."),
1772
+ imageUrl: z.string().url().optional().describe("A public image to attach \u2014 Facebook and Threads only."),
1773
+ isActive: z.boolean().optional().describe("An inactive default is kept but never added. Default true."),
1774
+ postTypes: z.array(z.enum(COMMENT_POST_TYPES)).optional().describe("The post types it is added to. Empty or absent: all of them."),
1775
+ ...commentFlags
1776
+ });
1760
1777
  var videoPostFields = {
1761
1778
  ...targetFields2,
1762
1779
  videoUrl: z.string().url().describe("A direct, public URL of the video file (.mp4, .mov, .avi, .mkv or .webm). Files cannot be uploaded through this tool."),
@@ -1766,6 +1783,7 @@ var videoPostFields = {
1766
1783
  facebook: facebookBlock,
1767
1784
  instagram: instagramBlock,
1768
1785
  comment: videoCommentField,
1786
+ allowPostDefaultComments: allowDefaultCommentsField,
1769
1787
  scheduledAt: scheduledAtField,
1770
1788
  ...labelFields2
1771
1789
  };
@@ -1804,6 +1822,42 @@ var SOCIAL_PUBLISHER_TOOLS = [
1804
1822
  input: z.object({ id: idField(WORKSPACE_ID) }),
1805
1823
  run: ({ id }, { clients }) => clients.workspaces.getForNewPost(id)
1806
1824
  }),
1825
+ defineTool({
1826
+ name: "social_workspace_get_default_comments",
1827
+ toolset: "social-publisher",
1828
+ access: "read",
1829
+ title: "Workspace default comments",
1830
+ description: "The comments every new post to this workspace starts with, in order, each with the post types it applies to (empty = all) and its platforms. Read the workspace's __v with social_workspace_get before changing them.",
1831
+ input: z.object({ id: idField(WORKSPACE_ID) }),
1832
+ run: async ({ id }, { clients }) => ({ comments: await clients.workspaces.getDefaultComments(id) })
1833
+ }),
1834
+ defineTool({
1835
+ name: "social_workspace_resolve_default_comments",
1836
+ toolset: "social-publisher",
1837
+ access: "read",
1838
+ title: "Preview a new post's default comments",
1839
+ description: "The default comments a new post of postType to this workspace would get right now: the workspace's own for that type, then account defaults marked applyToWorkspacePosts, aimed only at platforms the workspace has accounts on. warnings lists any dropped at a platform's ceiling. To publish an edited list, pass it as the post's comments with allowPostDefaultComments: false.",
1840
+ input: z.object({ id: idField(WORKSPACE_ID), postType: z.enum(COMMENT_POST_TYPES) }),
1841
+ run: ({ id, postType }, { clients }) => clients.workspaces.resolveDefaultComments(id, postType)
1842
+ }),
1843
+ defineTool({
1844
+ name: "social_workspace_set_default_comments",
1845
+ toolset: "social-publisher",
1846
+ access: "write",
1847
+ title: "Set workspace default comments",
1848
+ description: `Replaces the workspace's default comments with this list (at most ${MAX_WORKSPACE_DEFAULT_COMMENTS}); an empty list clears them. New posts to the workspace then get them automatically unless the publish call sends allowPostDefaultComments: false, and every added comment is charged like any other. Existing and scheduled posts keep the comments they already have.`,
1849
+ input: z.object({
1850
+ id: idField(WORKSPACE_ID),
1851
+ version: versionField("the workspace"),
1852
+ comments: z.array(workspaceDefaultCommentField).max(MAX_WORKSPACE_DEFAULT_COMMENTS)
1853
+ }),
1854
+ annotations: { idempotent: true },
1855
+ run: async ({ id, version, comments }, { clients }) => {
1856
+ const saved = await clients.workspaces.setDefaultComments(id, comments, version);
1857
+ return { updated: true, id, __v: saved.__v, comments: saved.comments };
1858
+ },
1859
+ entity: (_result, args) => ({ entityType: "socialWorkspace", entityId: args.id })
1860
+ }),
1807
1861
  defineTool({
1808
1862
  name: "social_account_list",
1809
1863
  toolset: "social-publisher",
@@ -1946,6 +2000,7 @@ var SOCIAL_PUBLISHER_TOOLS = [
1946
2000
  facebook: facebookBlock,
1947
2001
  instagram: instagramBlock,
1948
2002
  comments: commentsField,
2003
+ allowPostDefaultComments: allowDefaultCommentsField,
1949
2004
  scheduledAt: scheduledAtField,
1950
2005
  ...labelFields2
1951
2006
  }),
@@ -2032,6 +2087,7 @@ var SOCIAL_PUBLISHER_TOOLS = [
2032
2087
  reply_settings: z.enum(TWITTER_REPLY_SETTINGS).optional()
2033
2088
  }).optional().describe("X override."),
2034
2089
  comments: commentsField,
2090
+ allowPostDefaultComments: allowDefaultCommentsField,
2035
2091
  scheduledAt: scheduledAtField,
2036
2092
  ...labelFields2
2037
2093
  }),
@@ -2111,19 +2167,23 @@ var SOCIAL_PUBLISHER_TOOLS = [
2111
2167
  toolset: "social-publisher",
2112
2168
  access: "full",
2113
2169
  title: "Remove a post from the platforms",
2114
- description: "Deletes a published post's media from the platforms it was published to, at once. Instagram and TikTok offer no delete through their APIs, so media there stays. Irreversible. Paid, only when the removal succeeds: the price is in account_get_operation_costs.",
2115
- input: z.object({ id: idField(POST_ID), version: versionField("the post") }),
2170
+ description: "Deletes a published post's media from the platforms it was published to, at once, or from one platform when `platform` is given (the others keep their copies and the post becomes partiallyRemoved). Instagram and TikTok offer no delete through their APIs, so media there stays. Irreversible. Paid, only when the removal succeeds: the price is in account_get_operation_costs.",
2171
+ input: z.object({
2172
+ id: idField(POST_ID),
2173
+ version: versionField("the post"),
2174
+ platform: z.enum(SOCIAL_POST_REMOVE_PLATFORMS).optional().describe("Remove from this platform only. The post must have been published there. Omit to remove from every platform.")
2175
+ }),
2116
2176
  annotations: { destructive: true, idempotent: true },
2117
2177
  confirm: {
2118
- describe: async ({ id }, { clients }) => {
2178
+ describe: async ({ id, platform }, { clients }) => {
2119
2179
  const post = await clients.posts.getStatus(id);
2120
- const platforms = postPlatforms(post);
2180
+ const platforms = platform ? [platform] : postPlatforms(post);
2121
2181
  const where = platforms.length ? platforms.join(", ") : "the platforms it was published to";
2122
2182
  return `Remove post #${post.numbering} from ${where}. The published media is deleted from those platforms immediately, and this is irreversible \u2014 it cannot be restored or re-published from here. Instagram and TikTok offer no delete through their APIs, so media there stays.`;
2123
2183
  },
2124
2184
  costFeaturePath: "socialMediaPublisher.removePost"
2125
2185
  },
2126
- run: ({ id, version }, { clients }) => clients.posts.removePost(id, version),
2186
+ run: ({ id, version, platform }, { clients }) => clients.posts.removePost(id, version, platform),
2127
2187
  entity: (_result, args) => ({ entityType: "socialPost", entityId: args.id })
2128
2188
  })
2129
2189
  ];