posterly-mcp-server 0.64.0 → 0.67.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/README.md CHANGED
@@ -123,7 +123,7 @@ Add the same server definition to your Cursor MCP settings:
123
123
 
124
124
  ## Available tools
125
125
 
126
- `posterly-mcp-server@0.64.0` exposes 75 tools covering 127 actions. The hosted HTTP endpoint exposes the same catalog minus the three signup tools: 72 tools covering 124 actions.
126
+ `posterly-mcp-server@0.67.0` exposes 75 tools covering 127 actions. The hosted HTTP endpoint exposes the same catalog minus the three signup tools: 72 tools covering 124 actions.
127
127
 
128
128
  Many tools pick what to do with one parameter: `view` (reads), `action` (writes), or `type`. A few pick their mode from which parameters you pass (for example `update_post` with `status` changes the status instead of editing). Every tool description names all of its views and actions.
129
129
 
@@ -198,6 +198,8 @@ export interface Post {
198
198
  media_url?: string;
199
199
  media_urls?: string[];
200
200
  status: string;
201
+ /** True when the row matches the missed filter. status stays the stored value. */
202
+ missed?: boolean;
201
203
  post_type?: string;
202
204
  platform?: string | string[] | null;
203
205
  post_group_id?: string | null;
@@ -760,6 +762,9 @@ export type UpgradeQuote = {
760
762
  charge_today_cents: number;
761
763
  charge_today: string;
762
764
  currency: string;
765
+ /** Unix seconds the quote was priced at. Confirm with it and expected_amount_cents = charge_today_cents. */
766
+ proration_date: number;
767
+ quote_expires_at: string | null;
763
768
  current_recurring_cents: number | null;
764
769
  new_recurring_cents: number;
765
770
  new_recurring: string;
@@ -767,6 +772,10 @@ export type UpgradeQuote = {
767
772
  account_limit_after: number;
768
773
  included_credits_before: number;
769
774
  included_credits_after: number;
775
+ api_addon_note?: string;
776
+ combined_recurring_cents?: number;
777
+ combined_recurring?: string;
778
+ includes_api_addon?: boolean;
770
779
  };
771
780
  export type UpgradeQuoteResponse = {
772
781
  dry_run: true;
@@ -849,6 +858,9 @@ export type ExtraAccountsQuote = {
849
858
  charge_today_cents: number;
850
859
  charge_today: string;
851
860
  currency: string;
861
+ /** Unix seconds the quote was priced at. Confirm with it and expected_amount_cents = charge_today_cents. */
862
+ proration_date: number;
863
+ quote_expires_at: string | null;
852
864
  };
853
865
  export type ExtraAccountsQuoteResponse = {
854
866
  dry_run: true;
@@ -1413,6 +1425,25 @@ export interface PublicSignupPaymentAgentWallet {
1413
1425
  how?: string;
1414
1426
  spend_request?: PublicSignupPaymentAgentWalletSpendRequest;
1415
1427
  }
1428
+ /** Recurring price once the free trial ends (or from today when there is no trial). */
1429
+ export interface PublicSignupRecurringCharge {
1430
+ amount_cents?: number;
1431
+ amount_display?: string;
1432
+ currency?: string;
1433
+ interval?: string;
1434
+ items?: Array<{
1435
+ name?: string;
1436
+ amount_cents?: number;
1437
+ }>;
1438
+ /** Days until the first charge: the trial length, or 0 when Checkout charges today. */
1439
+ first_charge_in_days?: number;
1440
+ /** 0 on a trial, the full first period when the account already had a trial. */
1441
+ charged_today_cents?: number;
1442
+ price_source?: string;
1443
+ /** One plain sentence for the agent to relay to the person. */
1444
+ description?: string;
1445
+ [key: string]: unknown;
1446
+ }
1416
1447
  export interface PublicSignupPayment {
1417
1448
  amount?: number | null;
1418
1449
  currency?: string;
@@ -1428,8 +1459,15 @@ export interface PublicSignupPayment {
1428
1459
  checkout_redirect_url?: string;
1429
1460
  pay_with?: string;
1430
1461
  agent_wallet?: PublicSignupPaymentAgentWallet;
1462
+ after_trial?: PublicSignupRecurringCharge | null;
1431
1463
  [key: string]: unknown;
1432
1464
  }
1465
+ /**
1466
+ * One line with the price after the trial, from the server's own sentence.
1467
+ * Empty when the server did not send one (older deployments), so the tool
1468
+ * never invents a price.
1469
+ */
1470
+ export declare function signupRecurringChargeLine(afterTrial: PublicSignupRecurringCharge | null | undefined): string;
1433
1471
  /** True when this signup Checkout is the card-backed free trial (nothing due today). */
1434
1472
  export declare function signupCheckoutIsTrial(payment: PublicSignupPayment | null | undefined): boolean;
1435
1473
  /**
@@ -1670,27 +1708,45 @@ export declare class PosterlyClient {
1670
1708
  tier: SubscriptionTierName;
1671
1709
  interval?: 'month' | 'year';
1672
1710
  workspace_id?: string;
1711
+ add_api_addon?: boolean;
1673
1712
  }): Promise<UpgradeQuoteResponse>;
1674
- /** Applies the upgrade and charges the saved card. Only call after a quote was shown and approved. */
1713
+ /**
1714
+ * Applies the upgrade and charges the saved card. Only call after a quote was shown and approved.
1715
+ * The API charges only the quoted amount: 400 expected_amount_required without it, 409 quote_changed
1716
+ * when the price or quote moved.
1717
+ */
1675
1718
  upgradeSubscription(data: {
1676
1719
  tier: SubscriptionTierName;
1677
1720
  interval?: 'month' | 'year';
1678
1721
  request_id?: string;
1679
1722
  workspace_id?: string;
1723
+ /** The quote's charge_today_cents. */
1724
+ expected_amount_cents: number;
1725
+ /** The quote's proration_date. */
1726
+ proration_date: number;
1680
1727
  /** What the quote was based on; the API answers 409 quote_stale when the live values differ. */
1681
1728
  expected_current_tier?: SubscriptionTierName;
1682
1729
  expected_interval?: UpgradeInterval;
1730
+ add_api_addon?: boolean;
1683
1731
  }): Promise<UpgradeSubscriptionResponse>;
1684
1732
  /** Exact price of a change; charges nothing. */
1685
1733
  quoteExtraAccounts(data: {
1686
1734
  extra_accounts: number;
1687
1735
  workspace_id?: string;
1688
1736
  }): Promise<ExtraAccountsQuoteResponse>;
1689
- /** Applies the change and charges the saved card. Only call after a quote was shown and approved. */
1737
+ /**
1738
+ * Applies the change and charges the saved card. Only call after a quote was shown and approved.
1739
+ * The API charges only the quoted amount: 400 expected_amount_required without it, 409 quote_changed
1740
+ * when the price or quote moved.
1741
+ */
1690
1742
  setExtraAccounts(data: {
1691
1743
  extra_accounts: number;
1692
1744
  request_id?: string;
1693
1745
  workspace_id?: string;
1746
+ /** The quote's charge_today_cents. */
1747
+ expected_amount_cents: number;
1748
+ /** The quote's proration_date. */
1749
+ proration_date: number;
1694
1750
  /** What the quote was based on; the API answers 409 quote_stale when the live values differ. */
1695
1751
  expected_current_extra_accounts?: number;
1696
1752
  expected_interval?: 'month' | 'year';
@@ -63,6 +63,15 @@ function postFilterParams(params) {
63
63
  searchParams.set('timezone', params.timezone);
64
64
  return searchParams;
65
65
  }
66
+ /**
67
+ * One line with the price after the trial, from the server's own sentence.
68
+ * Empty when the server did not send one (older deployments), so the tool
69
+ * never invents a price.
70
+ */
71
+ export function signupRecurringChargeLine(afterTrial) {
72
+ const description = typeof afterTrial?.description === 'string' ? afterTrial.description.trim() : '';
73
+ return description ? `Price: ${description}` : '';
74
+ }
66
75
  /** True when this signup Checkout is the card-backed free trial (nothing due today). */
67
76
  export function signupCheckoutIsTrial(payment) {
68
77
  if (!payment)
@@ -330,7 +339,11 @@ export class PosterlyClient {
330
339
  async quoteUpgrade(data) {
331
340
  return this.request('POST', '/subscription/upgrade', { ...data, dry_run: true });
332
341
  }
333
- /** Applies the upgrade and charges the saved card. Only call after a quote was shown and approved. */
342
+ /**
343
+ * Applies the upgrade and charges the saved card. Only call after a quote was shown and approved.
344
+ * The API charges only the quoted amount: 400 expected_amount_required without it, 409 quote_changed
345
+ * when the price or quote moved.
346
+ */
334
347
  async upgradeSubscription(data) {
335
348
  return this.request('POST', '/subscription/upgrade', data);
336
349
  }
@@ -338,7 +351,11 @@ export class PosterlyClient {
338
351
  async quoteExtraAccounts(data) {
339
352
  return this.request('POST', '/subscription/extra-accounts', { ...data, dry_run: true });
340
353
  }
341
- /** Applies the change and charges the saved card. Only call after a quote was shown and approved. */
354
+ /**
355
+ * Applies the change and charges the saved card. Only call after a quote was shown and approved.
356
+ * The API charges only the quoted amount: 400 expected_amount_required without it, 409 quote_changed
357
+ * when the price or quote moved.
358
+ */
342
359
  async setExtraAccounts(data) {
343
360
  return this.request('POST', '/subscription/extra-accounts', data);
344
361
  }
@@ -99,6 +99,11 @@ export declare function compactText(value: string | null | undefined, maxLength?
99
99
  * as a Markdown block. Returns null when there is no learned voice to show.
100
100
  */
101
101
  export declare function mdLearnedVoice(learned: LearnedVoice | null | undefined): string | null;
102
+ /** Stored status, with " (missed)" when the API flag says the time passed. */
103
+ export declare function statusWithMissed(post: {
104
+ status?: string | null;
105
+ missed?: boolean | null;
106
+ }): string;
102
107
  export declare function statusLabel(status: string | null | undefined): string;
103
108
  export declare function code(value: CellValue): string;
104
109
  /**
@@ -345,6 +345,11 @@ export function mdLearnedVoice(learned) {
345
345
  ]);
346
346
  return body || null;
347
347
  }
348
+ /** Stored status, with " (missed)" when the API flag says the time passed. */
349
+ export function statusWithMissed(post) {
350
+ const label = statusLabel(post.status);
351
+ return post.missed === true ? `${label} (missed)` : label;
352
+ }
348
353
  export function statusLabel(status) {
349
354
  const value = String(status || 'unknown').toLowerCase();
350
355
  if (['created', 'success', 'succeeded', 'completed', 'published', 'active'].includes(value))
@@ -551,7 +556,7 @@ export function formatPostListPage(data, options) {
551
556
  // The API post row carries account and brand IDs only (no joined names);
552
557
  // list_accounts and list_brands, or view=counts, resolve them.
553
558
  posts.map((post) => [
554
- statusLabel(post.status),
559
+ statusWithMissed(post),
555
560
  code(String(post.id)),
556
561
  formatDateTimeInZone(post.scheduled_at, tz),
557
562
  post.post_type || 'post',
@@ -1 +1 @@
1
- export declare const POSTERLY_MCP_VERSION = "0.64.0";
1
+ export declare const POSTERLY_MCP_VERSION = "0.67.0";
@@ -5,4 +5,4 @@
5
5
  // tool set (minus the intentional pre-auth signup tools that only this stdio
6
6
  // package exposes). `npm run check:mcp-parity` enforces both the version match
7
7
  // and the tool-list match, and runs in the pre-commit hook.
8
- export const POSTERLY_MCP_VERSION = '0.64.0';
8
+ export const POSTERLY_MCP_VERSION = '0.67.0';
@@ -331,7 +331,7 @@ export const createPostTool = {
331
331
  '3. Get explicit confirmation from the user (e.g. "post it", "yes schedule that", "looks good") BEFORE calling this tool. Do NOT infer consent from earlier instructions like "post about X every Monday" - confirm each individual post or the entire batch.\n' +
332
332
  '4. If scheduling multiple posts in one turn, list every post first and confirm the batch as a whole, then prefer `create_posts_batch` so they are created in one API request.\n\n' +
333
333
  'AFTER CALLING: Tell the user the post was created, include the posterly dashboard link returned by the tool, and offer the next natural action. Do not narrate raw HTTP, curl, or API plumbing.\n\n' +
334
- 'Provide either account_id OR username+platform to identify the account. If scheduled_at is omitted, the post publishes immediately. If workspace_id is omitted, the server resolves one from the social account, falling back to the caller\'s default (personal) workspace - pass workspace_id explicitly if the user has more than one workspace.\n\n' +
334
+ 'Provide either account_id OR username+platform to identify the account. If scheduled_at is omitted, or it is within the next minute, the post publishes immediately and the returned status is publishing. A later time is returned as scheduled. If the post is saved but cannot be queued, the tool returns an error and says whether it will still be sent when it is due. If workspace_id is omitted, the server resolves one from the social account, falling back to the caller\'s default (personal) workspace - pass workspace_id explicitly if the user has more than one workspace.\n\n' +
335
335
  'MEDIA URLS: Posterly storage URLs are used as-is. Third-party HTTP(S) media URLs are copied into posterly storage before the post is saved, so API-created posts do not later fail on expired signed URLs. Short-lived signed URLs must still be live when this tool runs. You can also call `upload_media` with `url` first if you want to upload once and reuse the returned posterly URL across posts.\n\n' +
336
336
  'THREADS: Pass `thread_posts` (an array of 2+ strings) to schedule a multi-post thread on X (Twitter) or Threads (Meta). The first entry is the lead post; the rest are published as replies in the same chain. X entries are capped at 280 characters each (4000 for verified, 25000 for organization accounts); Threads entries are capped at 500 characters each. When `thread_posts` is set, `caption` is ignored.\n\n' +
337
337
  'X ARTICLES: To publish on X as a long-form Article, pass `platform_settings.article` ({ title, cover?: "first_image" | "none" }) for an X account. The caption becomes the Article body and is written as Markdown (headings, bold, italic, lists, quotes, code blocks, tables, dividers). Reference attached images with `![caption](media:1)`. Needs an X Premium account; polls, threads, paid partnership, video, and GIFs are not allowed with an Article.\n\n' +
@@ -355,7 +355,11 @@ export const createPostTool = {
355
355
  const dashboardUrl = dashboardUrlForPost({ id: p.id, scheduled_at: p.scheduled_at });
356
356
  const createdLine = replayed
357
357
  ? 'This post already exists. Nothing new was created.'
358
- : p.scheduled_at ? 'Post scheduled successfully.' : 'Post created successfully.';
358
+ : p.status === 'publishing'
359
+ ? 'Post is publishing now.'
360
+ : p.status === 'scheduled'
361
+ ? 'Post scheduled successfully.'
362
+ : 'Post created successfully.';
359
363
  const lines = [
360
364
  createdLine,
361
365
  `• ID: ${p.id}`,
@@ -28,7 +28,7 @@ async function post(client, input) {
28
28
  const groups = groupReleaseIds(p);
29
29
  const lines = [
30
30
  `Post #${p.id}`,
31
- `• Status: ${p.status}`,
31
+ `• Status: ${p.missed === true ? `${p.status} (missed)` : p.status}`,
32
32
  ];
33
33
  const platform = platformText(p.platform);
34
34
  if (platform)
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { signupCheckoutChargeLine, signupCheckoutIsTrial, } from '../lib/api-client.js';
2
+ import { signupCheckoutChargeLine, signupCheckoutIsTrial, signupRecurringChargeLine, } from '../lib/api-client.js';
3
3
  export const getSignupSessionTool = {
4
4
  name: 'get_signup_session',
5
5
  description: 'Poll a public posterly signup session created by start_signup. Use this to narrate the free trial (card saved, nothing charged today), password setup, and agent access status before a posterly API key is installed. An account that already had a trial is charged at checkout instead. Keep updates user-facing; do not narrate raw HTTP, curl, or API plumbing.',
@@ -39,6 +39,7 @@ function formatSignupSession(session, includeRaw) {
39
39
  agentPay?.client_secret ? `PaymentIntent client_secret: ${agentPay.client_secret}` : '',
40
40
  agentPay?.confirm_url ? `Confirm URL: ${agentPay.confirm_url}` : '',
41
41
  !agentPay?.enabled ? signupCheckoutChargeLine(payment) : '',
42
+ signupRecurringChargeLine(payment?.after_trial),
42
43
  !agentPay?.enabled && payment?.agent_wallet?.how
43
44
  ? `Agent wallet option: ${payment.agent_wallet.how}`
44
45
  : '',
@@ -18,7 +18,7 @@ export const listPostsTool = {
18
18
  status: z
19
19
  .string()
20
20
  .optional()
21
- .describe('Stored post status (draft, scheduled, publishing, processing, awaiting_tiktok_publish, awaiting_manual, published, failed, paused, paused_due_to_token, paused_due_to_billing, or missed). paused_due_to_token is a reconnect pause and paused_due_to_billing is a billing pause. missed: failed, still scheduled after the scheduled time, or held by a publishing pause past it.'),
21
+ .describe('Stored post status (draft, scheduled, publishing, processing, awaiting_tiktok_publish, awaiting_manual, published, failed, paused, paused_due_to_token, paused_due_to_billing, or missed). paused_due_to_token is a reconnect pause and paused_due_to_billing is a billing pause. missed is a filter, not a stored status: a scheduled post that is still scheduled 10 minutes after its time (the publish sweep runs every 5 minutes, plus the same wait for a late sweep). A reaper reset or an auto-retry requeue keeps a row off this list for those same 10 minutes. A fresh edit does not. Also an awaiting_manual story whose time has been reached, or a workspace or brand publishing pause whose scheduled time has been reached. Each row keeps its stored status and has missed true or false. Failed is its own status. Queued is not missed.'),
22
22
  group_id: z
23
23
  .string()
24
24
  .optional()
@@ -12,6 +12,8 @@ type ManageExtraAccountInput = {
12
12
  workspace_id?: string;
13
13
  expected_current_extra_accounts?: number;
14
14
  expected_interval?: 'month' | 'year';
15
+ expected_amount_cents?: number;
16
+ proration_date?: number;
15
17
  confirm?: boolean;
16
18
  preview_id?: string;
17
19
  };
@@ -24,6 +26,8 @@ export declare const manageExtraAccountTool: {
24
26
  workspace_id: z.ZodOptional<z.ZodString>;
25
27
  expected_current_extra_accounts: z.ZodOptional<z.ZodNumber>;
26
28
  expected_interval: z.ZodOptional<z.ZodEnum<["month", "year"]>>;
29
+ expected_amount_cents: z.ZodOptional<z.ZodNumber>;
30
+ proration_date: z.ZodOptional<z.ZodNumber>;
27
31
  confirm: z.ZodOptional<z.ZodBoolean>;
28
32
  preview_id: z.ZodOptional<z.ZodString>;
29
33
  }, "strip", z.ZodTypeAny, {
@@ -34,6 +38,8 @@ export declare const manageExtraAccountTool: {
34
38
  preview_id?: string | undefined;
35
39
  expected_current_extra_accounts?: number | undefined;
36
40
  expected_interval?: "month" | "year" | undefined;
41
+ expected_amount_cents?: number | undefined;
42
+ proration_date?: number | undefined;
37
43
  }, {
38
44
  action: "set";
39
45
  extra_accounts: number;
@@ -42,6 +48,8 @@ export declare const manageExtraAccountTool: {
42
48
  preview_id?: string | undefined;
43
49
  expected_current_extra_accounts?: number | undefined;
44
50
  expected_interval?: "month" | "year" | undefined;
51
+ expected_amount_cents?: number | undefined;
52
+ proration_date?: number | undefined;
45
53
  }>;
46
54
  execute(client: PosterlyClient, input: ManageExtraAccountInput, ctx: ToolContext): Promise<string>;
47
55
  };
@@ -47,13 +47,15 @@ export function formatExtraAccountsQuote(q) {
47
47
  }
48
48
  export const manageExtraAccountTool = {
49
49
  name: 'manage_extra_account',
50
- description: 'Buy, raise, lower, or remove Agency extra-account slots. MONEY: raising charges the saved card. Owner only; billing:write. action=set (extra_accounts = desired TOTAL, 0 removes all; add 20+ at a time). Call without confirm for the quote and preview_id; after the user agrees, call with confirm=true, that preview_id and the expected_ fields from the quote. 3D Secure or a decline returns a payment link; nothing is added.',
50
+ description: 'Buy, raise, lower, or remove Agency extra-account slots. MONEY: raising charges the saved card exactly the quoted amount. Owner only; billing:write. action=set (extra_accounts = desired TOTAL, 0 removes all; add 20+ at a time). Call without confirm for the quote and preview_id; after the user agrees, call with confirm=true, that preview_id, the expected_ fields and proration_date from the quote. A changed price is refused. 3D Secure or a decline returns a payment link; nothing is added.',
51
51
  inputSchema: z.object({
52
52
  action: z.enum(['set']),
53
53
  extra_accounts: z.number().int().min(0),
54
54
  workspace_id: z.string().optional(),
55
55
  expected_current_extra_accounts: z.number().int().min(0).optional(),
56
56
  expected_interval: z.enum(['month', 'year']).optional(),
57
+ expected_amount_cents: z.number().int().min(0).optional(),
58
+ proration_date: z.number().int().min(0).optional(),
57
59
  confirm: z.boolean().optional(),
58
60
  preview_id: z.string().optional(),
59
61
  }),
@@ -63,8 +65,9 @@ export const manageExtraAccountTool = {
63
65
  const workspace = call.workspace_id ? { workspace_id: call.workspace_id } : {};
64
66
  // A preview is only issued for a change posterly can actually make: price
65
67
  // it first, and answer a failed quote with an error and NO preview_id. The
66
- // quote's current total and interval are pinned into the previewed args,
67
- // so the confirm must repeat them and the API refuses a stale quote.
68
+ // quote's current total, interval, charge today and proration_date are
69
+ // pinned into the previewed args, so the confirm must repeat them: the API
70
+ // refuses a stale quote and charges only the quoted amount.
68
71
  let quote = null;
69
72
  let previewArgs = args;
70
73
  if (call.confirm !== true) {
@@ -81,6 +84,8 @@ export const manageExtraAccountTool = {
81
84
  ...args,
82
85
  expected_current_extra_accounts: quote.current_extra_accounts,
83
86
  expected_interval: quote.interval,
87
+ expected_amount_cents: quote.charge_today_cents,
88
+ proration_date: quote.proration_date,
84
89
  };
85
90
  }
86
91
  return previewThenConfirm({
@@ -97,11 +102,16 @@ export const manageExtraAccountTool = {
97
102
  ['extra_accounts', quote.new_extra_accounts],
98
103
  ['expected_current_extra_accounts', quote.current_extra_accounts],
99
104
  ['expected_interval', quote.interval],
105
+ ['expected_amount_cents', String(quote.charge_today_cents)],
106
+ ['proration_date', String(quote.proration_date)],
100
107
  ])),
101
108
  ].filter(Boolean).join('\n\n'),
102
109
  run: async () => {
103
- if (typeof call.expected_current_extra_accounts !== 'number' || !call.expected_interval) {
104
- throw new Error('Confirm needs expected_current_extra_accounts and expected_interval from the preview. Get a new preview.');
110
+ if (typeof call.expected_current_extra_accounts !== 'number'
111
+ || !call.expected_interval
112
+ || typeof call.expected_amount_cents !== 'number'
113
+ || typeof call.proration_date !== 'number') {
114
+ throw new Error('Confirm needs expected_current_extra_accounts, expected_interval, expected_amount_cents and proration_date from the preview. Get a new preview.');
105
115
  }
106
116
  // The same preview_id always maps to the same request_id, so a replayed
107
117
  // confirm can never buy twice.
@@ -112,6 +122,8 @@ export const manageExtraAccountTool = {
112
122
  extra_accounts: call.extra_accounts,
113
123
  expected_current_extra_accounts: call.expected_current_extra_accounts,
114
124
  expected_interval: call.expected_interval,
125
+ expected_amount_cents: call.expected_amount_cents,
126
+ proration_date: call.proration_date,
115
127
  ...(requestId ? { request_id: requestId } : {}),
116
128
  ...workspace,
117
129
  });
@@ -10,12 +10,12 @@ export declare const managePlanTool: {
10
10
  interval: z.ZodOptional<z.ZodEnum<["week", "month", "year"]>>;
11
11
  }, "strip", z.ZodTypeAny, {
12
12
  action: "list" | "confirm_link";
13
- tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
14
13
  interval?: "week" | "month" | "year" | undefined;
14
+ tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
15
15
  }, {
16
16
  action: "list" | "confirm_link";
17
- tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
18
17
  interval?: "week" | "month" | "year" | undefined;
18
+ tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
19
19
  }>;
20
20
  execute(client: PosterlyClient, input: unknown, ctx: ToolContext): Promise<string>;
21
21
  };
@@ -31,7 +31,7 @@ function formatPlans(data) {
31
31
  function formatConfirm(data) {
32
32
  return [
33
33
  mdTitle('Confirm link, nothing charged'),
34
- data?.instructions || 'Send this link to the human. They confirm the price. You cannot charge the card.',
34
+ data?.instructions || 'Send this link to the human. They confirm the price. Opening it does not charge the card.',
35
35
  mdSection('Link', mdKeyValue([
36
36
  ['Confirm URL', data?.confirm_url || 'n/a'],
37
37
  ['Expires', data?.expires_at || 'n/a'],
@@ -43,7 +43,7 @@ function formatConfirm(data) {
43
43
  }
44
44
  export const managePlanTool = {
45
45
  name: 'manage_plan',
46
- description: 'Plans and the paid-plan link. action=list: plans, prices and the charge today to start the paid plan. action=confirm_link: a single-use 30-minute link for the human to confirm the price; omit tier and interval to start the current plan. Never charges the card. A trial link needs billing:read. Changing a paid plan also needs billing:write.',
46
+ description: 'Plans and the paid-plan link. action=list: plans, prices and the charge today to start the paid plan. action=confirm_link: a single-use 30-minute link for the human to confirm the price; omit tier and interval to start the current plan. This tool never charges the card (upgrade_subscription and manage_extra_account charge it only after the user agrees to their quote). A trial link needs billing:read. Changing a paid plan also needs billing:write.',
47
47
  inputSchema: z.object({
48
48
  action: z.enum(['list', 'confirm_link']),
49
49
  tier: z.enum(TIERS).optional(),
@@ -10,7 +10,7 @@ function formatPaused(result) {
10
10
  }
11
11
  export const pauseSubscriptionTool = {
12
12
  name: 'pause_subscription',
13
- description: "Pause the authenticated user's posterly subscription for 30 days (one pause allowed per 90-day cooldown). Billing action; requires the billing:write scope. Only call after the user explicitly confirms.",
13
+ description: "Pause the authenticated user's posterly subscription for 30 days (one pause allowed per 90-day cooldown). A free trial cannot be paused (409 trial_not_pausable). Billing action; requires the billing:write scope. Only call after the user explicitly confirms.",
14
14
  inputSchema: z.object({
15
15
  confirm: z.literal(true).describe('Must be true after the user explicitly confirms pausing the subscription.'),
16
16
  }),
@@ -14,9 +14,9 @@ export declare const startSignupTool: {
14
14
  tos_accepted: z.ZodOptional<z.ZodBoolean>;
15
15
  debug: z.ZodOptional<z.ZodBoolean>;
16
16
  }, "strip", z.ZodTypeAny, {
17
+ interval: "month";
17
18
  email: string;
18
19
  tier: "starter" | "pro" | "power_user" | "agency";
19
- interval: "month";
20
20
  api_addon: boolean;
21
21
  return_path: string;
22
22
  source: string;
@@ -25,10 +25,10 @@ export declare const startSignupTool: {
25
25
  tos_accepted?: boolean | undefined;
26
26
  }, {
27
27
  email: string;
28
+ interval?: "month" | undefined;
28
29
  name?: string | undefined;
29
30
  debug?: boolean | undefined;
30
31
  tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
31
- interval?: "month" | undefined;
32
32
  api_addon?: boolean | undefined;
33
33
  return_path?: string | undefined;
34
34
  source?: string | undefined;
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { signupCheckoutChargeLine, signupCheckoutIsTrial, } from '../lib/api-client.js';
2
+ import { signupCheckoutChargeLine, signupCheckoutIsTrial, signupRecurringChargeLine, } from '../lib/api-client.js';
3
3
  const DEFAULT_RETURN_PATH = '/dashboard/api?api_signup=success';
4
4
  export const startSignupTool = {
5
5
  name: 'start_signup',
6
- description: 'Start the public posterly signup for a user before posterly API access exists. A new account starts a 7-day free trial: Stripe Checkout collects a card, nothing is charged today, and the card is charged on day 8 unless the paid plan starts sooner. API and MCP stay limited during the trial. The API add-on is still required. Returns a signup poll URL, a browser Checkout handoff URL, and a payment object for that Checkout session (trial length, whether anything is charged today, merchant, and agent-wallet instructions). An account that already had a trial is charged at checkout instead. The user still sets a password and approves social OAuth in the browser. Never ask for card numbers, a posterly password, or social passwords in chat.',
6
+ description: 'Start the public posterly signup for a user before posterly API access exists. A new account starts a 7-day free trial: Stripe Checkout collects a card, nothing is charged today, and the card is charged on day 8 unless the paid plan starts sooner. API and MCP stay limited during the trial. The API add-on is still required. Returns a signup poll URL, a browser Checkout handoff URL, and a payment object for that Checkout session (trial length, whether anything is charged today, the price charged every month after the trial, merchant, and agent-wallet instructions). Tell the user that price before they open Checkout. An account that already had a trial is charged at checkout instead. The user still sets a password and approves social OAuth in the browser. Never ask for card numbers, a posterly password, or social passwords in chat.',
7
7
  inputSchema: z.object({
8
8
  email: z
9
9
  .string()
@@ -72,6 +72,11 @@ function formatSignupStart(response, includeRaw) {
72
72
  const message = session?.status_message || response.status_message;
73
73
  const agentPay = response.agent_pay || session?.agent_pay;
74
74
  const payment = response.payment || session?.payment;
75
+ const billingAfterTrial = response.billing?.after_trial;
76
+ const afterTrial = payment?.after_trial ||
77
+ (billingAfterTrial && typeof billingAfterTrial === 'object'
78
+ ? billingAfterTrial
79
+ : null);
75
80
  const lines = [
76
81
  'posterly signup started.',
77
82
  sessionId ? `Signup session: ${sessionId}` : '',
@@ -86,6 +91,7 @@ function formatSignupStart(response, includeRaw) {
86
91
  agentPay?.confirm_url ? `Confirm URL: ${agentPay.confirm_url}` : '',
87
92
  agentPay?.pay_instructions ? `Pay instructions: ${agentPay.pay_instructions}` : '',
88
93
  !agentPay?.enabled ? signupCheckoutChargeLine(payment) : '',
94
+ signupRecurringChargeLine(afterTrial),
89
95
  !agentPay?.enabled && payment?.agent_wallet?.how
90
96
  ? `Agent wallet option: ${payment.agent_wallet.how}`
91
97
  : '',
@@ -114,7 +120,7 @@ function formatSignupStart(response, includeRaw) {
114
120
  ]
115
121
  : signupCheckoutIsTrial(payment)
116
122
  ? [
117
- '1. Send the Checkout handoff URL to the user so they can save a card in their browser. Nothing is charged today. Use the raw Stripe checkout URL only if you preserve the full URL including any fragment. posterly does not email this link, so do not tell the user to check their inbox at this stage.',
123
+ '1. Send the Checkout handoff URL to the user so they can save a card in their browser. Nothing is charged today. Tell the user the price line above before they open it. Use the raw Stripe checkout URL only if you preserve the full URL including any fragment. posterly does not email this link, so do not tell the user to check their inbox at this stage.',
118
124
  '2. If you complete Checkout yourself, use only a reusable card the person has approved for recurring posterly charges. A one-time virtual card fails when the trial ends. Follow the agent wallet option above. Never paste card numbers into chat or send them to posterly.',
119
125
  '3. Call get_signup_session with the signup session ID until the status changes.',
120
126
  '4. Tell the user when posterly sends the password setup email.',
@@ -146,7 +146,7 @@ const platformSettingsSchema = z.object({
146
146
  }).passthrough();
147
147
  export const updatePostTool = {
148
148
  name: 'update_post',
149
- description: 'Change a scheduled or draft post. DESTRUCTIVE WRITE. Edit (default): caption, media, schedule, post_type, settings, account_id, or thread_posts; overwrites the existing post; cannot edit published or currently publishing posts. account_id moves the post to another account you can use in the same workspace and on the same brand, and the platform follows that account. thread_posts replaces an X or Threads reply chain with at least two non-empty parts, and the first part becomes the caption. If a client has already approved the post, a caption edit reopens caption approval, a media or thumbnail edit reopens asset approval, and a reschedule, account change, thread edit, or settings change reopens both. status (scheduled, paused, or draft, with scheduled_at when scheduling a draft): pause, resume, or move back to draft; send it on its own. release_id (with optional group_id): set or repair external release/group IDs; send it on its own. approval_action (request, approve, request_changes, or reject): change client approval. Only a workspace owner or admin may do this. The actor is the API key user, never a brand guest. request emails the brand reviewers. approve, request_changes, and reject are team-side decisions. request_changes needs approval_note. Optional approval_axis is asset or caption; omit it for both. Send approval_action on its own.\n\n' +
149
+ description: 'Change a scheduled or draft post. DESTRUCTIVE WRITE. Edit (default): caption, media, schedule, post_type, settings, account_id, or thread_posts; overwrites the existing post; cannot edit published or currently publishing posts. account_id moves the post to another account you can use in the same workspace and on the same brand, and the platform follows that account. thread_posts replaces an X or Threads reply chain with at least two non-empty parts, and the first part becomes the caption. If a client has already approved the post, a caption edit reopens caption approval, a media or thumbnail edit reopens asset approval, and a reschedule, account change, thread edit, or settings change reopens both. status (scheduled, paused, or draft, with scheduled_at when scheduling a draft): pause, resume, or move back to draft; send it on its own. A reconnect pause, including on X, resumes with status scheduled once the account is healthy, the time is in the future, and publishing is not paused. A billing pause, including on X, resumes once billing is clear, the time is in the future, and publishing is not paused. release_id (with optional group_id): set or repair external release/group IDs; send it on its own. approval_action (request, approve, request_changes, or reject): change client approval. Only a workspace owner or admin may do this. The actor is the API key user, never a brand guest. request emails the brand reviewers. approve, request_changes, and reject are team-side decisions. request_changes needs approval_note. Optional approval_axis is asset or caption; omit it for both. Send approval_action on its own.\n\n' +
150
150
  'REQUIRED BEFORE CALLING: Show the user a side-by-side of the CURRENT post (caption, scheduled time, media, status) and the PROPOSED change, and get explicit confirmation ("yes update it", "apply those changes") before calling. Do not auto-edit posts based on a general instruction - each change needs its own confirmation.\n\n' +
151
151
  'READ, THEN UPDATE: pass the Version from get_post as expected_version and send only the fields you are changing. If the post was edited since, nothing changes and the error says what changed and who changed it. Without expected_version a warning is returned when the update replaces a change made by someone else in the last 24 hours.',
152
152
  inputSchema: z.object({
@@ -11,8 +11,11 @@ type UpgradeSubscriptionInput = {
11
11
  workspace_id?: string;
12
12
  expected_current_tier?: SubscriptionTierName;
13
13
  expected_interval?: 'week' | 'month' | 'year';
14
+ expected_amount_cents?: number;
15
+ proration_date?: number;
14
16
  confirm?: boolean;
15
17
  preview_id?: string;
18
+ add_api_addon?: boolean;
16
19
  };
17
20
  export declare const upgradeSubscriptionTool: {
18
21
  name: string;
@@ -23,24 +26,33 @@ export declare const upgradeSubscriptionTool: {
23
26
  workspace_id: z.ZodOptional<z.ZodString>;
24
27
  expected_current_tier: z.ZodOptional<z.ZodEnum<["starter", "pro", "power_user", "agency"]>>;
25
28
  expected_interval: z.ZodOptional<z.ZodEnum<["week", "month", "year"]>>;
29
+ expected_amount_cents: z.ZodOptional<z.ZodNumber>;
30
+ proration_date: z.ZodOptional<z.ZodNumber>;
26
31
  confirm: z.ZodOptional<z.ZodBoolean>;
27
32
  preview_id: z.ZodOptional<z.ZodString>;
33
+ add_api_addon: z.ZodOptional<z.ZodBoolean>;
28
34
  }, "strip", z.ZodTypeAny, {
29
35
  tier: "starter" | "pro" | "power_user" | "agency";
30
36
  workspace_id?: string | undefined;
37
+ interval?: "month" | "year" | undefined;
31
38
  confirm?: boolean | undefined;
32
39
  preview_id?: string | undefined;
33
- interval?: "month" | "year" | undefined;
34
40
  expected_interval?: "week" | "month" | "year" | undefined;
41
+ expected_amount_cents?: number | undefined;
42
+ proration_date?: number | undefined;
35
43
  expected_current_tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
44
+ add_api_addon?: boolean | undefined;
36
45
  }, {
37
46
  tier: "starter" | "pro" | "power_user" | "agency";
38
47
  workspace_id?: string | undefined;
48
+ interval?: "month" | "year" | undefined;
39
49
  confirm?: boolean | undefined;
40
50
  preview_id?: string | undefined;
41
- interval?: "month" | "year" | undefined;
42
51
  expected_interval?: "week" | "month" | "year" | undefined;
52
+ expected_amount_cents?: number | undefined;
53
+ proration_date?: number | undefined;
43
54
  expected_current_tier?: "starter" | "pro" | "power_user" | "agency" | undefined;
55
+ add_api_addon?: boolean | undefined;
44
56
  }>;
45
57
  execute(client: PosterlyClient, input: UpgradeSubscriptionInput, ctx: ToolContext): Promise<string>;
46
58
  };
@@ -45,7 +45,8 @@ export function formatUpgradeQuote(q) {
45
45
  const chargeLine = q.trialing
46
46
  ? 'Nothing is charged today because the subscription is on a trial. The trial continues and the new price starts when it ends.'
47
47
  : `The saved card on file is charged ${q.charge_today || usdFromCents(q.charge_today_cents)} today (${q.interval_changes ? 'the unused time on the current plan is credited, and the new billing period starts today' : 'prorated for the rest of this billing period'}) when this is confirmed. Prices are before any discount on the subscription, and discounts carry over. If the card needs confirmation or declines, nothing changes and a payment link is returned instead.`;
48
- return [mdSection(`Upgrade to ${q.new_tier_name}`, mdKeyValue(rows)), chargeLine].join('\n\n');
48
+ const addonNote = q.api_addon_note?.trim() || '';
49
+ return [mdSection(`Upgrade to ${q.new_tier_name}`, mdKeyValue(rows)), chargeLine, addonNote].filter(Boolean).join('\n\n');
49
50
  }
50
51
  export function formatUpgradeResult(d) {
51
52
  if (d.status === 'payment_required') {
@@ -78,15 +79,18 @@ export function formatUpgradeResult(d) {
78
79
  }
79
80
  export const upgradeSubscriptionTool = {
80
81
  name: 'upgrade_subscription',
81
- description: 'Upgrade to a strictly higher plan. MONEY: charges the saved card (prorated). Owner only. Call without confirm for the quote and preview_id; after the user agrees, call with confirm=true, that preview_id and the expected_ fields. 3D Secure or a decline returns a payment link; nothing changes.',
82
+ description: 'Upgrade to a strictly higher plan. MONEY: charges the saved card exactly the quoted amount (prorated). Owner only. Call without confirm for the quote and preview_id; after the user agrees, call with confirm=true, that preview_id, the expected_ fields and proration_date. A changed price is refused. If the quote mentions AI agent access, mention that option once. Set add_api_addon true only when the user asks to add it. 3D Secure or a decline returns a payment link; nothing changes.',
82
83
  inputSchema: z.object({
83
84
  tier: z.enum(TIER_VALUES),
84
85
  interval: z.enum(['month', 'year']).optional(),
85
86
  workspace_id: z.string().optional(),
86
87
  expected_current_tier: z.enum(TIER_VALUES).optional(),
87
88
  expected_interval: z.enum(['week', 'month', 'year']).optional(),
89
+ expected_amount_cents: z.number().int().min(0).optional(),
90
+ proration_date: z.number().int().min(0).optional(),
88
91
  confirm: z.boolean().optional(),
89
92
  preview_id: z.string().optional(),
93
+ add_api_addon: z.boolean().optional().describe('Add AI agent access on this upgrade. Set only when the user asks. Never set it on your own.'),
90
94
  }),
91
95
  async execute(client, input, ctx) {
92
96
  const { args } = validateArgs(ctx, 'upgrade_subscription', input);
@@ -95,12 +99,14 @@ export const upgradeSubscriptionTool = {
95
99
  const makeBase = () => ({
96
100
  tier: call.tier,
97
101
  ...(call.interval ? { interval: call.interval } : {}),
102
+ ...(call.add_api_addon === true ? { add_api_addon: true } : {}),
98
103
  ...(call.workspace_id ? { workspace_id: call.workspace_id } : {}),
99
104
  });
100
105
  // A preview is only issued for a change posterly can actually make: price
101
106
  // it first, and answer a failed quote with an error and NO preview_id. The
102
- // quote's current plan and interval are pinned into the previewed args, so
103
- // the confirm must repeat them and the API refuses a stale quote.
107
+ // quote's current plan, interval, charge today and proration_date are
108
+ // pinned into the previewed args, so the confirm must repeat them: the API
109
+ // refuses a stale quote and charges only the quoted amount.
104
110
  let quote = null;
105
111
  let previewArgs = args;
106
112
  if (call.confirm !== true) {
@@ -117,11 +123,16 @@ export const upgradeSubscriptionTool = {
117
123
  // ask to repeat, so it is dropped from the previewed args: the confirm
118
124
  // then binds to exactly the fields listed under "Fields to repeat on
119
125
  // confirm".
126
+ // add_api_addon follows the same rule: it is bound only when the quote
127
+ // includes the add-on, matching "Fields to repeat on confirm".
120
128
  const { interval: _noopInterval, ...rest } = args;
129
+ const { add_api_addon: _unusedAddon, ...bound } = (quote.interval_changes ? args : rest);
121
130
  previewArgs = {
122
- ...(quote.interval_changes ? args : rest),
131
+ ...(quote.includes_api_addon === true ? { ...bound, add_api_addon: true } : bound),
123
132
  expected_current_tier: quote.current_tier,
124
133
  expected_interval: quote.current_interval,
134
+ expected_amount_cents: quote.charge_today_cents,
135
+ proration_date: quote.proration_date,
125
136
  };
126
137
  }
127
138
  else if (call.interval && call.interval === call.expected_interval) {
@@ -143,13 +154,19 @@ export const upgradeSubscriptionTool = {
143
154
  mdSection('Fields to repeat on confirm', mdKeyValue([
144
155
  ['tier', quote.new_tier],
145
156
  ...(quote.interval_changes ? [['interval', quote.interval]] : []),
157
+ ...(quote.includes_api_addon ? [['add_api_addon', 'true']] : []),
146
158
  ['expected_current_tier', quote.current_tier],
147
159
  ['expected_interval', quote.current_interval],
160
+ ['expected_amount_cents', String(quote.charge_today_cents)],
161
+ ['proration_date', String(quote.proration_date)],
148
162
  ])),
149
163
  ].join('\n\n'),
150
164
  run: async () => {
151
- if (!call.expected_current_tier || !call.expected_interval) {
152
- throw new Error('Confirm needs expected_current_tier and expected_interval from the preview. Get a new preview.');
165
+ if (!call.expected_current_tier
166
+ || !call.expected_interval
167
+ || typeof call.expected_amount_cents !== 'number'
168
+ || typeof call.proration_date !== 'number') {
169
+ throw new Error('Confirm needs expected_current_tier, expected_interval, expected_amount_cents and proration_date from the preview. Get a new preview.');
153
170
  }
154
171
  // The same preview_id always maps to the same request_id, so a replayed
155
172
  // confirm can never upgrade twice.
@@ -160,6 +177,8 @@ export const upgradeSubscriptionTool = {
160
177
  ...makeBase(),
161
178
  expected_current_tier: call.expected_current_tier,
162
179
  expected_interval: call.expected_interval,
180
+ expected_amount_cents: call.expected_amount_cents,
181
+ proration_date: call.proration_date,
163
182
  ...(requestId ? { request_id: requestId } : {}),
164
183
  });
165
184
  return formatUpgradeResult(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posterly-mcp-server",
3
- "version": "0.64.0",
3
+ "version": "0.67.0",
4
4
  "mcpName": "io.github.awpthorp/posterly",
5
5
  "description": "MCP server for posterly: schedule and publish social media posts across 18 platforms from any MCP client (Claude, ChatGPT, Cursor, Windsurf, Cline, and more)",
6
6
  "license": "MIT",
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.awpthorp/posterly",
4
4
  "title": "posterly",
5
5
  "description": "Validate, schedule, publish, and analyze social content across 18 platforms with posterly.",
6
- "version": "0.64.0",
6
+ "version": "0.67.0",
7
7
  "websiteUrl": "https://www.poster.ly/mcp",
8
8
  "icons": [
9
9
  {
@@ -22,7 +22,7 @@
22
22
  {
23
23
  "registryType": "npm",
24
24
  "identifier": "posterly-mcp-server",
25
- "version": "0.64.0",
25
+ "version": "0.67.0",
26
26
  "transport": {
27
27
  "type": "stdio"
28
28
  },
@@ -2480,6 +2480,14 @@
2480
2480
  "month",
2481
2481
  "year"
2482
2482
  ]
2483
+ },
2484
+ "expected_amount_cents": {
2485
+ "type": "integer",
2486
+ "min": 0
2487
+ },
2488
+ "proration_date": {
2489
+ "type": "integer",
2490
+ "min": 0
2483
2491
  }
2484
2492
  }
2485
2493
  }
@@ -2520,6 +2528,14 @@
2520
2528
  "month",
2521
2529
  "year"
2522
2530
  ]
2531
+ },
2532
+ "expected_amount_cents": {
2533
+ "type": "integer",
2534
+ "min": 0
2535
+ },
2536
+ "proration_date": {
2537
+ "type": "integer",
2538
+ "min": 0
2523
2539
  }
2524
2540
  }
2525
2541
  }