@capivv/mcp-server 0.1.3 → 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 (141) hide show
  1. package/README.md +73 -2
  2. package/dist/client.d.ts +62 -3
  3. package/dist/client.js +220 -5
  4. package/dist/config.js +1 -1
  5. package/dist/http.d.ts +12 -0
  6. package/dist/http.js +102 -0
  7. package/dist/resources/guides.d.ts +2 -0
  8. package/dist/resources/guides.js +81 -0
  9. package/dist/resources/index.js +4 -0
  10. package/dist/resources/quickstart.d.ts +2 -0
  11. package/dist/resources/quickstart.js +173 -0
  12. package/dist/resources/rules.js +8 -2
  13. package/dist/tools/activate-rule.d.ts +3 -0
  14. package/dist/tools/activate-rule.js +9 -0
  15. package/dist/tools/api-key-usage.d.ts +3 -0
  16. package/dist/tools/api-key-usage.js +70 -0
  17. package/dist/tools/apply-rule.js +54 -13
  18. package/dist/tools/approve-change-request.d.ts +3 -0
  19. package/dist/tools/approve-change-request.js +16 -0
  20. package/dist/tools/archive-app.d.ts +3 -0
  21. package/dist/tools/archive-app.js +9 -0
  22. package/dist/tools/autopilot-status.d.ts +3 -0
  23. package/dist/tools/autopilot-status.js +117 -0
  24. package/dist/tools/check-drift.d.ts +3 -0
  25. package/dist/tools/check-drift.js +21 -0
  26. package/dist/tools/create-app.d.ts +3 -0
  27. package/dist/tools/create-app.js +13 -0
  28. package/dist/tools/create-entitlement.d.ts +3 -0
  29. package/dist/tools/create-entitlement.js +11 -0
  30. package/dist/tools/create-experiment.d.ts +3 -0
  31. package/dist/tools/create-experiment.js +43 -0
  32. package/dist/tools/create-paywall.d.ts +3 -0
  33. package/dist/tools/create-paywall.js +18 -0
  34. package/dist/tools/create-pricing-strategy.d.ts +3 -0
  35. package/dist/tools/create-pricing-strategy.js +49 -0
  36. package/dist/tools/create-product.d.ts +3 -0
  37. package/dist/tools/create-product.js +77 -0
  38. package/dist/tools/create-promotion.d.ts +3 -0
  39. package/dist/tools/create-promotion.js +35 -0
  40. package/dist/tools/create-rescue-flow.d.ts +3 -0
  41. package/dist/tools/create-rescue-flow.js +20 -0
  42. package/dist/tools/delete-app.d.ts +3 -0
  43. package/dist/tools/delete-app.js +9 -0
  44. package/dist/tools/delete-entitlement.d.ts +3 -0
  45. package/dist/tools/delete-entitlement.js +11 -0
  46. package/dist/tools/delete-paywall.d.ts +3 -0
  47. package/dist/tools/delete-paywall.js +16 -0
  48. package/dist/tools/delete-product.d.ts +3 -0
  49. package/dist/tools/delete-product.js +9 -0
  50. package/dist/tools/delete-promotion.d.ts +3 -0
  51. package/dist/tools/delete-promotion.js +11 -0
  52. package/dist/tools/delete-rescue-flow.d.ts +3 -0
  53. package/dist/tools/delete-rescue-flow.js +11 -0
  54. package/dist/tools/delete-rule.d.ts +3 -0
  55. package/dist/tools/delete-rule.js +9 -0
  56. package/dist/tools/get-entitlement.d.ts +3 -0
  57. package/dist/tools/get-entitlement.js +9 -0
  58. package/dist/tools/get-experiment-summary.d.ts +3 -0
  59. package/dist/tools/get-experiment-summary.js +9 -0
  60. package/dist/tools/get-offering.d.ts +3 -0
  61. package/dist/tools/get-offering.js +9 -0
  62. package/dist/tools/get-paywall-stats.d.ts +3 -0
  63. package/dist/tools/get-paywall-stats.js +6 -0
  64. package/dist/tools/get-product.d.ts +3 -0
  65. package/dist/tools/get-product.js +9 -0
  66. package/dist/tools/get-rescue-stats.d.ts +3 -0
  67. package/dist/tools/get-rescue-stats.js +12 -0
  68. package/dist/tools/get-rule.d.ts +3 -0
  69. package/dist/tools/get-rule.js +9 -0
  70. package/dist/tools/import-products.js +7 -5
  71. package/dist/tools/index.js +143 -1
  72. package/dist/tools/list-change-requests.d.ts +3 -0
  73. package/dist/tools/list-change-requests.js +14 -0
  74. package/dist/tools/list-entitlements.d.ts +3 -0
  75. package/dist/tools/list-entitlements.js +6 -0
  76. package/dist/tools/list-paywalls.d.ts +3 -0
  77. package/dist/tools/list-paywalls.js +6 -0
  78. package/dist/tools/list-pricing-strategies.d.ts +3 -0
  79. package/dist/tools/list-pricing-strategies.js +8 -0
  80. package/dist/tools/list-promotions.d.ts +3 -0
  81. package/dist/tools/list-promotions.js +6 -0
  82. package/dist/tools/list-rescue-flows.d.ts +3 -0
  83. package/dist/tools/list-rescue-flows.js +6 -0
  84. package/dist/tools/list-rule-versions.d.ts +3 -0
  85. package/dist/tools/list-rule-versions.js +9 -0
  86. package/dist/tools/list-rules.js +4 -2
  87. package/dist/tools/next-step.d.ts +3 -0
  88. package/dist/tools/next-step.js +123 -0
  89. package/dist/tools/preview-pricing.d.ts +3 -0
  90. package/dist/tools/preview-pricing.js +13 -0
  91. package/dist/tools/push-prices-to-stores.d.ts +3 -0
  92. package/dist/tools/push-prices-to-stores.js +9 -0
  93. package/dist/tools/recompute-prices.d.ts +3 -0
  94. package/dist/tools/recompute-prices.js +24 -0
  95. package/dist/tools/resolve-drift.d.ts +3 -0
  96. package/dist/tools/resolve-drift.js +15 -0
  97. package/dist/tools/restore-app.d.ts +3 -0
  98. package/dist/tools/restore-app.js +9 -0
  99. package/dist/tools/revert-app-autopilot.d.ts +3 -0
  100. package/dist/tools/revert-app-autopilot.js +9 -0
  101. package/dist/tools/rollback-rule.d.ts +3 -0
  102. package/dist/tools/rollback-rule.js +10 -0
  103. package/dist/tools/run-app-autopilot.d.ts +3 -0
  104. package/dist/tools/run-app-autopilot.js +9 -0
  105. package/dist/tools/set-country-price-override.d.ts +3 -0
  106. package/dist/tools/set-country-price-override.js +13 -0
  107. package/dist/tools/setup-wizard.d.ts +3 -0
  108. package/dist/tools/setup-wizard.js +259 -0
  109. package/dist/tools/start-experiment.d.ts +3 -0
  110. package/dist/tools/start-experiment.js +9 -0
  111. package/dist/tools/status.js +25 -1
  112. package/dist/tools/stop-experiment.d.ts +3 -0
  113. package/dist/tools/stop-experiment.js +9 -0
  114. package/dist/tools/sync-suggestions-count.d.ts +3 -0
  115. package/dist/tools/sync-suggestions-count.js +6 -0
  116. package/dist/tools/trigger-sync.d.ts +3 -0
  117. package/dist/tools/trigger-sync.js +6 -0
  118. package/dist/tools/update-app.d.ts +3 -0
  119. package/dist/tools/update-app.js +19 -0
  120. package/dist/tools/update-entitlement.d.ts +3 -0
  121. package/dist/tools/update-entitlement.js +13 -0
  122. package/dist/tools/update-experiment.d.ts +3 -0
  123. package/dist/tools/update-experiment.js +22 -0
  124. package/dist/tools/update-offering.d.ts +3 -0
  125. package/dist/tools/update-offering.js +31 -0
  126. package/dist/tools/update-paywall.d.ts +3 -0
  127. package/dist/tools/update-paywall.js +23 -0
  128. package/dist/tools/update-product.d.ts +3 -0
  129. package/dist/tools/update-product.js +16 -0
  130. package/dist/tools/update-promotion.d.ts +3 -0
  131. package/dist/tools/update-promotion.js +20 -0
  132. package/dist/tools/update-rescue-flow.d.ts +3 -0
  133. package/dist/tools/update-rescue-flow.js +27 -0
  134. package/dist/tools/verify-setup.d.ts +3 -0
  135. package/dist/tools/verify-setup.js +200 -0
  136. package/dist/tools/whoami.d.ts +3 -0
  137. package/dist/tools/whoami.js +31 -0
  138. package/dist/types.d.ts +417 -79
  139. package/dist/types.js +0 -2
  140. package/mcp.json +89 -0
  141. package/package.json +8 -2
