@mgsoftwarebv/mg-dashboard-mcp 2.2.0 → 2.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/dist/index.js CHANGED
@@ -16,25 +16,22 @@ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
16
16
  "INTERRUPTED",
17
17
  "EXPIRED"
18
18
  ]);
19
+ var DEFAULT_TRIGGER_SERVER_ID = "03659d55-e194-400d-b82a-bf6457371ded";
19
20
  var TRIGGER_TOOLS = [
20
21
  {
21
22
  name: "trigger-list",
22
- description: "List all Trigger.dev instances (Docker Compose projects) on a server. Returns the compose project name, webapp port, and status for each instance. Use the project name in other trigger-* tools.",
23
+ description: "List all Trigger.dev projects on the Trigger server. Returns the compose project name, webapp port, and status. Use the project name in other trigger-* tools.",
23
24
  inputSchema: {
24
25
  type: "object",
25
- properties: {
26
- serverId: { type: "string", description: "UUID of the SSH server running Trigger.dev" }
27
- },
28
- required: ["serverId"]
26
+ properties: {}
29
27
  }
30
28
  },
31
29
  {
32
30
  name: "trigger-runs",
33
- description: "List recent task runs for a Trigger.dev instance. Returns run ID, task name, status, duration, and timestamps.",
31
+ description: "List recent task runs for a Trigger.dev project. Returns run ID, task name, status, duration, and timestamps.",
34
32
  inputSchema: {
35
33
  type: "object",
36
34
  properties: {
37
- serverId: { type: "string", description: "UUID of the SSH server" },
38
35
  project: { type: "string", description: "Compose project name (from trigger-list)" },
39
36
  status: {
40
37
  type: "string",
@@ -43,7 +40,7 @@ var TRIGGER_TOOLS = [
43
40
  taskIdentifier: { type: "string", description: 'Filter by task identifier (e.g. "hello-world")' },
44
41
  limit: { type: "number", description: "Max runs to return (default 20, max 100)" }
45
42
  },
46
- required: ["serverId", "project"]
43
+ required: ["project"]
47
44
  }
48
45
  },
49
46
  {
@@ -52,11 +49,10 @@ var TRIGGER_TOOLS = [
52
49
  inputSchema: {
53
50
  type: "object",
54
51
  properties: {
55
- serverId: { type: "string", description: "UUID of the SSH server" },
56
52
  project: { type: "string", description: "Compose project name" },
57
53
  runId: { type: "string", description: "Run ID (e.g. run_xxxxx)" }
58
54
  },
59
- required: ["serverId", "project", "runId"]
55
+ required: ["project", "runId"]
60
56
  }
61
57
  },
62
58
  {
@@ -65,13 +61,12 @@ var TRIGGER_TOOLS = [
65
61
  inputSchema: {
66
62
  type: "object",
67
63
  properties: {
68
- serverId: { type: "string", description: "UUID of the SSH server" },
69
64
  project: { type: "string", description: "Compose project name" },
70
65
  taskId: { type: "string", description: 'Task identifier (e.g. "hello-world", "execute-pipeline")' },
71
66
  payload: { type: "string", description: "JSON payload string to pass to the task (optional)" },
72
67
  waitSeconds: { type: "number", description: "Max seconds to wait for completion (default 60, max 300)" }
73
68
  },
74
- required: ["serverId", "project", "taskId"]
69
+ required: ["project", "taskId"]
75
70
  }
76
71
  },
77
72
  {
@@ -80,11 +75,10 @@ var TRIGGER_TOOLS = [
80
75
  inputSchema: {
81
76
  type: "object",
82
77
  properties: {
83
- serverId: { type: "string", description: "UUID of the SSH server" },
84
78
  project: { type: "string", description: "Compose project name" },
85
79
  runId: { type: "string", description: "Run ID to cancel (e.g. run_xxxxx)" }
86
80
  },
87
- required: ["serverId", "project", "runId"]
81
+ required: ["project", "runId"]
88
82
  }
89
83
  },
90
84
  {
@@ -93,11 +87,10 @@ var TRIGGER_TOOLS = [
93
87
  inputSchema: {
94
88
  type: "object",
95
89
  properties: {
96
- serverId: { type: "string", description: "UUID of the SSH server" },
97
90
  project: { type: "string", description: "Compose project name" },
98
91
  runId: { type: "string", description: "Run ID to replay (e.g. run_xxxxx)" }
99
92
  },
100
- required: ["serverId", "project", "runId"]
93
+ required: ["project", "runId"]
101
94
  }
102
95
  }
103
96
  ];
@@ -115,7 +108,7 @@ async function discoverInstance(project, conn, proxy, sshExec2) {
115
108
  const wa = `${project}-webapp-1`;
116
109
  const cmd = [
117
110
  `PORT=$(docker port "${wa}" 3000/tcp 2>/dev/null | head -1 | sed 's/.*://')`,
118
- `KEY=$(docker exec "${pg}" psql -U postgres -d main -t -A -c "SELECT \\"apiKey\\" FROM \\"RuntimeEnvironment\\" WHERE slug='production' LIMIT 1" 2>/dev/null | tr -d '[:space:]')`,
111
+ `KEY=$(docker exec "${pg}" psql -U postgres -d main -t -A -c "SELECT \\"apiKey\\" FROM \\"RuntimeEnvironment\\" WHERE slug='prod' LIMIT 1" 2>/dev/null | tr -d '[:space:]')`,
119
112
  'echo "$PORT|$KEY"'
120
113
  ].join(" && ");
121
114
  const result = await sshExec2(conn, cmd, proxy);
@@ -198,10 +191,11 @@ function formatRunDetail(run) {
198
191
  }
199
192
  async function handleTriggerTool(name, args2, deps) {
200
193
  const { sshExec: sshExec2, getServerConnection: getServerConnection2 } = deps;
194
+ const serverId = DEFAULT_TRIGGER_SERVER_ID;
201
195
  switch (name) {
202
196
  // -----------------------------------------------------------------
203
197
  case "trigger-list": {
204
- const { conn, proxy } = await getServerConnection2(String(args2.serverId));
198
+ const { conn, proxy } = await getServerConnection2(serverId);
205
199
  const script = [
206
200
  "FOUND=0",
207
201
  "for PG in $(docker ps --format '{{.Names}}' | grep -E 'trigger.*-postgres-[0-9]+$'); do",
@@ -234,7 +228,7 @@ ${lines.join("\n")}` }] };
234
228
  // -----------------------------------------------------------------
235
229
  case "trigger-runs": {
236
230
  const project = String(args2.project);
237
- const { conn, proxy } = await getServerConnection2(String(args2.serverId));
231
+ const { conn, proxy } = await getServerConnection2(serverId);
238
232
  const instance = await discoverInstance(project, conn, proxy, sshExec2);
239
233
  const limit = Math.min(Math.max(Number(args2.limit) || 20, 1), 100);
240
234
  const queryParts = [`page[size]=${limit}`];
@@ -262,7 +256,7 @@ ${rawJson.substring(0, 500)}` }] };
262
256
  case "trigger-run-detail": {
263
257
  const project = String(args2.project);
264
258
  const runId = String(args2.runId);
265
- const { conn, proxy } = await getServerConnection2(String(args2.serverId));
259
+ const { conn, proxy } = await getServerConnection2(serverId);
266
260
  const instance = await discoverInstance(project, conn, proxy, sshExec2);
267
261
  const rawJson = await triggerApi(
268
262
  conn,
@@ -286,7 +280,7 @@ ${rawJson.substring(0, 500)}` }] };
286
280
  const project = String(args2.project);
287
281
  const taskId = String(args2.taskId);
288
282
  const waitSeconds = Math.min(Math.max(Number(args2.waitSeconds) || 60, 5), 300);
289
- const { conn, proxy } = await getServerConnection2(String(args2.serverId));
283
+ const { conn, proxy } = await getServerConnection2(serverId);
290
284
  conn.timeout = (waitSeconds + 30) * 1e3;
291
285
  const instance = await discoverInstance(project, conn, proxy, sshExec2);
292
286
  let payload = "{}";
@@ -356,7 +350,7 @@ ${triggerJson.substring(0, 500)}` }] };
356
350
  case "trigger-cancel-run": {
357
351
  const project = String(args2.project);
358
352
  const runId = String(args2.runId);
359
- const { conn, proxy } = await getServerConnection2(String(args2.serverId));
353
+ const { conn, proxy } = await getServerConnection2(serverId);
360
354
  const instance = await discoverInstance(project, conn, proxy, sshExec2);
361
355
  const rawJson = await triggerApi(
362
356
  conn,
@@ -384,7 +378,7 @@ ${rawJson.substring(0, 500)}` }] };
384
378
  case "trigger-replay-run": {
385
379
  const project = String(args2.project);
386
380
  const runId = String(args2.runId);
387
- const { conn, proxy } = await getServerConnection2(String(args2.serverId));
381
+ const { conn, proxy } = await getServerConnection2(serverId);
388
382
  const instance = await discoverInstance(project, conn, proxy, sshExec2);
389
383
  const rawJson = await triggerApi(
390
384
  conn,