@capivv/mcp-server 0.5.17 → 0.5.19
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/tools/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import { registerApiKeyUsageTool } from './api-key-usage.js';
|
|
|
25
25
|
import { registerListPaywallsTool } from './list-paywalls.js';
|
|
26
26
|
import { registerCreatePaywallTool } from './create-paywall.js';
|
|
27
27
|
import { registerUpdatePaywallTool } from './update-paywall.js';
|
|
28
|
+
import { registerPublishPaywallTool } from './publish-paywall.js';
|
|
28
29
|
import { registerDeletePaywallTool } from './delete-paywall.js';
|
|
29
30
|
import { registerGetPaywallStatsTool } from './get-paywall-stats.js';
|
|
30
31
|
import { registerListPromotionsTool } from './list-promotions.js';
|
|
@@ -123,6 +124,7 @@ export function registerAllTools(server, client) {
|
|
|
123
124
|
registerListPaywallsTool(server, client);
|
|
124
125
|
registerCreatePaywallTool(server, client);
|
|
125
126
|
registerUpdatePaywallTool(server, client);
|
|
127
|
+
registerPublishPaywallTool(server, client);
|
|
126
128
|
registerDeletePaywallTool(server, client);
|
|
127
129
|
registerGetPaywallStatsTool(server, client);
|
|
128
130
|
// Promotions (V8 Phase B.2)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export function registerPublishPaywallTool(server, client) {
|
|
3
|
+
server.tool('capivv_publish_paywall', [
|
|
4
|
+
'Publish a draft paywall so it becomes readable to mobile SDKs via publishable (pk_*) keys.',
|
|
5
|
+
'',
|
|
6
|
+
'Until you publish, capivv_create_paywall leaves the paywall at status="draft" and the SDK\'s `Capivv.getPaywall({ identifier })` returns `template: null` (the backend hides drafts from publishable keys to avoid leaking unfinished work). Calling this tool flips the status to "active" so the SDK\'s next call returns the real template.',
|
|
7
|
+
'',
|
|
8
|
+
'Equivalent to `capivv_update_paywall(paywall_id, { status: "active" })` — kept as its own tool because publishing is the canonical "draft → live" transition and merits a clearly named action.',
|
|
9
|
+
'',
|
|
10
|
+
'Get `paywall_id` from capivv_list_paywalls or capivv_create_paywall.',
|
|
11
|
+
].join(' '), {
|
|
12
|
+
paywall_id: z.string().describe('Paywall ID to publish.'),
|
|
13
|
+
}, async ({ paywall_id }) => {
|
|
14
|
+
const paywall = await client.updatePaywall(paywall_id, { status: 'active' });
|
|
15
|
+
return { content: [{ type: 'text', text: JSON.stringify(paywall, null, 2) }] };
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export function registerUpdatePaywallTool(server, client) {
|
|
3
|
-
server.tool('capivv_update_paywall', 'Update a paywall by ID. Provide only the fields you want to change. Use this to attach a template, swap the config blob,
|
|
3
|
+
server.tool('capivv_update_paywall', 'Update a paywall by ID. Provide only the fields you want to change. Use this to attach a template, swap the config blob, update metadata, OR change lifecycle status (e.g. publish a draft via status="active"). Use capivv_list_paywalls to discover the paywall_id. capivv_publish_paywall is a sugar wrapper for the common "draft → active" transition.', {
|
|
4
4
|
paywall_id: z.string().describe('Paywall ID to update'),
|
|
5
5
|
name: z.string().optional().describe('New display name'),
|
|
6
6
|
template: z
|
|
@@ -15,6 +15,10 @@ export function registerUpdatePaywallTool(server, client) {
|
|
|
15
15
|
.record(z.string(), z.unknown())
|
|
16
16
|
.optional()
|
|
17
17
|
.describe('Free-form metadata stored alongside the paywall'),
|
|
18
|
+
status: z
|
|
19
|
+
.enum(['draft', 'active', 'paused', 'scheduled', 'archived'])
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('Lifecycle status. Set to "active" to publish so SDKs can read the paywall via publishable keys (Capivv.getPaywall reads only active paywalls when called with pk_test_* / pk_live_*). "draft" hides it from the public surface; "paused" / "archived" deactivate it temporarily / permanently.'),
|
|
18
22
|
}, async (args) => {
|
|
19
23
|
const { paywall_id, ...rest } = args;
|
|
20
24
|
const paywall = await client.updatePaywall(paywall_id, rest);
|
package/dist/types.d.ts
CHANGED
|
@@ -283,11 +283,19 @@ export interface CreatePaywallRequest {
|
|
|
283
283
|
identifier: string;
|
|
284
284
|
paywall_type: string;
|
|
285
285
|
}
|
|
286
|
+
/** Paywall lifecycle states recognised by the backend. */
|
|
287
|
+
export type PaywallStatus = 'draft' | 'active' | 'paused' | 'scheduled' | 'archived';
|
|
286
288
|
export interface UpdatePaywallRequest {
|
|
287
289
|
name?: string;
|
|
288
290
|
template?: string;
|
|
289
291
|
config?: Record<string, unknown>;
|
|
290
292
|
metadata?: Record<string, unknown>;
|
|
293
|
+
/**
|
|
294
|
+
* Lifecycle status. Set to "active" to publish a draft paywall so
|
|
295
|
+
* SDK calls (`Capivv.getPaywall(...)`) can read it via publishable
|
|
296
|
+
* keys. Backend filters publishable-key reads to status=active only.
|
|
297
|
+
*/
|
|
298
|
+
status?: PaywallStatus;
|
|
291
299
|
}
|
|
292
300
|
export interface PaywallStats {
|
|
293
301
|
total_views: number;
|