@capivv/mcp-server 0.2.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/client.d.ts +48 -1
  2. package/dist/client.js +175 -0
  3. package/dist/tools/approve-change-request.d.ts +3 -0
  4. package/dist/tools/approve-change-request.js +16 -0
  5. package/dist/tools/archive-app.d.ts +3 -0
  6. package/dist/tools/archive-app.js +9 -0
  7. package/dist/tools/check-drift.d.ts +3 -0
  8. package/dist/tools/check-drift.js +21 -0
  9. package/dist/tools/create-experiment.d.ts +3 -0
  10. package/dist/tools/create-experiment.js +43 -0
  11. package/dist/tools/create-paywall.d.ts +3 -0
  12. package/dist/tools/create-paywall.js +18 -0
  13. package/dist/tools/create-pricing-strategy.d.ts +3 -0
  14. package/dist/tools/create-pricing-strategy.js +49 -0
  15. package/dist/tools/create-product.js +43 -8
  16. package/dist/tools/create-promotion.d.ts +3 -0
  17. package/dist/tools/create-promotion.js +35 -0
  18. package/dist/tools/create-rescue-flow.d.ts +3 -0
  19. package/dist/tools/create-rescue-flow.js +20 -0
  20. package/dist/tools/delete-app.d.ts +3 -0
  21. package/dist/tools/delete-app.js +9 -0
  22. package/dist/tools/delete-entitlement.d.ts +3 -0
  23. package/dist/tools/delete-entitlement.js +11 -0
  24. package/dist/tools/delete-paywall.d.ts +3 -0
  25. package/dist/tools/delete-paywall.js +16 -0
  26. package/dist/tools/delete-promotion.d.ts +3 -0
  27. package/dist/tools/delete-promotion.js +11 -0
  28. package/dist/tools/delete-rescue-flow.d.ts +3 -0
  29. package/dist/tools/delete-rescue-flow.js +11 -0
  30. package/dist/tools/get-entitlement.d.ts +3 -0
  31. package/dist/tools/get-entitlement.js +9 -0
  32. package/dist/tools/get-experiment-summary.d.ts +3 -0
  33. package/dist/tools/get-experiment-summary.js +9 -0
  34. package/dist/tools/get-offering.d.ts +3 -0
  35. package/dist/tools/get-offering.js +9 -0
  36. package/dist/tools/get-paywall-stats.d.ts +3 -0
  37. package/dist/tools/get-paywall-stats.js +6 -0
  38. package/dist/tools/get-product.d.ts +3 -0
  39. package/dist/tools/get-product.js +9 -0
  40. package/dist/tools/get-rescue-stats.d.ts +3 -0
  41. package/dist/tools/get-rescue-stats.js +12 -0
  42. package/dist/tools/get-rule.d.ts +3 -0
  43. package/dist/tools/get-rule.js +9 -0
  44. package/dist/tools/index.js +103 -0
  45. package/dist/tools/list-change-requests.d.ts +3 -0
  46. package/dist/tools/list-change-requests.js +14 -0
  47. package/dist/tools/list-paywalls.d.ts +3 -0
  48. package/dist/tools/list-paywalls.js +6 -0
  49. package/dist/tools/list-pricing-strategies.d.ts +3 -0
  50. package/dist/tools/list-pricing-strategies.js +8 -0
  51. package/dist/tools/list-promotions.d.ts +3 -0
  52. package/dist/tools/list-promotions.js +6 -0
  53. package/dist/tools/list-rescue-flows.d.ts +3 -0
  54. package/dist/tools/list-rescue-flows.js +6 -0
  55. package/dist/tools/list-rule-versions.d.ts +3 -0
  56. package/dist/tools/list-rule-versions.js +9 -0
  57. package/dist/tools/next-step.js +3 -3
  58. package/dist/tools/preview-pricing.d.ts +3 -0
  59. package/dist/tools/preview-pricing.js +13 -0
  60. package/dist/tools/push-prices-to-stores.d.ts +3 -0
  61. package/dist/tools/push-prices-to-stores.js +9 -0
  62. package/dist/tools/recompute-prices.d.ts +3 -0
  63. package/dist/tools/recompute-prices.js +24 -0
  64. package/dist/tools/resolve-drift.d.ts +3 -0
  65. package/dist/tools/resolve-drift.js +15 -0
  66. package/dist/tools/restore-app.d.ts +3 -0
  67. package/dist/tools/restore-app.js +9 -0
  68. package/dist/tools/revert-app-autopilot.d.ts +3 -0
  69. package/dist/tools/revert-app-autopilot.js +9 -0
  70. package/dist/tools/rollback-rule.d.ts +3 -0
  71. package/dist/tools/rollback-rule.js +10 -0
  72. package/dist/tools/run-app-autopilot.d.ts +3 -0
  73. package/dist/tools/run-app-autopilot.js +9 -0
  74. package/dist/tools/set-country-price-override.d.ts +3 -0
  75. package/dist/tools/set-country-price-override.js +13 -0
  76. package/dist/tools/setup-wizard.js +1 -1
  77. package/dist/tools/start-experiment.d.ts +3 -0
  78. package/dist/tools/start-experiment.js +9 -0
  79. package/dist/tools/stop-experiment.d.ts +3 -0
  80. package/dist/tools/stop-experiment.js +9 -0
  81. package/dist/tools/sync-suggestions-count.d.ts +3 -0
  82. package/dist/tools/sync-suggestions-count.js +6 -0
  83. package/dist/tools/trigger-sync.d.ts +3 -0
  84. package/dist/tools/trigger-sync.js +6 -0
  85. package/dist/tools/update-app.d.ts +3 -0
  86. package/dist/tools/update-app.js +19 -0
  87. package/dist/tools/update-entitlement.d.ts +3 -0
  88. package/dist/tools/update-entitlement.js +13 -0
  89. package/dist/tools/update-experiment.d.ts +3 -0
  90. package/dist/tools/update-experiment.js +22 -0
  91. package/dist/tools/update-offering.d.ts +3 -0
  92. package/dist/tools/update-offering.js +31 -0
  93. package/dist/tools/update-paywall.d.ts +3 -0
  94. package/dist/tools/update-paywall.js +23 -0
  95. package/dist/tools/update-promotion.d.ts +3 -0
  96. package/dist/tools/update-promotion.js +20 -0
  97. package/dist/tools/update-rescue-flow.d.ts +3 -0
  98. package/dist/tools/update-rescue-flow.js +27 -0
  99. package/dist/types.d.ts +302 -0
  100. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export function registerDeletePromotionTool(server, client) {
3
+ server.tool('capivv_delete_promotion', 'Delete a promotion by ID. Stops the promotion immediately and removes it from the dashboard. Active redemptions are preserved in the audit log. Use capivv_list_promotions to find the promotion_id.', {
4
+ promotion_id: z.string().describe('Promotion ID to delete'),
5
+ }, async ({ promotion_id }) => {
6
+ await client.deletePromotion(promotion_id);
7
+ return {
8
+ content: [{ type: 'text', text: `Promotion ${promotion_id} deleted.` }],
9
+ };
10
+ });
11
+ }
@@ -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 registerDeleteRescueFlowTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export function registerDeleteRescueFlowTool(server, client) {
3
+ server.tool('capivv_delete_rescue_flow', 'Delete a rescue flow by ID. The flow stops running immediately. Historical rescue events remain in analytics. Use capivv_list_rescue_flows to find the rescue_flow_id.', {
4
+ rescue_flow_id: z.string().describe('Rescue flow ID to delete'),
5
+ }, async ({ rescue_flow_id }) => {
6
+ await client.deleteRescueFlow(rescue_flow_id);
7
+ return {
8
+ content: [{ type: 'text', text: `Rescue flow ${rescue_flow_id} deleted.` }],
9
+ };
10
+ });
11
+ }
@@ -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 registerGetEntitlementTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerGetEntitlementTool(server, client) {
3
+ server.tool('capivv_get_entitlement', 'Get a single entitlement by ID. Use capivv_list_entitlements to find the entitlement_id.', {
4
+ entitlement_id: z.string().describe('Entitlement ID'),
5
+ }, async ({ entitlement_id }) => {
6
+ const ent = await client.getEntitlement(entitlement_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(ent, null, 2) }] };
8
+ });
9
+ }
@@ -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 registerGetExperimentSummaryTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerGetExperimentSummaryTool(server, client) {
3
+ server.tool('capivv_get_experiment_summary', 'Get full details for a single experiment: its variants, sample sizes, conversion rates, statistical significance, and recommendations. Use capivv_list_experiments to find the experiment_id.', {
4
+ experiment_id: z.string().describe('Experiment ID'),
5
+ }, async ({ experiment_id }) => {
6
+ const exp = await client.getExperiment(experiment_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(exp, null, 2) }] };
8
+ });
9
+ }
@@ -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 registerGetOfferingTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerGetOfferingTool(server, client) {
3
+ server.tool('capivv_get_offering', 'Get a single offering by ID with full package details. Use capivv_list_offerings to find the offering_id.', {
4
+ offering_id: z.string().describe('Offering ID'),
5
+ }, async ({ offering_id }) => {
6
+ const offering = await client.getOffering(offering_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(offering, null, 2) }] };
8
+ });
9
+ }
@@ -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 registerGetPaywallStatsTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,6 @@
1
+ export function registerGetPaywallStatsTool(server, client) {
2
+ server.tool('capivv_get_paywall_stats', 'Get aggregated paywall stats for the workspace: total views, total conversions, and average conversion rate (across every paywall in the tenant). Use capivv_list_paywalls for per-paywall numbers.', async () => {
3
+ const stats = await client.getPaywallStats();
4
+ return { content: [{ type: 'text', text: JSON.stringify(stats, null, 2) }] };
5
+ });
6
+ }
@@ -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 registerGetProductTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerGetProductTool(server, client) {
3
+ server.tool('capivv_get_product', 'Get a single product by ID with full metadata, including the store_product_id when the product was created via Phase A end-to-end. Use capivv_list_products to find the product_id.', {
4
+ product_id: z.string().describe('Product ID'),
5
+ }, async ({ product_id }) => {
6
+ const product = await client.getProduct(product_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(product, null, 2) }] };
8
+ });
9
+ }
@@ -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 registerGetRescueStatsTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ export function registerGetRescueStatsTool(server, client) {
3
+ server.tool('capivv_get_rescue_stats', 'Get aggregated rescue stats for the workspace: total cancellation attempts, successful saves, save rate, and recovered revenue. Defaults to the last 30 days.', {
4
+ days: z
5
+ .number()
6
+ .optional()
7
+ .describe('Lookback window in days. Defaults to 30.'),
8
+ }, async ({ days }) => {
9
+ const stats = await client.getRescueStats(days ?? 30);
10
+ return { content: [{ type: 'text', text: JSON.stringify(stats, null, 2) }] };
11
+ });
12
+ }
@@ -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 registerGetRuleTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerGetRuleTool(server, client) {
3
+ server.tool('capivv_get_rule', 'Get a single rule (entitlement-grant YAML logic) by ID. Use capivv_list_rules to find the rule_id.', {
4
+ rule_id: z.string().describe('Rule ID'),
5
+ }, async ({ rule_id }) => {
6
+ const rule = await client.getRuleById(rule_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(rule, null, 2) }] };
8
+ });
9
+ }
@@ -22,6 +22,52 @@ import { registerVerifySetupTool } from './verify-setup.js';
22
22
  import { registerWhoamiTool } from './whoami.js';
