@agifyai/leadify-mcp 9.3.0 → 9.4.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 CHANGED
@@ -378,6 +378,15 @@ Aucune mutation de sourcing ne qualifie le lead, n’enrichit les contacts
378
378
  aucun canal externe : le readback porte `noSend: true` et
379
379
  `externalActivation: 0`.
380
380
 
381
+ ### Domaine d'une organisation existante (PRD-2401)
382
+
383
+ `update_organization(organization_id, domain)` renseigne le domaine d'une organisation
384
+ créée sans domaine, pour que `list_organizations(domain)` la retrouve. Il exige le droit
385
+ d'écriture et l'administration de l'organisation ; il ne remplace jamais un domaine déjà
386
+ posé et refuse un domaine pris par une autre organisation (409). `create_organization`
387
+ renvoie `warnings` (`SAME_NAME_WITHOUT_DOMAIN`) quand une organisation accessible de même
388
+ nom existe sans domaine : la compléter plutôt que garder un doublon.
389
+
381
390
  ### Exclusions de prospection (PRD-2404)
382
391
 
383
392
  Une exclusion ne s'écrit jamais en texte (Context Workspace, notes, persona) ni dans les
@@ -3,4 +3,4 @@ import { type LeadifyClient } from "../client.js";
3
3
  export declare function assertLeadGroupsBelongToOrganization(data: unknown, organizationId: string): Array<Record<string, unknown>>;
4
4
  /** Keep group reads navigable: never return schema, profiles, or lead data. */
5
5
  export declare function compactLeadGroup(group: unknown): Record<string, unknown>;
6
- export declare function registerOrganizationTools(server: McpServer, client?: Pick<LeadifyClient, "get" | "post">): void;
6
+ export declare function registerOrganizationTools(server: McpServer, client?: Pick<LeadifyClient, "get" | "post" | "put">): void;
@@ -48,7 +48,9 @@ export function registerOrganizationTools(server, client = getClient()) {
48
48
  server.tool("create_organization", "Create an organization through Leadify using an explicitly authorized API key. The caller becomes its " +
49
49
  "administrator. Repeating the same normalized domain returns the existing organization with created=false. " +
50
50
  "The server grants this key access to the new organization without removing its existing bindings. " +
51
- "This does not create a Context Workspace or start qualification. Manage key permissions in Leadify settings.", { name: z.string().trim().min(1).max(200), domain: z.string().trim().min(1),
51
+ "This does not create a Context Workspace or start qualification. Manage key permissions in Leadify settings. " +
52
+ "The result may carry `warnings` (code SAME_NAME_WITHOUT_DOMAIN): an accessible organization of the same name " +
53
+ "already exists without a domain. Complete it with update_organization instead of keeping a duplicate.", { name: z.string().trim().min(1).max(200), domain: z.string().trim().min(1),
52
54
  external_ref: z.string().trim().min(1).max(200).optional() }, async ({ name, domain, external_ref }) => {
53
55
  try {
54
56
  return toolResult(await client.post("/api/organizations", { name, domain, externalRef: external_ref }));
@@ -57,6 +59,19 @@ export function registerOrganizationTools(server, client = getClient()) {
57
59
  return handleToolError(error);
58
60
  }
59
61
  });
62
+ server.tool("update_organization", "Set the domain of an EXISTING organization that has none (created before domains existed), so " +
63
+ "list_organizations(domain) finds it and create_organization stops duplicating it. Needs write permission and " +
64
+ "administration of that organization. The domain is normalized (no URL). Repeating the same domain changes " +
65
+ "nothing (changed=false). It never replaces a domain already set (409) and refuses a domain used by another " +
66
+ "organization (409). Verify afterwards with list_organizations(domain).", { organization_id: z.string().trim().min(1).describe("Organization ID from list_organizations."),
67
+ domain: z.string().trim().min(1).describe("Domain like exemple.fr, without page address.") }, async ({ organization_id, domain }) => {
68
+ try {
69
+ return toolResult(await client.put(`/api/organizations/${encodeURIComponent(organization_id)}/domain`, { domain }));
70
+ }
71
+ catch (error) {
72
+ return handleToolError(error);
73
+ }
74
+ });
60
75
  // ── list_organizations ─────────────────────────────────────────────────
61
76
  server.tool("list_organizations", "List every organization accessible to the caller, returning each with id, name, and " +
62
77
  "optional slug. Use this as the starting point when you need an organization_id — " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agifyai/leadify-mcp",
3
- "version": "9.3.0",
3
+ "version": "9.4.0",
4
4
  "description": "MCP server for Leadify lead management API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",