@capivv/mcp-server 0.5.5 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Config } from './config.js';
2
- import type { App, Product, Entitlement, Offering, Rule, Experiment, ExperimentSummary, AnalyticsOverview, OnboardingResponse, ImportPreviewResponse, CreateAppRequest, CreateEntitlementRequest, CreateProductRequest, CreateOfferingRequest, CreateRuleRequest, ValidateRuleRequest, ValidateRuleResponse, WhoamiResponse, ApiKeyUsageResponse, Paywall, CreatePaywallRequest, UpdatePaywallRequest, PaywallStats, Promotion, CreatePromotionRequest, UpdatePromotionRequest, RescueFlow, CreateRescueFlowRequest, UpdateRescueFlowRequest, RescueStats, PricingStrategy, CreatePricingStrategyRequest, PricingPreviewResult, PricingRecomputeRequest, PricingRecomputeResult, PricingPushResult, PricingChangeRequest, SetCountryPriceOverrideRequest, ExperimentWithVariants, CreateExperimentRequest, UpdateExperimentRequest, UpdateAppRequest, UpdateEntitlementRequest, UpdateOfferingRequest, AutopilotRunResult, SyncSuggestion, SyncSuggestionsCount, TriggerSyncResult, IntegrationSummary, ConnectAppleIntegrationRequest, ConnectAppleIntegrationResult, ConnectGoogleIntegrationRequest, ConnectGoogleIntegrationResult, SetSubscriptionReviewScreenshotRequest, SetSubscriptionReviewScreenshotResult } from './types.js';
2
+ import type { App, Product, Entitlement, Offering, Rule, Experiment, ExperimentSummary, AnalyticsOverview, OnboardingResponse, ImportPreviewResponse, CreateAppRequest, CreateEntitlementRequest, CreateProductRequest, CreateOfferingRequest, CreateRuleRequest, ValidateRuleRequest, ValidateRuleResponse, WhoamiResponse, ApiKeyUsageResponse, Paywall, CreatePaywallRequest, UpdatePaywallRequest, PaywallStats, Promotion, CreatePromotionRequest, UpdatePromotionRequest, RescueFlow, CreateRescueFlowRequest, UpdateRescueFlowRequest, RescueStats, PricingStrategy, CreatePricingStrategyRequest, PricingPreviewResult, PricingRecomputeRequest, PricingRecomputeResult, PricingPushResult, PricingChangeRequest, SetCountryPriceOverrideRequest, ExperimentWithVariants, CreateExperimentRequest, UpdateExperimentRequest, UpdateAppRequest, UpdateEntitlementRequest, UpdateOfferingRequest, AutopilotRunResult, SyncSuggestion, SyncSuggestionsCount, TriggerSyncResult, IntegrationSummary, ConnectAppleIntegrationRequest, ConnectAppleIntegrationResult, ConnectGoogleIntegrationRequest, ConnectGoogleIntegrationResult, SetSubscriptionReviewScreenshotRequest, SetSubscriptionReviewScreenshotResult, SubscriptionStateInfo, TouchSubscriptionResult } from './types.js';
3
3
  export declare class ApiError extends Error {
4
4
  status: number;
5
5
  code: string;
@@ -92,4 +92,6 @@ export declare class CapivvClient {
92
92
  connectGoogleIntegration(data: ConnectGoogleIntegrationRequest): Promise<ConnectGoogleIntegrationResult>;
93
93
  disconnectIntegration(provider: string): Promise<void>;
94
94
  setSubscriptionReviewScreenshot(data: SetSubscriptionReviewScreenshotRequest): Promise<SetSubscriptionReviewScreenshotResult>;
95
+ getSubscriptionState(appleSubscriptionId: string): Promise<SubscriptionStateInfo>;
96
+ touchSubscription(appleSubscriptionId: string): Promise<TouchSubscriptionResult>;
95
97
  }
package/dist/client.js CHANGED
@@ -344,4 +344,10 @@ export class CapivvClient {
344
344
  const { apple_subscription_id, ...body } = data;
345
345
  return this.post(`/dashboard/subscriptions/${encodeURIComponent(apple_subscription_id)}/review-screenshot`, body);
346
346
  }
347
+ async getSubscriptionState(appleSubscriptionId) {
348
+ return this.get(`/dashboard/subscriptions/${encodeURIComponent(appleSubscriptionId)}/state`);
349
+ }
350
+ async touchSubscription(appleSubscriptionId) {
351
+ return this.post(`/dashboard/subscriptions/${encodeURIComponent(appleSubscriptionId)}/touch`);
352
+ }
347
353
  }
