@agifyai/leadify-mcp 8.6.4 → 8.6.5

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 CHANGED
@@ -8,5 +8,11 @@ export declare class LeadifyClient {
8
8
  put(path: string, body: unknown): Promise<unknown>;
9
9
  patch(path: string, body: unknown): Promise<unknown>;
10
10
  delete(path: string, body?: unknown): Promise<unknown>;
11
+ /**
12
+ * Invoke an authenticated oRPC procedure. The API-key facade exposes most
13
+ * everyday operations as REST, while hash-pinned schema migrations remain
14
+ * intentionally available only through the admin oRPC boundary.
15
+ */
16
+ rpc(path: string, input: unknown): Promise<unknown>;
11
17
  }
12
18
  export declare function getClient(): LeadifyClient;
package/dist/client.js CHANGED
@@ -57,6 +57,19 @@ export class LeadifyClient {
57
57
  const url = new URL(path, this.baseUrl);
58
58
  return this.request("DELETE", url, body);
59
59
  }
60
+ /**
61
+ * Invoke an authenticated oRPC procedure. The API-key facade exposes most
62
+ * everyday operations as REST, while hash-pinned schema migrations remain
63
+ * intentionally available only through the admin oRPC boundary.
64
+ */
65
+ async rpc(path, input) {
66
+ const url = new URL(`/rpc/${path.replace(/^\/+/, "")}`, this.baseUrl);
67
+ const data = await this.request("POST", url, { json: input });
68
+ if (data && typeof data === "object" && "json" in data) {
69
+ return data.json;
70
+ }
71
+ return data;
72
+ }
60
73
  }
61
74
  let _client = null;
62
75
  export function getClient() {
@@ -1,5 +1,5 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { type LeadifyClient } from "../client.js";
3
- type SchemaClient = Pick<LeadifyClient, "get" | "post">;
3
+ type SchemaClient = Pick<LeadifyClient, "get" | "post" | "rpc">;
4
4
  export declare function registerSchemaTools(server: McpServer, client?: SchemaClient): void;
5
5
  export {};
@@ -78,6 +78,42 @@ export function registerSchemaTools(server, client) {
78
78
  return handleToolError(error);
79
79
  }
80
80
  });
81
+ // ── schema_migration_preview / apply_schema_migration ─────────────────
82
+ server.tool("schema_migration_preview", "Preview the exact hash-pinned schema migration required to make a lead group READY. " +
83
+ "This is read-only. Review the returned expectedSchemaHash, planHash, impacted leads and " +
84
+ "conversion actions before calling apply_schema_migration.", {
85
+ lead_group_id: z.string().describe("ID of the lead group to inspect."),
86
+ }, async ({ lead_group_id }) => {
87
+ try {
88
+ const data = await (client ?? getClient()).rpc("leadGroups/schemaMigrationPreview", { leadGroupId: lead_group_id });
89
+ return toolResult(data);
90
+ }
91
+ catch (error) {
92
+ return handleToolError(error);
93
+ }
94
+ });
95
+ server.tool("apply_schema_migration", "Apply a destructive schema migration only after schema_migration_preview has been read and " +
96
+ "the exact expected_schema_hash and expected_plan_hash have been supplied. This API performs " +
97
+ "its own optimistic hash checks. Use only for the reviewed lead group; reread its leads and " +
98
+ "schema readiness afterwards.", {
99
+ lead_group_id: z.string().describe("ID of the reviewed lead group."),
100
+ expected_schema_hash: z.string().regex(/^[a-f0-9]{64}$/).describe("expectedSchemaHash from the fresh preview."),
101
+ expected_plan_hash: z.string().regex(/^[a-f0-9]{64}$/).describe("planHash from the same fresh preview."),
102
+ confirmation: z.literal("apply_destructive_schema_migration").describe("Exact acknowledgement required by the server."),
103
+ }, async ({ lead_group_id, expected_schema_hash, expected_plan_hash, confirmation }) => {
104
+ try {
105
+ const data = await (client ?? getClient()).rpc("leadGroups/applySchemaMigration", {
106
+ leadGroupId: lead_group_id,
107
+ expectedSchemaHash: expected_schema_hash,
108
+ expectedPlanHash: expected_plan_hash,
109
+ confirmation,
110
+ });
111
+ return toolResult(data);
112
+ }
113
+ catch (error) {
114
+ return handleToolError(error);
115
+ }
116
+ });
81
117
  // ── delete_columns ─────────────────────────────────────────────────────
82
118
  server.tool("delete_columns", "Remove one or more columns (fields) from a lead group's schema and all lead data " +
83
119
  "stored in those fields. This action is irreversible — field definitions and values " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agifyai/leadify-mcp",
3
- "version": "8.6.4",
3
+ "version": "8.6.5",
4
4
  "description": "MCP server for Leadify lead management API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",