@agifyai/leadify-mcp 7.1.2 → 7.1.3
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/server.js
CHANGED
|
@@ -16,7 +16,7 @@ import { registerFineTuningTools } from "./tools/fine_tuning.js";
|
|
|
16
16
|
export function createServer() {
|
|
17
17
|
const server = new McpServer({
|
|
18
18
|
name: "leadify",
|
|
19
|
-
version: "
|
|
19
|
+
version: "7.1.3",
|
|
20
20
|
});
|
|
21
21
|
registerAuthTools(server);
|
|
22
22
|
registerOrganizationTools(server);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
export declare function assertLeadGroupsBelongToOrganization(data: unknown, organizationId: string): Array<Record<string, unknown>>;
|
|
2
3
|
export declare function registerOrganizationTools(server: McpServer): void;
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { getClient } from "../client.js";
|
|
3
3
|
import { toolResult, handleToolError } from "../types.js";
|
|
4
|
+
export function assertLeadGroupsBelongToOrganization(data, organizationId) {
|
|
5
|
+
if (!data ||
|
|
6
|
+
typeof data !== "object" ||
|
|
7
|
+
!Array.isArray(data.leadGroups)) {
|
|
8
|
+
throw new Error("Leadify returned an invalid lead group list response");
|
|
9
|
+
}
|
|
10
|
+
const leadGroups = data.leadGroups;
|
|
11
|
+
for (const group of leadGroups) {
|
|
12
|
+
if (!group || typeof group !== "object") {
|
|
13
|
+
throw new Error("Leadify returned an invalid lead group");
|
|
14
|
+
}
|
|
15
|
+
const actualOrganizationId = group.organizationId;
|
|
16
|
+
if (actualOrganizationId !== organizationId) {
|
|
17
|
+
const groupId = group.id;
|
|
18
|
+
throw new Error(`Leadify returned group ${typeof groupId === "string" ? groupId : "without an id"} ` +
|
|
19
|
+
`from organization ${typeof actualOrganizationId === "string" ? actualOrganizationId : "without an organization"} ` +
|
|
20
|
+
`while ${organizationId} was requested`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return leadGroups;
|
|
24
|
+
}
|
|
4
25
|
export function registerOrganizationTools(server) {
|
|
5
26
|
// ── list_organizations ─────────────────────────────────────────────────
|
|
6
27
|
server.tool("list_organizations", "List every organization accessible to the caller, returning each with id, name, and " +
|
|
@@ -24,9 +45,7 @@ export function registerOrganizationTools(server) {
|
|
|
24
45
|
try {
|
|
25
46
|
const params = new URLSearchParams({ organizationId: organization_id });
|
|
26
47
|
const data = await getClient().get("/api/lead-groups", params);
|
|
27
|
-
const groups =
|
|
28
|
-
? data.leadGroups
|
|
29
|
-
: [];
|
|
48
|
+
const groups = assertLeadGroupsBelongToOrganization(data, organization_id);
|
|
30
49
|
return toolResult({
|
|
31
50
|
organizationId: organization_id,
|
|
32
51
|
leadGroups: groups.slice(0, limit).map((group) => ({
|
|
@@ -67,10 +86,10 @@ export function registerOrganizationTools(server) {
|
|
|
67
86
|
return toolResult({ organizations, selectionRequired: true, message: "organization_id is not accessible to this key." });
|
|
68
87
|
}
|
|
69
88
|
const groupsData = await getClient().get("/api/lead-groups", new URLSearchParams({ organizationId: organization_id }));
|
|
70
|
-
const groups =
|
|
89
|
+
const groups = assertLeadGroupsBelongToOrganization(groupsData, organization_id);
|
|
71
90
|
return toolResult({
|
|
72
91
|
organization: organizations.find((org) => org.id === organization_id),
|
|
73
|
-
leadGroups: groups.slice(0, limit).map((group) => ({ id: group.id, name: group.name, leadCount: group._count?.leads ?? 0, published: group.published ?? false })),
|
|
92
|
+
leadGroups: groups.slice(0, limit).map((group) => ({ id: group.id, name: group.name, organizationId: group.organizationId, leadCount: group._count?.leads ?? 0, published: group.published ?? false })),
|
|
74
93
|
total: groups.length,
|
|
75
94
|
truncated: groups.length > limit,
|
|
76
95
|
next: "Choose a lead_group_id, then use get_leads, get_data_room_context, or get_lead_group_persona.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agifyai/leadify-mcp",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.3",
|
|
4
4
|
"description": "MCP server for Leadify lead management API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"build": "rm -rf dist && tsc && chmod +x dist/index.js",
|
|
16
16
|
"start": "node dist/index.js",
|
|
17
17
|
"dev": "tsc --watch",
|
|
18
|
-
"prepublishOnly": "npm run build"
|
|
18
|
+
"prepublishOnly": "npm run build",
|
|
19
|
+
"test": "npm run build && node --test test/**/*.test.mjs"
|
|
19
20
|
},
|
|
20
21
|
"repository": {
|
|
21
22
|
"type": "git",
|