@@ -7,6 +7,8 @@ export function registerCreateProductTool(server, client) {
7
7
  'Pass `skip_store_write: true` to opt out of the store-side write — only useful when migrating an existing store-side product into Capivv (rare).',
8
8
  '',
9
9
  'On success the response includes a `store_create` block with the store-side product ID and snapped prices. On store failure the Capivv-side record is rolled back and the verbatim store error is returned.',
10
+ '',
11
+ 'KNOWN APPLE ISSUE — auto-renewing subscriptions: After this call succeeds, Apple may keep the subscription at MISSING_METADATA even when all metadata is uploaded. This is a known divergence between Apple\'s modern /v1/subscriptions API and its legacy /v1/inAppPurchases mirror. After uploading the review screenshot via capivv_set_subscription_review_screenshot, poll capivv_get_subscription_state — if state stays at MISSING_METADATA for more than a few minutes, call capivv_touch_subscription (best-effort) or have the customer click Save in the App Store Connect web UI.',
10
12
  ].join(' '), {
11
13
  app_id: z.string().describe('App ID this product belongs to'),
12
14
  external_id: z.string().describe('Store product ID (e.g., "com.example.pro_monthly")'),
@@ -42,6 +44,14 @@ export function registerCreateProductTool(server, client) {
42
44
  .string()
43
45
  .optional()
44
46
  .describe('Locale used for store-side product localization. Defaults to "en-US".'),
47
+ apple_available_territories: z
48
+ .array(z.string())
49
+ .optional()
50
+ .describe('Apple territories (ISO 3166-1 alpha-3, e.g. ["USA", "DEU", "GBR"]) the subscription is available in. Defaults derive from the prices\' currencies; USD prices → ["USA"]. Setting this is required for the subscription to leave MISSING_METADATA.'),
51
+ apple_available_in_new_territories: z
52
+ .boolean()
53
+ .optional()
54
+ .describe('When true (default), opts the subscription into new Apple territories automatically as Apple adds them. SaaS-friendly default.'),
45
55
  }, async (args) => {
46
56
  const { skip_store_write, ...rest } = args;
47
57
  const product = await client.createProduct({
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { CapivvClient } from '../client.js';
3
+ export declare function registerGetSubscriptionStateTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ export function registerGetSubscriptionStateTool(server, client) {
3
+ server.tool('capivv_get_subscription_state', [
4
+ 'Read the current Apple-side state of a subscription. Returns name, productId, and Apple\'s lifecycle state (MISSING_METADATA / READY_TO_SUBMIT / WAITING_FOR_REVIEW / IN_REVIEW / APPROVED / REJECTED / etc).',
5
+ '',
6
+ 'Use this to verify a subscription is actually ready after capivv_create_product + capivv_set_subscription_review_screenshot. Apple\'s modern /v1/subscriptions and legacy /v1/inAppPurchases views can diverge — a subscription with all metadata + screenshot uploaded sometimes stays at MISSING_METADATA because the legacy mirror lags. Poll this every 30-60 seconds; if state doesn\'t progress within a few minutes, call capivv_touch_subscription or click Save in App Store Connect\'s web UI.',
7
+ ].join(' '), {
8
+ apple_subscription_id: z
9
+ .string()
10
+ .describe('Apple subscription ID (e.g. "6764778053") — the store-side ID, not the Capivv UUID.'),
11
+ }, async ({ apple_subscription_id }) => {
12
+ const info = await client.getSubscriptionState(apple_subscription_id);
13
+ return { content: [{ type: 'text', text: JSON.stringify(info, null, 2) }] };
14
+ });
15
+ }
@@ -73,6 +73,8 @@ import { registerConnectAppleIntegrationTool } from './connect-apple-integration
73
73
  import { registerConnectGoogleIntegrationTool } from './connect-google-integration.js';
74
74
  import { registerDisconnectIntegrationTool } from './disconnect-integration.js';
75
75
  import { registerSetSubscriptionReviewScreenshotTool } from './set-subscription-review-screenshot.js';
76
+ import { registerGetSubscriptionStateTool } from './get-subscription-state.js';
77
+ import { registerTouchSubscriptionTool } from './touch-subscription.js';
76
78
  export function registerAllTools(server, client) {
77
79
  // Identity — call this first to verify which workspace you're connected to
78
80
  registerWhoamiTool(server, client);
@@ -178,4 +180,9 @@ export function registerAllTools(server, client) {
178
180
  // wrapped in a single MCP call so the agent can take a subscription from
179
181
  // MISSING_METADATA to READY_FOR_REVIEW in one step.)
180
182
  registerSetSubscriptionReviewScreenshotTool(server, client);
183
+ // Subscription state probe + touch (v0.5.6 — workaround for Apple's
184
+ // modern-vs-legacy view divergence keeping subscriptions in
185
+ // MISSING_METADATA after a successful create.)
186
+ registerGetSubscriptionStateTool(server, client);
187
+ registerTouchSubscriptionTool(server, client);
181
188
  }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { CapivvClient } from '../client.js';
3
+ export declare function registerTouchSubscriptionTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ export function registerTouchSubscriptionTool(server, client) {
3
+ server.tool('capivv_touch_subscription', [
4
+ 'BEST-EFFORT workaround for Apple\'s modern-vs-legacy view divergence.',
5
+ '',
6
+ 'After capivv_create_product creates the subscription via Apple\'s /v1/subscriptions endpoint, a legacy /v1/inAppPurchases mirror is also created with its own state machine. The legacy record can stay at WAITING_FOR_SCREENSHOT (which keeps the modern view at MISSING_METADATA) even after the screenshot uploads cleanly, because Apple\'s state recompute pipeline still reads from the legacy view and the modern API doesn\'t reliably trigger that recompute.',
7
+ '',
8
+ 'This tool does a no-op PATCH on the subscription (re-set name to its current value), which mirrors what clicking "Save" in App Store Connect\'s web UI appears to trigger. Whether it actually fires the recompute hasn\'t been confirmed in every state — call capivv_get_subscription_state 30-60 seconds afterwards to check. If state still doesn\'t progress, fall back to manual ASC web UI Save.',
9
+ ].join(' '), {
10
+ apple_subscription_id: z
11
+ .string()
12
+ .describe('Apple subscription ID (e.g. "6764778053") — the store-side ID, not the Capivv UUID.'),
13
+ }, async ({ apple_subscription_id }) => {
14
+ const result = await client.touchSubscription(apple_subscription_id);
15
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
16
+ });
17
+ }
package/dist/types.d.ts CHANGED
@@ -250,6 +250,18 @@ export interface CreateProductRequest {
250
250
  also_create_in_store?: boolean;
251
251
  /** Default product locale for store-side localizations. Defaults to "en-US". */
252
252
  default_locale?: string;
253
+ /**
254
+ * V0.5.7: Apple territories the subscription is available in (ISO 3166-1
255
+ * alpha-3 — e.g. ["USA", "DEU", "GBR"]). Defaults derive from the
256
+ * prices' currencies; USD prices → ["USA"]. Without availability the
257
+ * Apple subscription stays in MISSING_METADATA.
258
+ */
259
+ apple_available_territories?: string[];
260
+ /**
261
+ * V0.5.7: opt the subscription in to new Apple territories as Apple
262
+ * adds them. Defaults to true.
263
+ */
264
+ apple_available_in_new_territories?: boolean;
253
265
  }
254
266
  export interface Paywall {
255
267
  id: string;
@@ -577,3 +589,14 @@ export interface SetSubscriptionReviewScreenshotResult {
577
589
  screenshot_id: string;
578
590
  bytes_uploaded: number;
579
591
  }
592
+ export interface SubscriptionStateInfo {
593
+ apple_subscription_id: string;
594
+ product_id: string;
595
+ name: string | null;
596
+ state: string | null;
597
+ }
598
+ export interface TouchSubscriptionResult {
599
+ apple_subscription_id: string;
600
+ touched: boolean;
601
+ next_action: string;
602
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capivv/mcp-server",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "description": "MCP server for managing Capivv subscription platform via AI assistants",
5
5
  "type": "module",
6
6
  "bin": {