@zellifyapp/mcp 0.1.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.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @zellifyapp/mcp
2
+
3
+ An MCP server that gives Claude Code full context about your Zellify funnels — variable names, payload shapes, integration status — so it can build, test, and debug your webhook integration without guessing.
4
+
5
+ ## Quick start
6
+
7
+ ### 1. Create an API key
8
+
9
+ Go to [Zellify Dashboard > Settings > Developer](https://dashboard.zellify.app/settings) and create an MCP API key.
10
+
11
+ ### 2. Add to Claude Code
12
+
13
+ ```bash
14
+ claude mcp add zellify -- npx -y @zellifyapp/mcp@latest -y --api-key YOUR_API_KEY
15
+ ```
16
+
17
+ ### 3. Try it
18
+
19
+ Open Claude Code and ask:
20
+
21
+ > Build me a webhook handler for my Zellify funnel
22
+
23
+ Claude will call `list_funnels` to find your funnel, `get_funnel_schema` for the variable names, `get_example_payload` for a typed payload and TypeScript interface, write the handler with signature verification, and fire `send_test_webhook` to prove it works.
24
+
25
+ ## Available tools
26
+
27
+ | Tool | Description |
28
+ |------|-------------|
29
+ | `list_funnels` | List all funnels with IDs, names, published status, and last updated date |
30
+ | `get_funnel_schema` | Get a funnel's variables — names, question types, option ID-to-label mappings |
31
+ | `get_example_payload` | Get a realistic example webhook payload and TypeScript interface for a funnel |
32
+ | `get_integrations` | Check configured integrations, payment provider, and active campaign count |
33
+ | `send_test_webhook` | Fire a signed test webhook to your configured endpoint and report the result |
34
+
35
+ ## Skill file
36
+
37
+ The package ships with `SKILL.md` — a Claude Code skill that teaches Claude the full Zellify integration playbook: which reference docs to read, how to chain tools together, and the rules that prevent silent failures (raw body signatures, option ID resolution, `app_user_id` chaining).
38
+
39
+ To install it, copy the file into your project's skills directory:
40
+
41
+ ```bash
42
+ cp node_modules/@zellifyapp/mcp/SKILL.md .claude/skills/zellify-integration.md
43
+ ```
44
+
45
+ With the skill installed, Claude will automatically follow the correct workflow whenever you ask it to build a webhook handler, debug delivery issues, set up RevenueCat, or generate types.
46
+
47
+ ## Example prompts
48
+
49
+ ```
50
+ Build me a webhook handler for my Zellify funnel
51
+ ```
52
+
53
+ ```
54
+ Send a test webhook to my endpoint and debug any errors
55
+ ```
56
+
57
+ ```
58
+ Check my integration setup — is my webhook configured?
59
+ ```
60
+
61
+ ```
62
+ Generate TypeScript types and a Zod schema for my funnel's payload
63
+ ```
64
+
65
+ ## Configuration
66
+
67
+ | Variable | Required | Description |
68
+ |----------|----------|-------------|
69
+ | `ZELLIFY_API_KEY` | Yes | MCP API key from the Zellify Dashboard |
70
+ | `ZELLIFY_API_URL` | No | API base URL (default: `https://api.zellify.app`) |
71
+
72
+ ## Links
73
+
74
+ - [Zellify Docs](https://docs.zellify.app)
75
+ - [Dashboard](https://dashboard.zellify.app)
package/SKILL.md ADDED
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: zellify-integration
3
+ description: "MUST USE for any Zellify integration work: webhook handler, HMAC signature verification, quiz answers payload, Zellify Registration Webhook, RevenueCat entitlements, deep link setup, app_user_id chain, Stripe metadata, Paddle custom data, test webhook, funnel schema, funnel variables, option ID resolution. Triggers: building webhook endpoints, parsing Zellify payloads, debugging webhook delivery, generating TypeScript types from funnel schema, connecting mobile apps via deep links, RevenueCat silent failures, send_test_webhook."
4
+ ---
5
+
6
+ # Zellify Integration
7
+
8
+ Help developers connect their product to Zellify. Use the Zellify MCP tools — never guess variable names, payload shapes, or integration status.
9
+
10
+ ## First: gather context
11
+
12
+ Before any integration task, call:
13
+ 1. `list_funnels` — find funnel IDs, check published status
14
+ 2. `get_integrations` — see what's configured (payment provider, RevenueCat, webhook)
15
+
16
+ ## Which reference to read
17
+
18
+ | Developer wants to... | Reference file |
19
+ |----------------------|----------------|
20
+ | Build a webhook handler | `references/webhook-handler.md` |
21
+ | Set up or debug RevenueCat | `references/revenuecat.md` |
22
+ | Choose an integration path | `references/integration-paths.md` |
23
+ | Debug a failing webhook | `references/debugging.md` |
24
+ | Generate TypeScript/Zod types | `references/types-and-payload.md` |
25
+ | See a language-specific raw body pattern | `references/language-guides.md` |
26
+
27
+ **IMPORTANT: Read the relevant reference file BEFORE writing code or giving advice.**
28
+
29
+ ## Rules — violating these causes silent failures
30
+
31
+ **MUST: Answers are `{ value, label? }` objects.** Each answer is wrapped: `"gender": { "value": "1", "label": "Male" }`. Use `answer.label` when present. Fall back to lookup maps from `get_funnel_schema` only when `label` is missing.
32
+
33
+ **MUST: Option IDs are not labels.** Singleselect value `"1"` is an opaque option ID, not the number one. Call `get_funnel_schema` for the ID-to-label mapping, or use `answer.label`.
34
+
35
+ **MUST: Raw body for signatures.** Capture the HTTP request body as raw string BEFORE parsing JSON. Parsing then re-stringifying breaks the HMAC.
36
+
37
+ **IMPORTANT:** Preview mode (`/preview/` URLs) silently disables all webhooks — no warning. Test with live URL or `send_test_webhook`.
38
+
39
+ **IMPORTANT:** `app_user_id` is the bridge between Zellify and the developer's system. Where it appears depends on the integration path. If any link is missing, the integration silently breaks.
40
+
41
+ ## Tool workflows
42
+
43
+ **Build handler:** `list_funnels` → `get_funnel_schema` → `get_example_payload` → write code → `send_test_webhook`
44
+
45
+ **Debug:** `get_integrations` (webhook configured?) → `send_test_webhook` → diagnose response
46
+
47
+ **Generate types:** `get_funnel_schema` → `get_example_payload` → extract TypeScript interface
@@ -0,0 +1,50 @@
1
+ export interface Funnel {
2
+ id: number;
3
+ name: string;
4
+ published: boolean;
5
+ updatedAt: string;
6
+ }
7
+ export interface FunnelVariable {
8
+ name: string;
9
+ type: string;
10
+ questionType: string;
11
+ questionText: string | null;
12
+ pageSlug: string | null;
13
+ options: Array<{
14
+ id: string;
15
+ label: string;
16
+ }>;
17
+ }
18
+ export interface ExamplePayloadResponse {
19
+ payload: Record<string, unknown>;
20
+ signatureHeader: string;
21
+ signatureAlgorithm: string;
22
+ typescript: string;
23
+ }
24
+ export interface Integration {
25
+ name: string;
26
+ configured: boolean;
27
+ }
28
+ export interface IntegrationsResponse {
29
+ integrations: Integration[];
30
+ paymentProvider: string | null;
31
+ campaignCount: number;
32
+ }
33
+ export interface TestWebhookResponse {
34
+ success: boolean;
35
+ statusCode?: number;
36
+ responseBody?: string;
37
+ responseTimeMs?: number;
38
+ error?: string;
39
+ payloadSent: Record<string, unknown>;
40
+ }
41
+ export declare function listFunnels(): Promise<{
42
+ funnels: Funnel[];
43
+ }>;
44
+ export declare function getFunnelSchema(funnelId: string): Promise<{
45
+ variables: FunnelVariable[];
46
+ }>;
47
+ export declare function getExamplePayload(funnelId: string): Promise<ExamplePayloadResponse>;
48
+ export declare function getIntegrations(): Promise<IntegrationsResponse>;
49
+ export declare function sendTestWebhook(funnelId: string): Promise<TestWebhookResponse>;
50
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAyCA,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAID,wBAAsB,WAAW,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAElE;AAED,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,SAAS,EAAE,cAAc,EAAE,CAAA;CAAE,CAAC,CAE1C;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,sBAAsB,CAAC,CAEjC;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAErE;AAED,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,CAAC,CAI9B"}
@@ -0,0 +1,49 @@
1
+ const API_URL = process.env.ZELLIFY_API_URL ?? "https://api.zellify.app";
2
+ const API_KEY = process.env.ZELLIFY_API_KEY ?? "";
3
+ async function request(method, path, body) {
4
+ if (!API_KEY) {
5
+ throw new Error("ZELLIFY_API_KEY is not set. Create an API key in your Zellify dashboard under Settings > API Keys.");
6
+ }
7
+ const url = `${API_URL}${path}`;
8
+ const init = {
9
+ method,
10
+ headers: {
11
+ Authorization: `Bearer ${API_KEY}`,
12
+ "Content-Type": "application/json",
13
+ },
14
+ };
15
+ if (body !== undefined) {
16
+ init.body = JSON.stringify(body);
17
+ }
18
+ const response = await fetch(url, init);
19
+ if (!response.ok) {
20
+ let message;
21
+ try {
22
+ const err = (await response.json());
23
+ message = err.error ?? response.statusText;
24
+ }
25
+ catch {
26
+ message = response.statusText;
27
+ }
28
+ throw new Error(`Zellify API ${response.status}: ${message}`);
29
+ }
30
+ return response.json();
31
+ }
32
+ // ── Client methods ──────────────────────────────────────
33
+ export async function listFunnels() {
34
+ return request("GET", "/v1/mcp/funnels");
35
+ }
36
+ export async function getFunnelSchema(funnelId) {
37
+ return request("GET", `/v1/mcp/funnels/${funnelId}/schema`);
38
+ }
39
+ export async function getExamplePayload(funnelId) {
40
+ return request("GET", `/v1/mcp/funnels/${funnelId}/example-payload`);
41
+ }
42
+ export async function getIntegrations() {
43
+ return request("GET", "/v1/mcp/integrations");
44
+ }
45
+ export async function sendTestWebhook(funnelId) {
46
+ return request("POST", "/v1/mcp/test-webhook", {
47
+ funnelId: Number(funnelId),
48
+ });
49
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/build/index.js ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7
+ import { registerListFunnels } from "./tools/list-funnels.js";
8
+ import { registerGetFunnelSchema } from "./tools/get-funnel-schema.js";
9
+ import { registerGetExamplePayload } from "./tools/get-example-payload.js";
10
+ import { registerGetIntegrations } from "./tools/get-integrations.js";
11
+ import { registerSendTestWebhook } from "./tools/send-test-webhook.js";
12
+ import { registerIntegrationPlanPrompt } from "./prompts/integration-plan.js";
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+ const referencesDir = join(__dirname, "..", "references");
15
+ const server = new McpServer({
16
+ name: "zellify",
17
+ version: "0.1.0",
18
+ }, {
19
+ instructions: `Zellify MCP — integrate with Zellify web funnels.
20
+
21
+ ## Critical rules
22
+
23
+ 1. **Answers are wrapped objects**, not flat: \`"gender": { "value": "1", "label": "Male" }\`. Use \`answer.label\` when present; fall back to \`answer.value\` + option ID lookup via get_funnel_schema.
24
+ 2. **Option IDs are not labels.** Singleselect value \`"1"\` is an opaque ID. Resolve via \`answer.label\` or get_funnel_schema.
25
+ 3. **Raw body for signatures.** Verify X-Webhook-Signature against the raw request body BEFORE JSON parsing. Re-stringifying breaks the HMAC.
26
+
27
+ ## Webhook delivery
28
+
29
+ No retries. 10-second timeout. No dashboard delivery logs. A failed delivery is permanently lost. Preview mode (\`/preview/\` URLs) silently disables all webhooks.
30
+
31
+ ## Workflow
32
+
33
+ **Build handler:** list_funnels → get_funnel_schema → get_example_payload → write code → send_test_webhook
34
+ **Debug:** get_integrations → send_test_webhook → diagnose response
35
+ **Generate types:** get_funnel_schema → get_example_payload → extract TypeScript interface
36
+
37
+ ## Reference resources
38
+
39
+ Read the MCP resources for detailed guides: webhook-handler, debugging, integration-paths, revenuecat, types-and-payload, language-guides.`,
40
+ });
41
+ // ── Reference resources ──────────────────────────────────
42
+ const referenceFiles = [
43
+ { name: "webhook-handler", description: "Step-by-step guide to building a Registration Webhook handler" },
44
+ { name: "debugging", description: "Diagnose webhook delivery failures — common errors, status codes, silent failures" },
45
+ { name: "integration-paths", description: "Which integration path to use: RevenueCat, custom backend, web app, existing webhooks, etc." },
46
+ { name: "revenuecat", description: "RevenueCat integration — the 5 silent failure points and diagnosis workflow" },
47
+ { name: "types-and-payload", description: "Webhook payload structure, answer format, context fields, TypeScript/Zod type generation" },
48
+ { name: "language-guides", description: "Raw body capture and answer access patterns for Express, Fastify, Flask, Django, Go, Rails, Vercel, Lambda" },
49
+ ];
50
+ for (const ref of referenceFiles) {
51
+ server.resource(ref.name, `zellify://references/${ref.name}`, { description: ref.description, mimeType: "text/markdown" }, async () => {
52
+ const content = readFileSync(join(referencesDir, `${ref.name}.md`), "utf-8");
53
+ return { contents: [{ uri: `zellify://references/${ref.name}`, text: content, mimeType: "text/markdown" }] };
54
+ });
55
+ }
56
+ // ── Tools ────────────────────────────────────────────────
57
+ registerListFunnels(server);
58
+ registerGetFunnelSchema(server);
59
+ registerGetExamplePayload(server);
60
+ registerGetIntegrations(server);
61
+ registerSendTestWebhook(server);
62
+ // ── Prompts ──────────────────────────────────────────────
63
+ registerIntegrationPlanPrompt(server);
64
+ const transport = new StdioServerTransport();
65
+ await server.connect(transport);
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerIntegrationPlanPrompt(server: McpServer): void;
3
+ //# sourceMappingURL=integration-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-plan.d.ts","sourceRoot":"","sources":["../../src/prompts/integration-plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASzE,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,SAAS,QAuI9D"}
@@ -0,0 +1,117 @@
1
+ import { z } from "zod";
2
+ import { listFunnels, getFunnelSchema, getExamplePayload, getIntegrations, } from "../client.js";
3
+ export function registerIntegrationPlanPrompt(server) {
4
+ server.prompt("integration-plan", "Read the user's codebase and create a step-by-step integration plan for their Zellify funnels — webhook handler, signature verification, answer parsing, and any connected services.", { funnelId: z.string().optional().describe("Specific funnel ID. If omitted, uses the first published funnel.") }, async ({ funnelId }) => {
5
+ // Gather all Zellify context
6
+ const [funnelsData, integrationsData] = await Promise.all([
7
+ listFunnels(),
8
+ getIntegrations(),
9
+ ]);
10
+ const funnels = funnelsData.funnels;
11
+ const published = funnels.filter((f) => f.published);
12
+ // Pick the target funnel
13
+ const firstPublished = published[0];
14
+ const targetId = funnelId ?? (firstPublished ? String(firstPublished.id) : null);
15
+ let schemaSection = "";
16
+ let payloadSection = "";
17
+ if (targetId) {
18
+ const [schema, example] = await Promise.all([
19
+ getFunnelSchema(targetId).catch(() => null),
20
+ getExamplePayload(targetId).catch(() => null),
21
+ ]);
22
+ if (schema) {
23
+ schemaSection = `
24
+ ## Funnel Schema (ID: ${targetId})
25
+
26
+ Variables collected by this funnel:
27
+
28
+ ${schema.variables
29
+ .map((v) => `- **${v.name}** (${v.questionType})${v.questionText ? ` — "${v.questionText}"` : ""}${v.options.length > 0 ? `\n Options: ${v.options.map((o) => `${o.id}="${o.label}"`).join(", ")}` : ""}`)
30
+ .join("\n")}
31
+ `;
32
+ }
33
+ if (example) {
34
+ payloadSection = `
35
+ ## Example Webhook Payload
36
+
37
+ \`\`\`json
38
+ ${JSON.stringify(example.payload, null, 2)}
39
+ \`\`\`
40
+
41
+ ### Signature
42
+ - Header: \`${example.signatureHeader}\`
43
+ - Algorithm: ${example.signatureAlgorithm}
44
+ - Verify against the **raw request body** before JSON parsing. Re-stringifying breaks the HMAC.
45
+
46
+ ### Generated TypeScript Interface
47
+
48
+ \`\`\`typescript
49
+ ${example.typescript}
50
+ \`\`\`
51
+ `;
52
+ }
53
+ }
54
+ // Integration context
55
+ const configuredIntegrations = integrationsData.integrations
56
+ .filter((i) => i.configured)
57
+ .map((i) => i.name);
58
+ const hasWebhook = configuredIntegrations.includes("registration_webhook");
59
+ const hasRevenueCat = configuredIntegrations.includes("revenuecat");
60
+ const payment = integrationsData.paymentProvider;
61
+ const integrationsSection = `
62
+ ## Current Integrations
63
+
64
+ - Payment provider: ${payment ?? "none"}
65
+ - Configured: ${configuredIntegrations.length > 0 ? configuredIntegrations.join(", ") : "none"}
66
+ - Registration webhook: ${hasWebhook ? "configured" : "**not configured** — set this up in Zellify dashboard > Settings > Integrations"}
67
+ - Campaigns: ${integrationsData.campaignCount}
68
+ `;
69
+ const prompt = `You are helping a developer integrate their application with Zellify. Read their codebase and create a concrete, step-by-step integration plan.
70
+
71
+ # Zellify Context
72
+
73
+ ${funnels.length} funnel(s) found. ${published.length} published.
74
+
75
+ ${funnels.map((f) => `- ID: ${f.id} | ${f.name} | ${f.published ? "Published" : "Draft"}`).join("\n")}
76
+ ${integrationsSection}
77
+ ${schemaSection}
78
+ ${payloadSection}
79
+
80
+ # Your Task
81
+
82
+ 1. **Explore the codebase** — identify the framework (Express, Fastify, Next.js, Flask, Django, Rails, Go, etc.), language, existing route/handler patterns, and where webhook handlers or API routes live.
83
+
84
+ 2. **Create an integration plan** with these sections:
85
+
86
+ **a. Webhook Handler** — where to add the route, which file, matching their existing patterns. Must:
87
+ - Capture the raw request body (before JSON parsing) for signature verification
88
+ - Verify \`X-Webhook-Signature\` using HMAC-SHA256 with their webhook secret
89
+ - Parse the typed payload using the generated interface above
90
+ - Handle answers as wrapped objects: \`answer.value\` and \`answer.label\`
91
+
92
+ **b. Answer Processing** — how to extract and use each variable from the funnel schema. Map question types to their value formats:
93
+ - text/email → string
94
+ - number → number
95
+ - singleselect/slider → \`{ value: string, label: string }\` (value is opaque option ID)
96
+ - multiselect → \`{ value: string[], label: string }\`
97
+ - range → \`{ value: string }\` (hyphen-separated, e.g. "18-35")
98
+
99
+ **c. Connected Services** — ${hasRevenueCat ? "RevenueCat is configured — plan how to use `appUserId` from context to link funnel data to RevenueCat subscribers." : "No RevenueCat — plan standalone data handling."}${payment ? ` Payment provider is ${payment} — note any payment-related hooks if relevant.` : ""}
100
+
101
+ **d. Error Handling** — webhook has no retries and a 10-second timeout. Plan for: signature mismatch (reject 401), processing errors (respond 200 to acknowledge, handle async), and logging.
102
+
103
+ **e. Testing** — use \`send_test_webhook\` to verify. Test payloads include \`context.test: true\`.
104
+
105
+ 3. **Output the plan as a numbered checklist** the developer can follow step by step. Include file paths, code snippets matching their stack, and which Zellify MCP tools to use at each step.
106
+
107
+ Start by reading the project structure and key files now.`;
108
+ return {
109
+ messages: [
110
+ {
111
+ role: "user",
112
+ content: { type: "text", text: prompt },
113
+ },
114
+ ],
115
+ };
116
+ });
117
+ }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerGetExamplePayload(server: McpServer): void;
3
+ //# sourceMappingURL=get-example-payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-example-payload.d.ts","sourceRoot":"","sources":["../../src/tools/get-example-payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,QAmD1D"}
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ import { getExamplePayload } from "../client.js";
3
+ export function registerGetExamplePayload(server) {
4
+ server.tool("get_example_payload", "Generate a realistic example Registration Webhook payload for a funnel, with dummy values matching your specific question types. Includes a TypeScript interface. Use as the contract for building webhook handlers.", { funnelId: z.string().describe("The funnel ID (number as string)") }, async ({ funnelId }) => {
5
+ let data;
6
+ try {
7
+ data = await getExamplePayload(funnelId);
8
+ }
9
+ catch (err) {
10
+ const message = err instanceof Error ? err.message : String(err);
11
+ if (message.includes("404") || message.includes("not found")) {
12
+ return {
13
+ content: [
14
+ {
15
+ type: "text",
16
+ text: `Funnel ${funnelId} not found. Run list_funnels to see available funnel IDs.`,
17
+ },
18
+ ],
19
+ };
20
+ }
21
+ return {
22
+ content: [
23
+ {
24
+ type: "text",
25
+ text: `Failed to get example payload: ${message}`,
26
+ },
27
+ ],
28
+ };
29
+ }
30
+ const text = [
31
+ `Example Registration Webhook payload for funnel ${funnelId}:`,
32
+ "",
33
+ "## Payload",
34
+ "```json",
35
+ JSON.stringify(data.payload, null, 2),
36
+ "```",
37
+ "",
38
+ `Signature header: \`${data.signatureHeader}\``,
39
+ `Algorithm: ${data.signatureAlgorithm}`,
40
+ "",
41
+ "## TypeScript Interface",
42
+ "```typescript",
43
+ data.typescript,
44
+ "```",
45
+ ].join("\n");
46
+ return { content: [{ type: "text", text }] };
47
+ });
48
+ }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerGetFunnelSchema(server: McpServer): void;
3
+ //# sourceMappingURL=get-funnel-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-funnel-schema.d.ts","sourceRoot":"","sources":["../../src/tools/get-funnel-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAwDxD"}
@@ -0,0 +1,53 @@
1
+ import { z } from "zod";
2
+ import { getFunnelSchema } from "../client.js";
3
+ export function registerGetFunnelSchema(server) {
4
+ server.tool("get_funnel_schema", "Get the variable schema for a funnel — question names, types, options, and page slugs. Use this to understand what data the Registration Webhook delivers.", { funnelId: z.string().describe("The funnel ID (number as string)") }, async ({ funnelId }) => {
5
+ let data;
6
+ try {
7
+ data = await getFunnelSchema(funnelId);
8
+ }
9
+ catch (err) {
10
+ const message = err instanceof Error ? err.message : String(err);
11
+ if (message.includes("404") || message.includes("not found")) {
12
+ return {
13
+ content: [
14
+ {
15
+ type: "text",
16
+ text: `Funnel ${funnelId} not found. Run list_funnels to see available funnel IDs.`,
17
+ },
18
+ ],
19
+ };
20
+ }
21
+ return {
22
+ content: [
23
+ { type: "text", text: `Failed to get schema: ${message}` },
24
+ ],
25
+ };
26
+ }
27
+ const vars = data.variables;
28
+ if (vars.length === 0) {
29
+ return {
30
+ content: [
31
+ {
32
+ type: "text",
33
+ text: `Funnel ${funnelId} has no variables in its published schema.`,
34
+ },
35
+ ],
36
+ };
37
+ }
38
+ const lines = vars.map((v) => {
39
+ let line = `- ${v.name} (${v.questionType})`;
40
+ if (v.questionText)
41
+ line += `: "${v.questionText}"`;
42
+ if (v.pageSlug)
43
+ line += ` [page: ${v.pageSlug}]`;
44
+ if (v.options.length > 0) {
45
+ const opts = v.options.map((o) => `${o.id}="${o.label}"`).join(", ");
46
+ line += `\n Options: ${opts}`;
47
+ }
48
+ return line;
49
+ });
50
+ const text = `Funnel ${funnelId} — ${vars.length} variable(s):\n\n${lines.join("\n")}\n\n---\nRaw JSON:\n${JSON.stringify(data, null, 2)}`;
51
+ return { content: [{ type: "text", text }] };
52
+ });
53
+ }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerGetIntegrations(server: McpServer): void;
3
+ //# sourceMappingURL=get-integrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-integrations.d.ts","sourceRoot":"","sources":["../../src/tools/get-integrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAiCxD"}
@@ -0,0 +1,25 @@
1
+ import { getIntegrations } from "../client.js";
2
+ export function registerGetIntegrations(server) {
3
+ server.tool("get_integrations", "Check which integrations are configured — payment provider, RevenueCat, webhook, analytics. Use to understand what's set up before building integration code.", {}, async () => {
4
+ const data = await getIntegrations();
5
+ const lines = [];
6
+ if (data.integrations.length > 0) {
7
+ lines.push("Configured integrations:");
8
+ for (const i of data.integrations) {
9
+ lines.push(` - ${i.name}`);
10
+ }
11
+ }
12
+ else {
13
+ lines.push("No integrations configured.");
14
+ }
15
+ lines.push("");
16
+ lines.push(`Payment provider: ${data.paymentProvider ?? "none configured"}`);
17
+ lines.push(`Active campaigns: ${data.campaignCount}`);
18
+ lines.push("");
19
+ lines.push("---");
20
+ lines.push(`Raw JSON:\n${JSON.stringify(data, null, 2)}`);
21
+ return {
22
+ content: [{ type: "text", text: lines.join("\n") }],
23
+ };
24
+ });
25
+ }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerListFunnels(server: McpServer): void;
3
+ //# sourceMappingURL=list-funnels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-funnels.d.ts","sourceRoot":"","sources":["../../src/tools/list-funnels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,QA8BpD"}
@@ -0,0 +1,20 @@
1
+ import { listFunnels } from "../client.js";
2
+ export function registerListFunnels(server) {
3
+ server.tool("list_funnels", "List all funnels for your Zellify organization. Returns funnel ID, name, and published status. Use this first to find the funnel ID needed by other tools.", {}, async () => {
4
+ const data = await listFunnels();
5
+ const funnels = data.funnels;
6
+ if (funnels.length === 0) {
7
+ return {
8
+ content: [
9
+ {
10
+ type: "text",
11
+ text: "No funnels found in your organization.",
12
+ },
13
+ ],
14
+ };
15
+ }
16
+ const lines = funnels.map((f) => `- ID: ${f.id} | ${f.name} | ${f.published ? "Published" : "Draft"} | Updated: ${f.updatedAt}`);
17
+ const text = `Found ${funnels.length} funnel(s):\n\n${lines.join("\n")}\n\n---\nRaw JSON:\n${JSON.stringify(data, null, 2)}`;
18
+ return { content: [{ type: "text", text }] };
19
+ });
20
+ }
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerSendTestWebhook(server: McpServer): void;
3
+ //# sourceMappingURL=send-test-webhook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-test-webhook.d.ts","sourceRoot":"","sources":["../../src/tools/send-test-webhook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QA6FxD"}