@capivv/mcp-server 0.5.0 → 0.5.1
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 +5 -1
- package/dist/client.js +14 -0
- package/dist/tools/connect-apple-integration.d.ts +3 -0
- package/dist/tools/connect-apple-integration.js +27 -0
- package/dist/tools/connect-google-integration.d.ts +3 -0
- package/dist/tools/connect-google-integration.js +20 -0
- package/dist/tools/disconnect-integration.d.ts +3 -0
- package/dist/tools/disconnect-integration.js +13 -0
- package/dist/tools/index.js +12 -0
- package/dist/tools/list-integrations.d.ts +3 -0
- package/dist/tools/list-integrations.js +6 -0
- package/dist/types.d.ts +34 -0
- package/package.json +1 -1
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 } 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 } from './types.js';
|
|
3
3
|
export declare class ApiError extends Error {
|
|
4
4
|
status: number;
|
|
5
5
|
code: string;
|
|
@@ -87,4 +87,8 @@ export declare class CapivvClient {
|
|
|
87
87
|
getSyncSuggestionsCount(): Promise<SyncSuggestionsCount>;
|
|
88
88
|
resolveSyncSuggestion(id: string, action: 'accept' | 'dismiss'): Promise<SyncSuggestion>;
|
|
89
89
|
triggerSync(): Promise<TriggerSyncResult>;
|
|
90
|
+
listIntegrations(): Promise<IntegrationSummary[]>;
|
|
91
|
+
connectAppleIntegration(data: ConnectAppleIntegrationRequest): Promise<ConnectAppleIntegrationResult>;
|
|
92
|
+
connectGoogleIntegration(data: ConnectGoogleIntegrationRequest): Promise<ConnectGoogleIntegrationResult>;
|
|
93
|
+
disconnectIntegration(provider: string): Promise<void>;
|
|
90
94
|
}
|
package/dist/client.js
CHANGED
|
@@ -325,4 +325,18 @@ export class CapivvClient {
|
|
|
325
325
|
async triggerSync() {
|
|
326
326
|
return this.post('/dashboard/sync/trigger');
|
|
327
327
|
}
|
|
328
|
+
// ---- Integrations (V8.1) ----
|
|
329
|
+
async listIntegrations() {
|
|
330
|
+
const resp = await this.get('/dashboard/integrations');
|
|
331
|
+
return resp.integrations;
|
|
332
|
+
}
|
|
333
|
+
async connectAppleIntegration(data) {
|
|
334
|
+
return this.post('/dashboard/integrations/apple/connect', data);
|
|
335
|
+
}
|
|
336
|
+
async connectGoogleIntegration(data) {
|
|
337
|
+
return this.post('/dashboard/integrations/google/connect', data);
|
|
338
|
+
}
|
|
339
|
+
async disconnectIntegration(provider) {
|
|
340
|
+
await this.post(`/dashboard/integrations/${encodeURIComponent(provider)}/disconnect`);
|
|
341
|
+
}
|
|
328
342
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerConnectAppleIntegrationTool(server, client) {
|
|
3
|
+
server.tool('capivv_connect_apple_integration', [
|
|
4
|
+
'Connect an App Store Connect API key to the workspace. After this succeeds, capivv_create_product can write subscriptions / IAPs to App Store Connect on the customer\'s behalf.',
|
|
5
|
+
'',
|
|
6
|
+
'WARNING — the .p8 private key is sensitive. Make sure the key has at least App Manager role (Developer is not sufficient for write operations). The credentials are encrypted at rest.',
|
|
7
|
+
'',
|
|
8
|
+
'You can find issuer_id, key_id, and download the .p8 in App Store Connect → Users and Access → Integrations → App Store Connect API.',
|
|
9
|
+
].join(' '), {
|
|
10
|
+
issuer_id: z
|
|
11
|
+
.string()
|
|
12
|
+
.describe('Issuer ID (UUID) shown in App Store Connect → Integrations'),
|
|
13
|
+
key_id: z
|
|
14
|
+
.string()
|
|
15
|
+
.describe('Key ID (10-character string) shown next to the key in App Store Connect'),
|
|
16
|
+
private_key: z
|
|
17
|
+
.string()
|
|
18
|
+
.describe('Full PEM contents of the .p8 file: starts with "-----BEGIN PRIVATE KEY-----" and ends with "-----END PRIVATE KEY-----".'),
|
|
19
|
+
shared_secret: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Optional legacy shared secret for verifyReceipt fallback (rarely needed for new integrations).'),
|
|
23
|
+
}, async (args) => {
|
|
24
|
+
const result = await client.connectAppleIntegration(args);
|
|
25
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerConnectGoogleIntegrationTool(server, client) {
|
|
3
|
+
server.tool('capivv_connect_google_integration', [
|
|
4
|
+
'Connect a Google Play service account key to the workspace. After this succeeds, capivv_create_product can write subscriptions / IAPs to Google Play on the customer\'s behalf.',
|
|
5
|
+
'',
|
|
6
|
+
'WARNING — service account JSON contains a private key and is sensitive. The service account needs the "Financial data" + "Manage orders and subscriptions" permissions in Google Play Console. The credentials are encrypted at rest.',
|
|
7
|
+
'',
|
|
8
|
+
'Each package_name is validated against the Play Developer API; invalid ones are returned in `errors` so the customer can fix them and retry.',
|
|
9
|
+
].join(' '), {
|
|
10
|
+
service_account_json: z
|
|
11
|
+
.string()
|
|
12
|
+
.describe('Raw JSON contents of the service account key file (the whole {...} blob).'),
|
|
13
|
+
package_names: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.describe('Bundle IDs (Android package names) the service account should be able to manage, e.g. ["com.example.app"].'),
|
|
16
|
+
}, async (args) => {
|
|
17
|
+
const result = await client.connectGoogleIntegration(args);
|
|
18
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerDisconnectIntegrationTool(server, client) {
|
|
3
|
+
server.tool('capivv_disconnect_integration', 'Disconnect a store integration. Removes stored credentials and stops syncing. Useful when rotating an Apple .p8 or Google service account — call this, then capivv_connect_apple_integration / capivv_connect_google_integration with the new credentials.', {
|
|
4
|
+
provider: z
|
|
5
|
+
.enum(['apple_app_store', 'google_play', 'stripe'])
|
|
6
|
+
.describe('Which provider to disconnect.'),
|
|
7
|
+
}, async ({ provider }) => {
|
|
8
|
+
await client.disconnectIntegration(provider);
|
|
9
|
+
return {
|
|
10
|
+
content: [{ type: 'text', text: `Disconnected ${provider}.` }],
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
}
|
package/dist/tools/index.js
CHANGED
|
@@ -68,6 +68,10 @@ import { registerCheckDriftTool } from './check-drift.js';
|
|
|
68
68
|
import { registerResolveDriftTool } from './resolve-drift.js';
|
|
69
69
|
import { registerSyncSuggestionsCountTool } from './sync-suggestions-count.js';
|
|
70
70
|
import { registerTriggerSyncTool } from './trigger-sync.js';
|
|
71
|
+
import { registerListIntegrationsTool } from './list-integrations.js';
|
|
72
|
+
import { registerConnectAppleIntegrationTool } from './connect-apple-integration.js';
|
|
73
|
+
import { registerConnectGoogleIntegrationTool } from './connect-google-integration.js';
|
|
74
|
+
import { registerDisconnectIntegrationTool } from './disconnect-integration.js';
|
|
71
75
|
export function registerAllTools(server, client) {
|
|
72
76
|
// Identity — call this first to verify which workspace you're connected to
|
|
73
77
|
registerWhoamiTool(server, client);
|
|
@@ -161,4 +165,12 @@ export function registerAllTools(server, client) {
|
|
|
161
165
|
registerResolveDriftTool(server, client);
|
|
162
166
|
registerSyncSuggestionsCountTool(server, client);
|
|
163
167
|
registerTriggerSyncTool(server, client);
|
|
168
|
+
// Integrations management (V8.1 — added after the Interrupt customer
|
|
169
|
+
// hit a blocked-store-write because their integration was in a stale
|
|
170
|
+
// error state. The agent can now diagnose and fix integrations
|
|
171
|
+
// without bouncing the customer to the dashboard.)
|
|
172
|
+
registerListIntegrationsTool(server, client);
|
|
173
|
+
registerConnectAppleIntegrationTool(server, client);
|
|
174
|
+
registerConnectGoogleIntegrationTool(server, client);
|
|
175
|
+
registerDisconnectIntegrationTool(server, client);
|
|
164
176
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function registerListIntegrationsTool(server, client) {
|
|
2
|
+
server.tool('capivv_list_integrations', 'List every store integration (Apple App Store, Google Play, Stripe) for the workspace with its status, last sync, and any error message. Useful for diagnosing why capivv_create_product failed — if the integration shows "error", the credentials are likely stale or revoked.', async () => {
|
|
3
|
+
const integrations = await client.listIntegrations();
|
|
4
|
+
return { content: [{ type: 'text', text: JSON.stringify(integrations, null, 2) }] };
|
|
5
|
+
});
|
|
6
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -520,3 +520,37 @@ export interface TriggerSyncResult {
|
|
|
520
520
|
triggered: number;
|
|
521
521
|
message: string;
|
|
522
522
|
}
|
|
523
|
+
export interface IntegrationSummary {
|
|
524
|
+
provider: string;
|
|
525
|
+
provider_name: string;
|
|
526
|
+
status: string;
|
|
527
|
+
is_connected: boolean;
|
|
528
|
+
last_sync_at?: string | null;
|
|
529
|
+
has_error: boolean;
|
|
530
|
+
error_message?: string | null;
|
|
531
|
+
}
|
|
532
|
+
export interface ConnectAppleIntegrationRequest {
|
|
533
|
+
issuer_id: string;
|
|
534
|
+
key_id: string;
|
|
535
|
+
/** PEM-encoded App Store Connect API private key (.p8 contents). */
|
|
536
|
+
private_key: string;
|
|
537
|
+
/** Optional legacy shared secret for verifyReceipt fallback. */
|
|
538
|
+
shared_secret?: string;
|
|
539
|
+
}
|
|
540
|
+
export interface ConnectAppleIntegrationResult {
|
|
541
|
+
status: string;
|
|
542
|
+
app_count: number;
|
|
543
|
+
}
|
|
544
|
+
export interface ConnectGoogleIntegrationRequest {
|
|
545
|
+
/** Service account JSON key (raw contents, not a file path). */
|
|
546
|
+
service_account_json: string;
|
|
547
|
+
package_names: string[];
|
|
548
|
+
}
|
|
549
|
+
export interface ConnectGoogleIntegrationResult {
|
|
550
|
+
status: string;
|
|
551
|
+
validated_packages: string[];
|
|
552
|
+
errors: Array<{
|
|
553
|
+
package_name: string;
|
|
554
|
+
error: string;
|
|
555
|
+
}>;
|
|
556
|
+
}
|