package/dist/types.d.ts CHANGED
@@ -1,8 +1,42 @@
1
+ export interface ApiKeyUsageSample {
2
+ bucket_start: string;
3
+ client_ip: string | null;
4
+ sdk_version: string | null;
5
+ country_code: string | null;
6
+ request_count: number;
7
+ error_count: number;
8
+ }
9
+ export interface ApiKeyUsageSummary {
10
+ total_requests: number;
11
+ total_errors: number;
12
+ distinct_ips: number;
13
+ distinct_countries: number;
14
+ distinct_sdk_versions: number;
15
+ }
16
+ export interface ApiKeyUsageResponse {
17
+ hours: number;
18
+ summary: ApiKeyUsageSummary;
19
+ samples: ApiKeyUsageSample[];
20
+ }
21
+ export interface WhoamiResponse {
22
+ tenant_id: string;
23
+ org_name: string;
24
+ key_type?: 'public' | 'secret';
25
+ app_id?: string;
26
+ apps: WhoamiApp[];
27
+ }
28
+ export interface WhoamiApp {
29
+ id: string;
30
+ name: string;
31
+ bundle_id: string;
32
+ platform: string;
33
+ }
1
34
  export interface App {
2
35
  id: string;
3
36
  name: string;
4
37
  platform: string;
5
- bundle_id: string;
38
+ bundle_id: string | null;
39
+ settings: Record<string, unknown>;
6
40
  archived_at: string | null;
7
41
  created_at: string;
8
42
  updated_at: string;
@@ -15,8 +49,25 @@ export interface Product {
15
49
  display_name: string;
16
50
  description: string | null;
17
51
  entitlement_ids: string[];
52
+ metadata: Record<string, unknown>;
18
53
  created_at: string;
19
54
  updated_at: string;
55
+ /**
56
+ * Present only when the create call also wrote to the connected store
57
+ * (App Store Connect / Google Play). Carries the store-side product ID
58
+ * and the snapped-price audit so the AI can communicate tier deltas.
59
+ */
60
+ store_create?: StoreCreateSummary;
61
+ }
62
+ export interface StoreCreateSummary {
63
+ store: 'apple' | 'google';
64
+ store_product_id: string;
65
+ snapped_prices: Array<{
66
+ currency: string;
67
+ requested_cents: number;
68
+ actual_cents: number;
69
+ price_point_id?: string;
70
+ }>;
20
71
  }
21
72
  export interface Entitlement {
22
73
  id: string;
@@ -26,66 +77,66 @@ export interface Entitlement {
26
77
  created_at: string;
27
78
  updated_at: string;
28
79
  }
29
- export interface Package {
80
+ export interface OfferingPackage {
30
81
  identifier: string;
31
82
  product_id: string;
32
83
  display_name: string;
84
+ description: string | null;
33
85
  package_type: string;
34
86
  position: number;
35
87
  }
36
88
  export interface Offering {
37
89
  id: string;
38
- app_id: string;
39
90
  identifier: string;
40
91
  display_name: string;
41
92
  description: string | null;
42
93
  is_default: boolean;
43
- packages: Package[];
94
+ packages: OfferingPackage[];
95
+ /** V7 autopilot provenance, omitted for user-created. */
96
+ generated_by?: string | null;
97
+ app_id?: string;
44
98
  created_at: string;
45
99
  updated_at: string;
46
100
  }
47
101
  export interface Rule {
48
102
  id: string;
103
+ identifier: string;
49
104
  name: string;
50
- content: string;
105
+ description: string | null;
51
106
  priority: number;
52
- is_enabled: boolean;
107
+ status: string;
108
+ conditions: unknown;
109
+ actions: unknown;
110
+ guardrails: unknown;
111
+ schedule: unknown | null;
112
+ metadata: unknown;
113
+ version: number;
114
+ /** V7 autopilot provenance. */
115
+ generated_by?: string | null;
116
+ created_at: string;
53
117
  updated_at: string;
118
+ activated_at: string | null;
54
119
  }
55
120
  export interface ExperimentVariant {
56
121
  id: string;
57
122
  name: string;
58
123
  is_control: boolean;
59
124
  traffic_percent: number;
60
- sample_size: number;
61
- conversion_count: number;
62
- conversion_rate: number | null;
63
- uplift_percent: number | null;
125
+ [key: string]: unknown;
64
126
  }
65
127
  export interface Experiment {
66
128
  id: string;
67
129
  name: string;
68
130
  description: string | null;
69
131
  status: string;
70
- target_metric: string | null;
71
- start_date: string | null;
72
- end_date: string | null;
73
- confidence_level: number;
74
132
  variants: ExperimentVariant[];
133
+ [key: string]: unknown;
75
134
  }
76
135
  export interface ExperimentSummary {
77
- experiment_id: string;
78
- experiment_name: string;
136
+ id: string;
137
+ name: string;
79
138
  status: string;
80
- total_participants: number;
81
- leading_variant: string | null;
82
- uplift: number | null;
83
- confidence: number | null;
84
- days_running: number;
85
- }
86
- export interface PeriodComparison {
87
- mrr_change_percent: number;
88
- subscriptions_change_percent: number;
139
+ [key: string]: unknown;
89
140
  }
90
141
  export interface AnalyticsOverview {
91
142
  mrr: number;
@@ -97,65 +148,29 @@ export interface AnalyticsOverview {
97
148
  churn_rate: number;
98
149
  arpu: number;
99
150
  arpu_formatted: string;
100
- period_comparison: PeriodComparison | null;
101
- }
102
- export interface OnboardingProgress {
103
- onboarding_mode: string;
104
- welcome_seen: boolean;
105
- app_created: boolean;
106
- entitlement_created: boolean;
107
- store_credentials_configured: boolean;
108
- product_created: boolean;
109
- offering_created: boolean;
110
- sdk_key_viewed: boolean;
111
- store_connected: boolean;
112
- import_reviewed: boolean;
113
- import_completed: boolean;
151
+ period_comparison: {
152
+ mrr_change: string;
153
+ mrr_change_percent: number;
154
+ subscriptions_change: string;
155
+ subscriptions_change_percent: number;
156
+ };
157
+ [key: string]: unknown;
158
+ }
159
+ export interface OnboardingStep {
160
+ key: string;
161
+ label: string;
162
+ completed: boolean;
114
163
  }
115
164
  export interface OnboardingResponse {
116
- progress: OnboardingProgress;
117
165
  is_complete: boolean;
118
166
  completed_steps: number;
119
167
  total_steps: number;
168
+ steps: OnboardingStep[];
120
169
  next_step: string | null;
121
- }
122
- export interface SuggestedProduct {
123
- external_id: string;
124
- product_type: string;
125
- display_name: string;
126
- source: string;
127
- already_exists: boolean;
128
- }
129
- export interface SuggestedEntitlement {
130
- identifier: string;
131
- display_name: string;
132
- already_exists: boolean;
133
- }
134
- export interface SuggestedOffering {
135
- identifier: string;
136
- display_name: string;
137
- is_default: boolean;
138
- }
139
- export interface ImportSuggestion {
140
- products: SuggestedProduct[];
141
- entitlements: SuggestedEntitlement[];
142
- offerings: SuggestedOffering[];
143
- warnings: string[];
144
- }
145
- export interface ExistingEntityCounts {
146
- apps: number;
147
- products: number;
148
- entitlements: number;
149
- offerings: number;
150
- }
151
- export interface StoreError {
152
- source: string;
153
- message: string;
170
+ [key: string]: unknown;
154
171
  }
155
172
  export interface ImportPreviewResponse {
156
- suggestion: ImportSuggestion;
157
- existing_counts: ExistingEntityCounts;
158
- store_errors: StoreError[];
173
+ [key: string]: unknown;
159
174
  }
160
175
  export interface CreateOfferingRequest {
161
176
  app_id: string;
@@ -172,13 +187,336 @@ export interface CreateOfferingRequest {
172
187
  }>;
173
188
  }
174
189
  export interface CreateRuleRequest {
190
+ identifier: string;
175
191
  name: string;
176
- content: string;
177
- priority: number;
178
- is_enabled: boolean;
192
+ description?: string;
193
+ priority?: number;
194
+ conditions: unknown;
195
+ actions: unknown;
196
+ guardrails?: unknown[] | undefined;
197
+ schedule?: unknown;
198
+ metadata?: unknown;
199
+ }
200
+ export interface ValidateRuleRequest {
201
+ conditions: unknown;
202
+ actions: unknown;
203
+ guardrails?: unknown[] | undefined;
179
204
  }
180
205
  export interface ValidateRuleResponse {
181
206
  is_valid: boolean;
182
207
  errors: string[];
183
208
  warnings: string[];
184
209
  }
210
+ export interface CreateAppRequest {
211
+ name: string;
212
+ platform: string;
213
+ bundle_id: string;
214
+ }
215
+ export interface CreateEntitlementRequest {
216
+ identifier: string;
217
+ display_name: string;
218
+ description?: string;
219
+ }
220
+ export interface CreateProductRequest {
221
+ app_id: string;
222
+ external_id: string;
223
+ product_type: string;
224
+ display_name: string;
225
+ description?: string;
226
+ entitlement_ids?: string[];
227
+ subscription?: {
228
+ billing_period: string;
229
+ grace_period_enabled?: boolean;
230
+ };
231
+ prices?: Array<{
232
+ currency: string;
233
+ amount_cents: number;
234
+ is_default?: boolean;
235
+ }>;
236
+ /**
237
+ * V8 Phase A: when true (default) and a store integration is connected
238
+ * for the app's platform, the API also creates the matching product in
239
+ * App Store Connect / Google Play. Send false to opt out.
240
+ */
241
+ also_create_in_store?: boolean;
242
+ /** Default product locale for store-side localizations. Defaults to "en-US". */
243
+ default_locale?: string;
244
+ }
245
+ export interface Paywall {
246
+ id: string;
247
+ name: string;
248
+ identifier: string;
249
+ paywall_type: string;
250
+ status: string;
251
+ template: string | null;
252
+ total_views: number;
253
+ total_conversions: number;
254
+ conversion_rate: number;
255
+ config: Record<string, unknown>;
256
+ generated_by?: string | null;
257
+ created_at: string;
258
+ }
259
+ export interface CreatePaywallRequest {
260
+ app_id: string;
261
+ name: string;
262
+ identifier: string;
263
+ paywall_type: string;
264
+ }
265
+ export interface UpdatePaywallRequest {
266
+ name?: string;
267
+ template?: string;
268
+ config?: Record<string, unknown>;
269
+ metadata?: Record<string, unknown>;
270
+ }
271
+ export interface PaywallStats {
272
+ total_views: number;
273
+ total_conversions: number;
274
+ average_conversion_rate: number;
275
+ }
276
+ export interface Promotion {
277
+ id: string;
278
+ name: string;
279
+ description: string | null;
280
+ campaign_type: string;
281
+ status: string;
282
+ discount_percent: number;
283
+ starts_at: string;
284
+ ends_at: string;
285
+ max_redemptions: number | null;
286
+ current_redemptions: number;
287
+ revenue_micros: number;
288
+ generated_by?: string | null;
289
+ created_at: string;
290
+ }
291
+ export interface CreatePromotionRequest {
292
+ name: string;
293
+ identifier?: string;
294
+ description?: string;
295
+ campaign_type: string;
296
+ discount_percent?: number;
297
+ starts_at?: string;
298
+ ends_at?: string;
299
+ max_redemptions?: number;
300
+ }
301
+ export interface UpdatePromotionRequest {
302
+ name?: string;
303
+ description?: string;
304
+ discount_percent?: number;
305
+ max_redemptions?: number;
306
+ }
307
+ export interface RescueFlow {
308
+ id: string;
309
+ name: string;
310
+ identifier: string;
311
+ description: string | null;
312
+ status: string;
313
+ priority: number;
314
+ conditions: Record<string, unknown>;
315
+ steps: Record<string, unknown>;
316
+ metadata: Record<string, unknown>;
317
+ generated_by?: string | null;
318
+ created_at: string;
319
+ }
320
+ export interface CreateRescueFlowRequest {
321
+ name: string;
322
+ identifier: string;
323
+ description?: string;
324
+ priority?: number;
325
+ }
326
+ export interface UpdateRescueFlowRequest {
327
+ name?: string;
328
+ description?: string;
329
+ priority?: number;
330
+ conditions?: Record<string, unknown>;
331
+ steps?: Record<string, unknown>;
332
+ metadata?: Record<string, unknown>;
333
+ }
334
+ export interface RescueStats {
335
+ total_rescue_attempts: number;
336
+ successful_rescues: number;
337
+ rescue_rate: number;
338
+ total_recovered_revenue_micros: number;
339
+ total_recovered_revenue_formatted: string;
340
+ }
341
+ export interface PricingStrategy {
342
+ id: string;
343
+ app_id: string;
344
+ name: string;
345
+ w_ppp?: number;
346
+ w_bigmac?: number;
347
+ w_fx_neutral?: number;
348
+ max_auto_change_pct?: number;
349
+ max_auto_decrease_pct?: number;
350
+ excluded_countries?: string[];
351
+ created_at: string;
352
+ updated_at: string;
353
+ }
354
+ export interface CreatePricingStrategyRequest {
355
+ app_id: string;
356
+ name: string;
357
+ w_ppp?: number;
358
+ w_bigmac?: number;
359
+ w_fx_neutral?: number;
360
+ tier1_min_aff?: number;
361
+ tier1_max_aff?: number;
362
+ tier2_min_aff?: number;
363
+ tier2_max_aff?: number;
364
+ tier3_min_aff?: number;
365
+ tier3_max_aff?: number;
366
+ tier4_min_aff?: number;
367
+ tier4_max_aff?: number;
368
+ anti_arbitrage_floor_factor?: number;
369
+ max_auto_change_pct?: number;
370
+ max_auto_decrease_pct?: number;
371
+ excluded_countries?: string[];
372
+ }
373
+ export interface PricingPreviewResult {
374
+ [key: string]: unknown;
375
+ }
376
+ export interface PricingRecomputeRequest {
377
+ product_id?: string;
378
+ strategy_id?: string;
379
+ reason?: string;
380
+ }
381
+ export interface PricingRecomputeResult {
382
+ prices_applied?: number;
383
+ approval_required?: number;
384
+ change_request_ids?: string[];
385
+ skipped?: number;
386
+ products_processed?: number;
387
+ }
388
+ export interface PricingPushResult {
389
+ pushed: number;
390
+ failed: number;
391
+ skipped: number;
392
+ }
393
+ export interface PricingChangeRequest {
394
+ id: string;
395
+ product_id: string;
396
+ app_id: string;
397
+ status: string;
398
+ country_code: string;
399
+ store: string;
400
+ currency: string;
401
+ old_amount_cents: number | null;
402
+ new_amount_cents: number;
403
+ delta_pct: number;
404
+ reason: string;
405
+ created_at: string;
406
+ }
407
+ export interface SetCountryPriceOverrideRequest {
408
+ product_id: string;
409
+ country_code: string;
410
+ store: string;
411
+ currency: string;
412
+ amount_cents: number;
413
+ }
414
+ export interface ExperimentWithVariants {
415
+ id: string;
416
+ name: string;
417
+ description: string | null;
418
+ status: string;
419
+ target_metric: string;
420
+ start_date: string | null;
421
+ end_date: string | null;
422
+ confidence_level: number;
423
+ variants: ExperimentVariant[];
424
+ generated_by?: string | null;
425
+ created_at: string;
426
+ }
427
+ export interface ExperimentVariant {
428
+ id: string;
429
+ name: string;
430
+ is_control: boolean;
431
+ traffic_percent: number;
432
+ sample_size: number;
433
+ conversion_count: number;
434
+ conversion_rate: number | null;
435
+ uplift_percent: number | null;
436
+ status: string;
437
+ p_value: number | null;
438
+ confidence_level: number | null;
439
+ confidence_interval_low: number | null;
440
+ confidence_interval_high: number | null;
441
+ is_statistically_significant: boolean;
442
+ recommendation: string | null;
443
+ z_score: number | null;
444
+ }
445
+ export interface CreateExperimentRequest {
446
+ name: string;
447
+ description?: string;
448
+ target_metric: string;
449
+ entity_type?: string;
450
+ entity_id?: string;
451
+ start_date?: string;
452
+ end_date?: string;
453
+ sample_size_target?: number;
454
+ confidence_level?: number;
455
+ metadata?: Record<string, unknown>;
456
+ variants: Array<{
457
+ name: string;
458
+ is_control: boolean;
459
+ traffic_percent: number;
460
+ config?: Record<string, unknown>;
461
+ }>;
462
+ }
463
+ export interface UpdateExperimentRequest {
464
+ name?: string;
465
+ description?: string;
466
+ status?: string;
467
+ target_metric?: string;
468
+ start_date?: string;
469
+ end_date?: string;
470
+ sample_size_target?: number;
471
+ confidence_level?: number;
472
+ metadata?: Record<string, unknown>;
473
+ }
474
+ export interface UpdateAppRequest {
475
+ name?: string;
476
+ bundle_id?: string;
477
+ settings?: Record<string, unknown>;
478
+ }
479
+ export interface UpdateEntitlementRequest {
480
+ identifier?: string;
481
+ display_name?: string;
482
+ description?: string;
483
+ }
484
+ export interface UpdateOfferingRequest {
485
+ display_name?: string;
486
+ description?: string;
487
+ is_default?: boolean;
488
+ packages?: Array<{
489
+ identifier: string;
490
+ product_id: string;
491
+ display_name: string;
492
+ description?: string;
493
+ package_type: string;
494
+ position: number;
495
+ }>;
496
+ metadata?: Record<string, unknown>;
497
+ }
498
+ export interface AutopilotRunResult {
499
+ [key: string]: unknown;
500
+ }
501
+ export interface SyncSuggestion {
502
+ id: string;
503
+ suggestion_type: string;
504
+ status: string;
505
+ store_product_id: string;
506
+ store_product_name?: string | null;
507
+ store_product_type?: string | null;
508
+ store_price?: string | null;
509
+ store_group_name?: string | null;
510
+ store_source: string;
511
+ product_id?: string | null;
512
+ diff_details: Record<string, unknown>;
513
+ resolved_at?: string | null;
514
+ created_at: string;
515
+ }
516
+ export interface SyncSuggestionsCount {
517
+ pending: number;
518
+ }
519
+ export interface TriggerSyncResult {
520
+ triggered: number;
521
+ message: string;
522
+ }
package/dist/types.js CHANGED
@@ -1,3 +1 @@
1
- // API response types mirrored from crates/capivv-cli/src/client.rs
2
- // and dashboard/src/types/api.ts
3
1
  export {};
package/mcp.json CHANGED
@@ -20,6 +20,77 @@
20
20
  }
21
21
  },
22
22
  "tools": [
23
+ {
24
+ "name": "capivv_whoami",
25
+ "description": "Show which Capivv workspace (organization) and apps the current API key is connected to. Use this first when something looks wrong — e.g., products appear missing — to confirm the MCP is pointed at the right workspace."
26
+ },
27
+ {
28
+ "name": "capivv_autopilot_status",
29
+ "description": "Show everything autopilot generated for a specific app — offerings, entitlement rules, and experiments. Use after capivv_setup_wizard or product imports to confirm what was auto-created.",
30
+ "inputSchema": {
31
+ "type": "object",
32
+ "properties": {
33
+ "app_id": {
34
+ "type": "string",
35
+ "description": "The Capivv app ID to inspect"
36
+ }
37
+ },
38
+ "required": ["app_id"]
39
+ }
40
+ },
41
+ {
42
+ "name": "capivv_api_key_usage",
43
+ "description": "Fetch SDK request telemetry for a publishable API key (hourly buckets, distinct IPs, countries, SDK versions). Use to investigate a suspected leaked key.",
44
+ "inputSchema": {
45
+ "type": "object",
46
+ "properties": {
47
+ "api_key_id": {
48
+ "type": "string",
49
+ "description": "UUID of the api_keys row to inspect"
50
+ },
51
+ "hours": {
52
+ "type": "number",
53
+ "description": "Window in hours to summarize over (default 24, max 168)"
54
+ }
55
+ },
56
+ "required": ["api_key_id"]
57
+ }
58
+ },
59
+ {
60
+ "name": "capivv_next_step",
61
+ "description": "Analyze your current Capivv setup and tell you exactly what to do next. Returns a prioritized checklist with clear instructions for each step."
62
+ },
63
+ {
64
+ "name": "capivv_setup_wizard",
65
+ "description": "One-shot setup for an EXISTING app: creates entitlement, products, and offering on an app you imported from App Store Connect or Google Play via the dashboard. Output includes tenant_id + org_name so you can verify which workspace was written to.",
66
+ "inputSchema": {
67
+ "type": "object",
68
+ "properties": {
69
+ "bundle_id": { "type": "string", "description": "Bundle ID of an already-imported app. Omit if the workspace has exactly one app." },
70
+ "entitlement_id": { "type": "string", "description": "Entitlement identifier (e.g., pro, premium)" },
71
+ "products": {
72
+ "type": "array",
73
+ "description": "Subscription products to create",
74
+ "items": {
75
+ "type": "object",
76
+ "properties": {
77
+ "name": { "type": "string" },
78
+ "external_id": { "type": "string", "description": "Store product ID — must match App Store / Google Play exactly" },
79
+ "billing_period": { "type": "string", "description": "week, month, three_months, six_months, or year" },
80
+ "price_cents": { "type": "number", "description": "Price in USD cents (e.g., 799 for $7.99)" }
81
+ },
82
+ "required": ["name", "external_id", "billing_period", "price_cents"]
83
+ }
84
+ },
85
+ "offering_id": { "type": "string", "description": "Offering identifier (default: 'default')" }
86
+ },
87
+ "required": ["entitlement_id", "products"]
88
+ }
89
+ },
90
+ {
91
+ "name": "capivv_verify_setup",
92
+ "description": "Verify your Capivv setup is complete and correctly configured. Returns a pass/fail checklist with fix instructions for any issues."
93
+ },
23
94
  {
24
95
  "name": "capivv_status",
25
96
  "description": "Get the current status of your Capivv subscription platform including setup progress, resource counts, and key metrics."
@@ -127,6 +198,12 @@
127
198
  }
128
199
  ],
129
200
  "resources": [
201
+ {
202
+ "uri": "capivv://docs/quickstart",
203
+ "name": "quickstart",
204
+ "description": "Step-by-step quickstart guide: register app, create entitlements, create products, create offering, integrate SDK. Start here.",
205
+ "mimeType": "text/markdown"
206
+ },
130
207
  {
131
208
  "uri": "capivv://status",
132
209
  "name": "status",
@@ -144,6 +221,18 @@
144
221
  "name": "concepts",
145
222
  "description": "Glossary of Capivv subscription platform concepts (15 terms).",
146
223
  "mimeType": "application/json"
224
+ },
225
+ {
226
+ "uri": "capivv://docs/guides/ios",
227
+ "name": "guide-ios",
228
+ "description": "Complete iOS integration guide: App Store Connect setup, SDK installation, purchases, entitlements, testing, troubleshooting.",
229
+ "mimeType": "text/markdown"
230
+ },
231
+ {
232
+ "uri": "capivv://docs/guides/ai-prompts",
233
+ "name": "guide-ai-prompts",
234
+ "description": "Ready-to-use prompts for AI code generators (Lovable, Bolt, Cursor) to integrate Capivv on iOS, Android, Flutter, Web, Ionic.",
235
+ "mimeType": "text/markdown"
147
236
  }
148
237
  ]
149
238
  }