23
23
  import { registerAutopilotStatusTool } from './autopilot-status.js';
24
24
  import { registerApiKeyUsageTool } from './api-key-usage.js';
25
+ import { registerListPaywallsTool } from './list-paywalls.js';
26
+ import { registerCreatePaywallTool } from './create-paywall.js';
27
+ import { registerUpdatePaywallTool } from './update-paywall.js';
28
+ import { registerDeletePaywallTool } from './delete-paywall.js';
29
+ import { registerGetPaywallStatsTool } from './get-paywall-stats.js';
30
+ import { registerListPromotionsTool } from './list-promotions.js';
31
+ import { registerCreatePromotionTool } from './create-promotion.js';
32
+ import { registerUpdatePromotionTool } from './update-promotion.js';
33
+ import { registerDeletePromotionTool } from './delete-promotion.js';
34
+ import { registerListRescueFlowsTool } from './list-rescue-flows.js';
35
+ import { registerCreateRescueFlowTool } from './create-rescue-flow.js';
36
+ import { registerUpdateRescueFlowTool } from './update-rescue-flow.js';
37
+ import { registerDeleteRescueFlowTool } from './delete-rescue-flow.js';
38
+ import { registerGetRescueStatsTool } from './get-rescue-stats.js';
39
+ import { registerListPricingStrategiesTool } from './list-pricing-strategies.js';
40
+ import { registerCreatePricingStrategyTool } from './create-pricing-strategy.js';
41
+ import { registerPreviewPricingTool } from './preview-pricing.js';
42
+ import { registerRecomputePricesTool } from './recompute-prices.js';
43
+ import { registerPushPricesToStoresTool } from './push-prices-to-stores.js';
44
+ import { registerListChangeRequestsTool } from './list-change-requests.js';
45
+ import { registerApproveChangeRequestTool } from './approve-change-request.js';
46
+ import { registerSetCountryPriceOverrideTool } from './set-country-price-override.js';
47
+ import { registerCreateExperimentTool } from './create-experiment.js';
48
+ import { registerUpdateExperimentTool } from './update-experiment.js';
49
+ import { registerStartExperimentTool } from './start-experiment.js';
50
+ import { registerStopExperimentTool } from './stop-experiment.js';
51
+ import { registerGetExperimentSummaryTool } from './get-experiment-summary.js';
52
+ import { registerUpdateAppTool } from './update-app.js';
53
+ import { registerDeleteAppTool } from './delete-app.js';
54
+ import { registerArchiveAppTool } from './archive-app.js';
55
+ import { registerRestoreAppTool } from './restore-app.js';
56
+ import { registerRunAppAutopilotTool } from './run-app-autopilot.js';
57
+ import { registerRevertAppAutopilotTool } from './revert-app-autopilot.js';
58
+ import { registerGetEntitlementTool } from './get-entitlement.js';
59
+ import { registerUpdateEntitlementTool } from './update-entitlement.js';
60
+ import { registerDeleteEntitlementTool } from './delete-entitlement.js';
61
+ import { registerGetProductTool } from './get-product.js';
62
+ import { registerGetRuleTool } from './get-rule.js';
63
+ import { registerListRuleVersionsTool } from './list-rule-versions.js';
64
+ import { registerRollbackRuleTool } from './rollback-rule.js';
65
+ import { registerGetOfferingTool } from './get-offering.js';
66
+ import { registerUpdateOfferingTool } from './update-offering.js';
67
+ import { registerCheckDriftTool } from './check-drift.js';
68
+ import { registerResolveDriftTool } from './resolve-drift.js';
69
+ import { registerSyncSuggestionsCountTool } from './sync-suggestions-count.js';
70
+ import { registerTriggerSyncTool } from './trigger-sync.js';
25
71
  export function registerAllTools(server, client) {
26
72
  // Identity — call this first to verify which workspace you're connected to
27
73
  registerWhoamiTool(server, client);
@@ -58,4 +104,61 @@ export function registerAllTools(server, client) {
58
104
  registerDeleteRuleTool(server, client);
59
105
  // Experiments
60
106
  registerListExperimentsTool(server, client);
107
+ // Paywalls (V8 Phase B.1)
108
+ registerListPaywallsTool(server, client);
109
+ registerCreatePaywallTool(server, client);
110
+ registerUpdatePaywallTool(server, client);
111
+ registerDeletePaywallTool(server, client);
112
+ registerGetPaywallStatsTool(server, client);
113
+ // Promotions (V8 Phase B.2)
114
+ registerListPromotionsTool(server, client);
115
+ registerCreatePromotionTool(server, client);
116
+ registerUpdatePromotionTool(server, client);
117
+ registerDeletePromotionTool(server, client);
118
+ // Rescue flows (V8 Phase B.3)
119
+ registerListRescueFlowsTool(server, client);
120
+ registerCreateRescueFlowTool(server, client);
121
+ registerUpdateRescueFlowTool(server, client);
122
+ registerDeleteRescueFlowTool(server, client);
123
+ registerGetRescueStatsTool(server, client);
124
+ // Pricing (V8 Phase B.4)
125
+ registerListPricingStrategiesTool(server, client);
126
+ registerCreatePricingStrategyTool(server, client);
127
+ registerPreviewPricingTool(server, client);
128
+ registerRecomputePricesTool(server, client);
129
+ registerPushPricesToStoresTool(server, client);
130
+ registerListChangeRequestsTool(server, client);
131
+ registerApproveChangeRequestTool(server, client);
132
+ registerSetCountryPriceOverrideTool(server, client);
133
+ // Experiment writes (V8 Phase B.5)
134
+ registerCreateExperimentTool(server, client);
135
+ registerUpdateExperimentTool(server, client);
136
+ registerStartExperimentTool(server, client);
137
+ registerStopExperimentTool(server, client);
138
+ registerGetExperimentSummaryTool(server, client);
139
+ // Apps gap-fillers (V8 Phase B.6)
140
+ registerUpdateAppTool(server, client);
141
+ registerDeleteAppTool(server, client);
142
+ registerArchiveAppTool(server, client);
143
+ registerRestoreAppTool(server, client);
144
+ registerRunAppAutopilotTool(server, client);
145
+ registerRevertAppAutopilotTool(server, client);
146
+ // Entitlements gap-fillers (V8 Phase B.7)
147
+ registerGetEntitlementTool(server, client);
148
+ registerUpdateEntitlementTool(server, client);
149
+ registerDeleteEntitlementTool(server, client);
150
+ // Products gap-filler (V8 Phase B.8)
151
+ registerGetProductTool(server, client);
152
+ // Rules gap-fillers (V8 Phase B.9)
153
+ registerGetRuleTool(server, client);
154
+ registerListRuleVersionsTool(server, client);
155
+ registerRollbackRuleTool(server, client);
156
+ // Offerings gap-fillers (V8 Phase B.10)
157
+ registerGetOfferingTool(server, client);
158
+ registerUpdateOfferingTool(server, client);
159
+ // Drift detection + remediation (V8 Phase C)
160
+ registerCheckDriftTool(server, client);
161
+ registerResolveDriftTool(server, client);
162
+ registerSyncSuggestionsCountTool(server, client);
163
+ registerTriggerSyncTool(server, client);
61
164
  }
@@ -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 registerListChangeRequestsTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export function registerListChangeRequestsTool(server, client) {
3
+ server.tool('capivv_list_change_requests', 'List pricing change requests that exceeded the strategy\'s guardrails and are waiting for human approval. Filter by status (pending / approved / rejected) or by product_id.', {
4
+ app_id: z.string().describe('App to scope the listing to'),
5
+ status: z
6
+ .string()
7
+ .optional()
8
+ .describe('Filter by status: pending, approved, or rejected'),
9
+ product_id: z.string().optional().describe('Filter by product'),
10
+ }, async ({ app_id, status, product_id }) => {
11
+ const requests = await client.listPricingChangeRequests(app_id, status, product_id);
12
+ return { content: [{ type: 'text', text: JSON.stringify(requests, null, 2) }] };
13
+ });
14
+ }
@@ -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 registerListPaywallsTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,6 @@
1
+ export function registerListPaywallsTool(server, client) {
2
+ server.tool('capivv_list_paywalls', 'List every paywall in the workspace with its type, status, view / conversion counts, and config. Use this to find a paywall_id before calling capivv_update_paywall or capivv_delete_paywall.', async () => {
3
+ const paywalls = await client.listPaywalls();
4
+ return { content: [{ type: 'text', text: JSON.stringify(paywalls, null, 2) }] };
5
+ });
6
+ }
@@ -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 registerListPricingStrategiesTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,8 @@
1
+ export function registerListPricingStrategiesTool(server, client) {
2
+ server.tool('capivv_list_pricing_strategies', 'List every pricing strategy across the workspace, including affordability tier bounds, blend weights (PPP / Big Mac / FX-neutral), and guardrails. Use this to find a strategy_id before previewing or recomputing prices.', async () => {
3
+ const strategies = await client.listPricingStrategies();
4
+ return {
5
+ content: [{ type: 'text', text: JSON.stringify(strategies, null, 2) }],
6
+ };
7
+ });
8
+ }
@@ -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 registerListPromotionsTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,6 @@
1
+ export function registerListPromotionsTool(server, client) {
2
+ server.tool('capivv_list_promotions', 'List every promotion in the workspace with its campaign type, status, schedule, discount, and redemption count. Use this to find a promotion_id before calling capivv_update_promotion or capivv_delete_promotion.', async () => {
3
+ const promotions = await client.listPromotions();
4
+ return { content: [{ type: 'text', text: JSON.stringify(promotions, null, 2) }] };
5
+ });
6
+ }
@@ -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 registerListRescueFlowsTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,6 @@
1
+ export function registerListRescueFlowsTool(server, client) {
2
+ server.tool('capivv_list_rescue_flows', 'List every cancellation rescue flow in the workspace with its status, priority, conditions, and steps. Use this to find a rescue_flow_id before calling update / delete.', async () => {
3
+ const flows = await client.listRescueFlows();
4
+ return { content: [{ type: 'text', text: JSON.stringify(flows, null, 2) }] };
5
+ });
6
+ }
@@ -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 registerListRuleVersionsTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerListRuleVersionsTool(server, client) {
3
+ server.tool('capivv_list_rule_versions', 'List every saved version of a rule (history). Use capivv_rollback_rule with a version number to revert.', {
4
+ rule_id: z.string().describe('Rule ID'),
5
+ }, async ({ rule_id }) => {
6
+ const versions = await client.listRuleVersions(rule_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(versions, null, 2) }] };
8
+ });
9
+ }
@@ -43,11 +43,11 @@ function buildSteps(state) {
43
43
  total_steps: total,
44
44
  title: 'Create products',
45
45
  status: state.products > 0 ? 'done' : 'needed',
46
- what: 'Create your subscription or in-app purchase products, linked to entitlements.',
46
+ what: 'Create your subscription or in-app purchase products, linked to entitlements. With a connected store integration, Capivv creates the product in Capivv AND in App Store Connect / Google Play in one call.',
47
47
  how: state.apps > 0
48
- ? 'Use capivv_create_product with app_id, external_id (must match your store product ID exactly), product_type, and entitlement_ids. Or use capivv_import_products to auto-import from a connected store.'
48
+ ? 'Use capivv_create_product with app_id, external_id (the store product ID you want — Capivv will create it in the store too), product_type, prices, and entitlement_ids. Or use capivv_import_products to pull existing store products into Capivv.'
49
49
  : 'First complete Step 1 (create an app), then use capivv_create_product.',
50
- why: 'Products map to real App Store / Google Play items. The external_id must match exactly or purchase verification will fail.',
50
+ why: 'Products are end-to-end: Capivv writes to its database AND to the connected store(s) at the price you specify. Tier snapping is automatic and the response shows both the requested and the snapped price.',
51
51
  });
