posterly-mcp-server 0.64.0 → 0.66.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.66.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
 
@@ -760,6 +760,9 @@ export type UpgradeQuote = {
760
760
  charge_today_cents: number;
761
761
  charge_today: string;
762
762
  currency: string;
763
+ /** Unix seconds the quote was priced at. Confirm with it and expected_amount_cents = charge_today_cents. */
764
+ proration_date: number;
765
+ quote_expires_at: string | null;
763
766
  current_recurring_cents: number | null;
764
767
  new_recurring_cents: number;
765
768
  new_recurring: string;
@@ -767,6 +770,10 @@ export type UpgradeQuote = {
767
770
  account_limit_after: number;
768
771
  included_credits_before: number;
769
772
  included_credits_after: number;
773
+ api_addon_note?: string;
774
+ combined_recurring_cents?: number;
775
+ combined_recurring?: string;
776
+ includes_api_addon?: boolean;
770
777
  };
771
778
  export type UpgradeQuoteResponse = {
772
779
  dry_run: true;
@@ -849,6 +856,9 @@ export type ExtraAccountsQuote = {
849
856
  charge_today_cents: number;
850
857
  charge_today: string;
851
858
  currency: string;
859
+ /** Unix seconds the quote was priced at. Confirm with it and expected_amount_cents = charge_today_cents. */
860
+ proration_date: number;
861
+ quote_expires_at: string | null;
852
862
  };
853
863
  export type ExtraAccountsQuoteResponse = {
854
864
  dry_run: true;
@@ -1413,6 +1423,25 @@ export interface PublicSignupPaymentAgentWallet {
1413
1423
  how?: string;
1414
1424
  spend_request?: PublicSignupPaymentAgentWalletSpendRequest;
1415
1425
  }
1426
+ /** Recurring price once the free trial ends (or from today when there is no trial). */
1427
+ export interface PublicSignupRecurringCharge {
1428
+ amount_cents?: number;
1429
+ amount_display?: string;
1430
+ currency?: string;
1431
+ interval?: string;
1432
+ items?: Array<{
1433
+ name?: string;
1434
+ amount_cents?: number;
1435
+ }>;
1436
+ /** Days until the first charge: the trial length, or 0 when Checkout charges today. */
1437
+ first_charge_in_days?: number;
1438
+ /** 0 on a trial, the full first period when the account already had a trial. */
1439
+ charged_today_cents?: number;
1440
+ price_source?: string;
1441
+ /** One plain sentence for the agent to relay to the person. */
1442
+ description?: string;
1443
+ [key: string]: unknown;
1444
+ }
1416
1445
  export interface PublicSignupPayment {
1417
1446
  amount?: number | null;
1418
1447
  currency?: string;
@@ -1428,8 +1457,15 @@ export interface PublicSignupPayment {
1428
1457
  checkout_redirect_url?: string;
1429
1458
  pay_with?: string;
1430
1459
  agent_wallet?: PublicSignupPaymentAgentWallet;
1460
+ after_trial?: PublicSignupRecurringCharge | null;
1431
1461
  [key: string]: unknown;
1432
1462
  }
1463
+ /**
1464
+ * One line with the price after the trial, from the server's own sentence.
1465
+ * Empty when the server did not send one (older deployments), so the tool
1466
+ * never invents a price.
1467
+ */
1468
+ export declare function signupRecurringChargeLine(afterTrial: PublicSignupRecurringCharge | null | undefined): string;
1433
1469
  /** True when this signup Checkout is the card-backed free trial (nothing due today). */
1434
1470
  export declare function signupCheckoutIsTrial(payment: PublicSignupPayment | null | undefined): boolean;
1435
1471
  /**
@@ -1670,27 +1706,45 @@ export declare class PosterlyClient {
1670
1706
  tier: SubscriptionTierName;
1671
1707
  interval?: 'month' | 'year';
1672
1708
  workspace_id?: string;
1709
+ add_api_addon?: boolean;
1673
1710
  }): Promise<UpgradeQuoteResponse>;
1674
- /** Applies the upgrade and charges the saved card. Only call after a quote was shown and approved. */
1711
+ /**
1712
+ * Applies the upgrade and charges the saved card. Only call after a quote was shown and approved.
1713
+ * The API charges only the quoted amount: 400 expected_amount_required without it, 409 quote_changed
1714
+ * when the price or quote moved.
1715
+ */
1675
1716
  upgradeSubscription(data: {
1676
1717
  tier: SubscriptionTierName;
1677
1718
  interval?: 'month' | 'year';
1678
1719
  request_id?: string;
1679
1720
  workspace_id?: string;
1721
+ /** The quote's charge_today_cents. */
1722
+ expected_amount_cents: number;
1723
+ /** The quote's proration_date. */
1724
+ proration_date: number;
1680
1725
  /** What the quote was based on; the API answers 409 quote_stale when the live values differ. */
1681
1726
  expected_current_tier?: SubscriptionTierName;
1682
1727
  expected_interval?: UpgradeInterval;
1728
+ add_api_addon?: boolean;
1683
1729
  }): Promise<UpgradeSubscriptionResponse>;
1684
1730
  /** Exact price of a change; charges nothing. */
1685
1731
  quoteExtraAccounts(data: {
1686
1732
  extra_accounts: number;
1687
1733
  workspace_id?: string;
1688
1734
  }): Promise<ExtraAccountsQuoteResponse>;
1689
- /** Applies the change and charges the saved card. Only call after a quote was shown and approved. */
1735
+ /**
1736
+ * Applies the change and charges the saved card. Only call after a quote was shown and approved.
1737
+ * The API charges only the quoted amount: 400 expected_amount_required without it, 409 quote_changed
1738
+ * when the price or quote moved.
1739
+ */
1690
1740
  setExtraAccounts(data: {
1691
1741
  extra_accounts: number;
1692
1742
  request_id?: string;
1693
1743
  workspace_id?: string;
1744
+ /** The quote's charge_today_cents. */
1745
+ expected_amount_cents: number;
1746
+ /** The quote's proration_date. */
1747
+ proration_date: number;
1694
1748
  /** What the quote was based on; the API answers 409 quote_stale when the live values differ. */
1695
1749
  expected_current_extra_accounts?: number;
1696
1750
  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
  }
@@ -1 +1 @@
1
- export declare const POSTERLY_MCP_VERSION = "0.64.0";
1
+ export declare const POSTERLY_MCP_VERSION = "0.66.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.66.0';
@@ -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
  : '',
@@ -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.',
@@ -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.66.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.66.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.66.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
  }