coregrid-crm-mcp 0.1.0 → 0.2.1
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 +2 -1
- package/index.js +21 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,13 +12,14 @@ para que un agente lo opere y pruebe.
|
|
|
12
12
|
| `update_deal` | Actualiza título/valor/cliente/etiquetas/etapa |
|
|
13
13
|
| `move_deal` | Mueve una oportunidad a otra etapa |
|
|
14
14
|
| `delete_deal` | Elimina una oportunidad |
|
|
15
|
+
| `create_share_link` | Genera un link público de solo lectura (tablero completo o una oportunidad) |
|
|
15
16
|
|
|
16
17
|
## Configuración
|
|
17
18
|
|
|
18
19
|
Variables de entorno:
|
|
19
20
|
|
|
20
21
|
- `CRM_API_KEY` (requerido) — bearer token del workspace.
|
|
21
|
-
- `CRM_API_URL` (opcional) — base del CRM. Default `https://crm
|
|
22
|
+
- `CRM_API_URL` (opcional) — base del CRM. Default `https://crm.coregrid.com.mx`.
|
|
22
23
|
|
|
23
24
|
## Uso con un agente (config MCP)
|
|
24
25
|
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Expone el pipeline de ventas como tools para que un agente lo opere/pruebe.
|
|
4
4
|
//
|
|
5
5
|
// Configuración (env):
|
|
6
|
-
// CRM_API_URL — base del CRM (default https://crm
|
|
6
|
+
// CRM_API_URL — base del CRM (default https://crm.coregrid.com.mx)
|
|
7
7
|
// CRM_API_KEY — bearer token del workspace (requerido)
|
|
8
8
|
//
|
|
9
9
|
// Uso típico (config de un agente MCP):
|
|
@@ -17,7 +17,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
17
17
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18
18
|
import { z } from "zod";
|
|
19
19
|
|
|
20
|
-
const API_URL = (process.env.CRM_API_URL || "https://crm
|
|
20
|
+
const API_URL = (process.env.CRM_API_URL || "https://crm.coregrid.com.mx").replace(/\/$/, "");
|
|
21
21
|
const API_KEY = process.env.CRM_API_KEY;
|
|
22
22
|
|
|
23
23
|
if (!API_KEY) {
|
|
@@ -61,7 +61,7 @@ const fail = (e) => ({
|
|
|
61
61
|
|
|
62
62
|
const server = new McpServer({
|
|
63
63
|
name: "coregrid-crm",
|
|
64
|
-
version: "0.1
|
|
64
|
+
version: "0.2.1",
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
server.tool(
|
|
@@ -173,6 +173,24 @@ server.tool(
|
|
|
173
173
|
}
|
|
174
174
|
);
|
|
175
175
|
|
|
176
|
+
server.tool(
|
|
177
|
+
"create_share_link",
|
|
178
|
+
"Genera un link público de SOLO LECTURA (con token) para abrir el pipeline completo o una oportunidad específica. Úsalo para mandarle a alguien una vista del tablero o de un lead sin que tenga que iniciar sesión. Devuelve la URL.",
|
|
179
|
+
{
|
|
180
|
+
kind: z.enum(["pipeline", "deal"]).describe("'pipeline' = tablero completo; 'deal' = una oportunidad"),
|
|
181
|
+
dealId: z.string().optional().describe("ID del deal (requerido si kind='deal')"),
|
|
182
|
+
expiresHours: z.number().optional().describe("Horas hasta que expire el link (omitir = sin expiración)"),
|
|
183
|
+
},
|
|
184
|
+
async ({ kind, dealId, expiresHours }) => {
|
|
185
|
+
try {
|
|
186
|
+
const r = await postCrm({ intent: "create_share_link", kind, dealId, expiresHours });
|
|
187
|
+
return ok({ url: r.url });
|
|
188
|
+
} catch (e) {
|
|
189
|
+
return fail(e);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
|
|
176
194
|
const transport = new StdioServerTransport();
|
|
177
195
|
await server.connect(transport);
|
|
178
196
|
console.error(`[coregrid-crm-mcp] conectado a ${API_URL}`);
|