52
52
  // Step 5: Offerings
53
53
  steps.push({
@@ -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 registerPreviewPricingTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export function registerPreviewPricingTool(server, client) {
3
+ server.tool('capivv_preview_pricing', 'Preview the prices a pricing strategy would compute for a product, without applying them. Returns proposed prices per country, the factor breakdown (FX / PPP / Big Mac contributions), and which countries would trigger the guardrails.', {
4
+ product_id: z.string().describe('Product to preview pricing for'),
5
+ strategy_id: z
6
+ .string()
7
+ .optional()
8
+ .describe('Strategy to use. Defaults to the product\'s assigned strategy.'),
9
+ }, async ({ product_id, strategy_id }) => {
10
+ const result = await client.previewPricing(product_id, strategy_id);
11
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
12
+ });
13
+ }
@@ -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 registerPushPricesToStoresTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerPushPricesToStoresTool(server, client) {
3
+ server.tool('capivv_push_prices_to_stores', 'Push the current Capivv prices for a product to the connected stores (App Store Connect / Google Play). Snaps each price to the nearest store tier as needed. Returns counts of pushed / failed / skipped (skipped = no integration connected for that platform).', {
4
+ product_id: z.string().describe('Product whose Capivv prices should be pushed to stores'),
5
+ }, async ({ product_id }) => {
6
+ const result = await client.pushPricesToStores(product_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
8
+ });
9
+ }
@@ -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 registerRecomputePricesTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export function registerRecomputePricesTool(server, client) {
3
+ server.tool('capivv_recompute_prices', [
4
+ 'Recompute prices and apply them to Capivv. Pass `product_id` to recompute one product, or `strategy_id` to recompute every product tied to that strategy.',
5
+ 'Changes within the strategy\'s guardrails are auto-applied. Changes that exceed `max_auto_change_pct` / `max_auto_decrease_pct` are queued as change requests for human approval (use capivv_list_change_requests + capivv_approve_change_request).',
6
+ 'This does NOT push to the stores — call capivv_push_prices_to_stores afterwards.',
7
+ ].join(' '), {
8
+ product_id: z
9
+ .string()
10
+ .optional()
11
+ .describe('Product to recompute. Mutually exclusive with strategy_id.'),
12
+ strategy_id: z
13
+ .string()
14
+ .optional()
15
+ .describe('Strategy to recompute (applies to every product on it). Mutually exclusive with product_id.'),
16
+ reason: z
17
+ .string()
18
+ .optional()
19
+ .describe('Free-form reason for the recompute (logged on every change request). Defaults to "manual".'),
20
+ }, async (args) => {
21
+ const result = await client.recomputePrices(args);
22
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
23
+ });
24
+ }
@@ -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 registerResolveDriftTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ export function registerResolveDriftTool(server, client) {
3
+ server.tool('capivv_resolve_drift', [
4
+ 'Resolve a drift suggestion by ID. `accept` applies the store-side change to Capivv (e.g., imports the new product, updates the local price); `dismiss` marks the suggestion as ignored without changing anything.',
5
+ 'For "Capivv has it but the store does not" cases, use capivv_create_product instead — that path re-creates the store-side record from Capivv via the Phase A helpers.',
6
+ ].join(' '), {
7
+ suggestion_id: z.string().describe('Sync suggestion ID (returned by capivv_check_drift)'),
8
+ action: z
9
+ .enum(['accept', 'dismiss'])
10
+ .describe('"accept" applies the change to Capivv; "dismiss" ignores it.'),
11
+ }, async ({ suggestion_id, action }) => {
12
+ const suggestion = await client.resolveSyncSuggestion(suggestion_id, action);
13
+ return { content: [{ type: 'text', text: JSON.stringify(suggestion, null, 2) }] };
14
+ });
15
+ }
@@ -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 registerRestoreAppTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerRestoreAppTool(server, client) {
3
+ server.tool('capivv_restore_app', 'Restore a previously archived app. Inverse of capivv_archive_app.', {
4
+ app_id: z.string().describe('App ID to restore'),
5
+ }, async ({ app_id }) => {
6
+ const app = await client.restoreApp(app_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(app, null, 2) }] };
8
+ });
9
+ }
@@ -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 registerRevertAppAutopilotTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerRevertAppAutopilotTool(server, client) {
3
+ server.tool('capivv_revert_app_autopilot', 'Revert autopilot-generated artifacts for an app. Removes entitlements, products, offerings, and rules that were auto-created by capivv_run_app_autopilot. Manually-created records are preserved.', {
4
+ app_id: z.string().describe('App ID to revert autopilot on'),
5
+ }, async ({ app_id }) => {
6
+ const result = await client.revertAppAutopilot(app_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
8
+ });
9
+ }
@@ -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 registerRollbackRuleTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ export function registerRollbackRuleTool(server, client) {
3
+ server.tool('capivv_rollback_rule', 'Roll a rule back to a previous version. Use capivv_list_rule_versions to find the target version number.', {
4
+ rule_id: z.string().describe('Rule ID'),
5
+ version: z.number().describe('Version number to roll back to'),
6
+ }, async ({ rule_id, version }) => {
7
+ const rule = await client.rollbackRule(rule_id, version);
8
+ return { content: [{ type: 'text', text: JSON.stringify(rule, null, 2) }] };
9
+ });
10
+ }
@@ -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 registerRunAppAutopilotTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerRunAppAutopilotTool(server, client) {
3
+ server.tool('capivv_run_app_autopilot', 'Run autopilot for an app: idempotent re-seeding of entitlements, products, offerings, and rules from the connected store data. Safe to call repeatedly. Use capivv_revert_app_autopilot to undo.', {
4
+ app_id: z.string().describe('App ID to run autopilot on'),
5
+ }, async ({ app_id }) => {
6
+ const result = await client.runAppAutopilot(app_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
8
+ });
9
+ }
@@ -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 registerSetCountryPriceOverrideTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export function registerSetCountryPriceOverrideTool(server, client) {
3
+ server.tool('capivv_set_country_price_override', 'Set a manual price override for a product in a specific country. Overridden prices are NOT touched by capivv_recompute_prices — they hold the value the user set until cleared. Use capivv_push_prices_to_stores to propagate the override to App Store Connect / Google Play.', {
4
+ product_id: z.string().describe('Product ID'),
5
+ country_code: z.string().describe('ISO 3166-1 alpha-2 country code (e.g. "US", "DE", "JP")'),
6
+ store: z.string().describe('Which store this price targets: "apple", "google", or "both"'),
7
+ currency: z.string().describe('ISO 4217 currency code (e.g. "USD", "EUR")'),
8
+ amount_cents: z.number().describe('Price in cents (e.g. 999 for $9.99)'),
9
+ }, async (args) => {
10
+ const result = await client.setCountryPriceOverride(args);
11
+ return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
12
+ });
13
+ }
@@ -38,7 +38,7 @@ Example:
38
38
  name: z.string().describe('Product display name (e.g., "Monthly Plan")'),
39
39
  external_id: z
40
40
  .string()
41
- .describe('Store product ID must match App Store Connect / Google Play exactly'),
41
+ .describe('Store product ID. With a connected store integration, Capivv creates this product in App Store Connect / Google Play too — pass the ID you want it to have there.'),
42
42
  billing_period: z
43
43
  .string()
44
44
  .describe('Billing period: week, month, three_months, six_months, or year'),
@@ -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 registerStartExperimentTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerStartExperimentTool(server, client) {
3
+ server.tool('capivv_start_experiment', 'Flip an experiment from draft to running. New users now get assigned to variants based on traffic_percent. Use capivv_get_experiment_summary to monitor progress.', {
4
+ experiment_id: z.string().describe('Experiment ID to start'),
5
+ }, async ({ experiment_id }) => {
6
+ const exp = await client.startExperiment(experiment_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(exp, null, 2) }] };
8
+ });
9
+ }
@@ -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 registerStopExperimentTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export function registerStopExperimentTool(server, client) {
3
+ server.tool('capivv_stop_experiment', 'Mark an experiment as completed. New users stop being assigned to variants; existing assignments are preserved for analysis. Use capivv_get_experiment_summary to read final results.', {
4
+ experiment_id: z.string().describe('Experiment ID to stop'),
5
+ }, async ({ experiment_id }) => {
6
+ const exp = await client.stopExperiment(experiment_id);
7
+ return { content: [{ type: 'text', text: JSON.stringify(exp, null, 2) }] };
8
+ });
9
+ }
@@ -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 registerSyncSuggestionsCountTool(server: McpServer, client: CapivvClient): void;
@@ -0,0 +1,6 @@
1
+ export function registerSyncSuggestionsCountTool(server, client) {
2
+ server.tool('capivv_sync_suggestions_count', 'Get the count of pending drift suggestions across the workspace. A quick health check before deciding whether to call capivv_check_drift for full details.', async () => {
3
+ const count = await client.getSyncSuggestionsCount();
4
+ return { content: [{ type: 'text', text: JSON.stringify(count, null, 2) }] };
5
+ });
6
+ }
@@ -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 registerTriggerSyncTool(server: McpServer, client: CapivvClient): void;