tracecat-mcp-community 1.0.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/.env.example +7 -0
- package/LICENSE +21 -0
- package/README.md +267 -0
- package/dist/client.d.ts +26 -0
- package/dist/client.js +147 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +32 -0
- package/dist/minimal.d.ts +1 -0
- package/dist/minimal.js +8 -0
- package/dist/minimal.js.backup +8 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +32 -0
- package/dist/tools/actions.d.ts +3 -0
- package/dist/tools/actions.js +54 -0
- package/dist/tools/cases.d.ts +3 -0
- package/dist/tools/cases.js +73 -0
- package/dist/tools/docs.d.ts +3 -0
- package/dist/tools/docs.js +389 -0
- package/dist/tools/executions.d.ts +3 -0
- package/dist/tools/executions.js +40 -0
- package/dist/tools/graph.d.ts +3 -0
- package/dist/tools/graph.js +82 -0
- package/dist/tools/schedules.d.ts +3 -0
- package/dist/tools/schedules.js +52 -0
- package/dist/tools/secrets.d.ts +3 -0
- package/dist/tools/secrets.js +56 -0
- package/dist/tools/system.d.ts +3 -0
- package/dist/tools/system.js +16 -0
- package/dist/tools/tables.d.ts +3 -0
- package/dist/tools/tables.js +102 -0
- package/dist/tools/templates.d.ts +3 -0
- package/dist/tools/templates.js +547 -0
- package/dist/tools/webhooks.d.ts +3 -0
- package/dist/tools/webhooks.js +9 -0
- package/dist/tools/workflows.d.ts +3 -0
- package/dist/tools/workflows.js +318 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.js +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerScheduleTools(server, client) {
|
|
3
|
+
server.tool("tracecat_list_schedules", "List all schedules in the current workspace", {
|
|
4
|
+
workflow_id: z.string().optional().describe("Filter by workflow ID"),
|
|
5
|
+
}, async ({ workflow_id }) => {
|
|
6
|
+
const params = {};
|
|
7
|
+
if (workflow_id)
|
|
8
|
+
params.workflow_id = workflow_id;
|
|
9
|
+
const schedules = await client.get("/schedules", params);
|
|
10
|
+
return { content: [{ type: "text", text: JSON.stringify(schedules, null, 2) }] };
|
|
11
|
+
});
|
|
12
|
+
server.tool("tracecat_create_schedule", "Create a new schedule for a workflow (cron or interval)", {
|
|
13
|
+
workflow_id: z.string().describe("Workflow ID to schedule"),
|
|
14
|
+
cron: z.string().optional().describe("Cron expression (e.g. '0 */5 * * *' for every 5 hours)"),
|
|
15
|
+
every: z.string().optional().describe("Interval string (e.g. '5m', '1h', '1d')"),
|
|
16
|
+
inputs: z.record(z.unknown()).optional().describe("Input payload for each scheduled run"),
|
|
17
|
+
}, async ({ workflow_id, cron, every, inputs }) => {
|
|
18
|
+
const body = { workflow_id };
|
|
19
|
+
if (cron)
|
|
20
|
+
body.cron = cron;
|
|
21
|
+
if (every)
|
|
22
|
+
body.every = every;
|
|
23
|
+
if (inputs)
|
|
24
|
+
body.inputs = inputs;
|
|
25
|
+
const result = await client.post("/schedules", body);
|
|
26
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
27
|
+
});
|
|
28
|
+
server.tool("tracecat_get_schedule", "Get details of a specific schedule", {
|
|
29
|
+
schedule_id: z.string().describe("Schedule ID"),
|
|
30
|
+
}, async ({ schedule_id }) => {
|
|
31
|
+
const schedule = await client.get(`/schedules/${schedule_id}`);
|
|
32
|
+
return { content: [{ type: "text", text: JSON.stringify(schedule, null, 2) }] };
|
|
33
|
+
});
|
|
34
|
+
server.tool("tracecat_update_schedule", "Update a schedule (cron, interval, status, inputs)", {
|
|
35
|
+
schedule_id: z.string().describe("Schedule ID"),
|
|
36
|
+
cron: z.string().optional().describe("New cron expression"),
|
|
37
|
+
every: z.string().optional().describe("New interval string"),
|
|
38
|
+
inputs: z.record(z.unknown()).optional().describe("New input payload"),
|
|
39
|
+
status: z.string().optional().describe("New status (online/offline)"),
|
|
40
|
+
}, async ({ schedule_id, ...updates }) => {
|
|
41
|
+
const body = Object.fromEntries(Object.entries(updates).filter(([, v]) => v !== undefined));
|
|
42
|
+
// Update uses POST, not PATCH
|
|
43
|
+
const result = await client.post(`/schedules/${schedule_id}`, body);
|
|
44
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
45
|
+
});
|
|
46
|
+
server.tool("tracecat_delete_schedule", "Delete a schedule", {
|
|
47
|
+
schedule_id: z.string().describe("Schedule ID"),
|
|
48
|
+
}, async ({ schedule_id }) => {
|
|
49
|
+
const result = await client.delete(`/schedules/${schedule_id}`);
|
|
50
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerSecretTools(server, client) {
|
|
3
|
+
server.tool("tracecat_search_secrets", "Search for secrets by name or type", {
|
|
4
|
+
name: z.string().optional().describe("Filter by secret name"),
|
|
5
|
+
}, async ({ name }) => {
|
|
6
|
+
const params = {};
|
|
7
|
+
if (name)
|
|
8
|
+
params.name = name;
|
|
9
|
+
const secrets = await client.get("/secrets/search", params);
|
|
10
|
+
return { content: [{ type: "text", text: JSON.stringify(secrets, null, 2) }] };
|
|
11
|
+
});
|
|
12
|
+
server.tool("tracecat_create_secret", "Create a new secret", {
|
|
13
|
+
name: z.string().describe("Secret name"),
|
|
14
|
+
type: z.string().optional().describe("Secret type (custom, ssh, token, oauth2)"),
|
|
15
|
+
description: z.string().optional().describe("Secret description"),
|
|
16
|
+
keys: z.array(z.object({
|
|
17
|
+
key: z.string().describe("Key name"),
|
|
18
|
+
value: z.string().describe("Key value"),
|
|
19
|
+
})).describe("Key-value pairs for the secret"),
|
|
20
|
+
}, async ({ name, type, description, keys }) => {
|
|
21
|
+
const body = {
|
|
22
|
+
name,
|
|
23
|
+
type: type ?? "custom",
|
|
24
|
+
description: description ?? "",
|
|
25
|
+
keys,
|
|
26
|
+
};
|
|
27
|
+
const result = await client.post("/secrets", body);
|
|
28
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
29
|
+
});
|
|
30
|
+
server.tool("tracecat_get_secret", "Get a secret by name (returns metadata, not decrypted values)", {
|
|
31
|
+
secret_name: z.string().describe("Secret name"),
|
|
32
|
+
}, async ({ secret_name }) => {
|
|
33
|
+
const secret = await client.get(`/secrets/${secret_name}`);
|
|
34
|
+
return { content: [{ type: "text", text: JSON.stringify(secret, null, 2) }] };
|
|
35
|
+
});
|
|
36
|
+
server.tool("tracecat_update_secret", "Update an existing secret's keys or description", {
|
|
37
|
+
secret_id: z.string().describe("Secret ID (UUID)"),
|
|
38
|
+
name: z.string().optional().describe("New name"),
|
|
39
|
+
description: z.string().optional().describe("New description"),
|
|
40
|
+
keys: z.array(z.object({
|
|
41
|
+
key: z.string().describe("Key name"),
|
|
42
|
+
value: z.string().describe("Key value"),
|
|
43
|
+
})).optional().describe("New key-value pairs"),
|
|
44
|
+
}, async ({ secret_id, ...updates }) => {
|
|
45
|
+
const body = Object.fromEntries(Object.entries(updates).filter(([, v]) => v !== undefined));
|
|
46
|
+
// Update uses POST, not PATCH
|
|
47
|
+
const result = await client.post(`/secrets/${secret_id}`, body);
|
|
48
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
49
|
+
});
|
|
50
|
+
server.tool("tracecat_delete_secret", "Delete a secret permanently", {
|
|
51
|
+
secret_id: z.string().describe("Secret ID (UUID)"),
|
|
52
|
+
}, async ({ secret_id }) => {
|
|
53
|
+
const result = await client.delete(`/secrets/${secret_id}`);
|
|
54
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function registerSystemTools(server, client) {
|
|
2
|
+
server.tool("tracecat_health_check", "Check if the Tracecat API is running and healthy", {}, async () => {
|
|
3
|
+
try {
|
|
4
|
+
const result = await client.get("/ready");
|
|
5
|
+
return {
|
|
6
|
+
content: [{ type: "text", text: `Tracecat is healthy: ${JSON.stringify(result)}` }],
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
return {
|
|
11
|
+
content: [{ type: "text", text: `Tracecat health check failed: ${error}` }],
|
|
12
|
+
isError: true,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerTableTools(server, client) {
|
|
3
|
+
// --- Table metadata ---
|
|
4
|
+
server.tool("tracecat_list_tables", "List all tables in the current workspace", {}, async () => {
|
|
5
|
+
const tables = await client.get("/tables");
|
|
6
|
+
return { content: [{ type: "text", text: JSON.stringify(tables, null, 2) }] };
|
|
7
|
+
});
|
|
8
|
+
server.tool("tracecat_create_table", "Create a new table", {
|
|
9
|
+
name: z.string().describe("Table name"),
|
|
10
|
+
description: z.string().optional().describe("Table description"),
|
|
11
|
+
}, async ({ name, description }) => {
|
|
12
|
+
const result = await client.post("/tables", { name, description: description ?? "" });
|
|
13
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
14
|
+
});
|
|
15
|
+
server.tool("tracecat_get_table", "Get details of a specific table by ID (includes columns)", {
|
|
16
|
+
table_id: z.string().describe("Table ID"),
|
|
17
|
+
}, async ({ table_id }) => {
|
|
18
|
+
const table = await client.get(`/tables/${table_id}`);
|
|
19
|
+
return { content: [{ type: "text", text: JSON.stringify(table, null, 2) }] };
|
|
20
|
+
});
|
|
21
|
+
server.tool("tracecat_update_table", "Update a table's name or description", {
|
|
22
|
+
table_id: z.string().describe("Table ID"),
|
|
23
|
+
name: z.string().optional().describe("New name"),
|
|
24
|
+
description: z.string().optional().describe("New description"),
|
|
25
|
+
}, async ({ table_id, ...updates }) => {
|
|
26
|
+
const body = Object.fromEntries(Object.entries(updates).filter(([, v]) => v !== undefined));
|
|
27
|
+
const result = await client.patch(`/tables/${table_id}`, body);
|
|
28
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
29
|
+
});
|
|
30
|
+
server.tool("tracecat_delete_table", "Delete a table", {
|
|
31
|
+
table_id: z.string().describe("Table ID"),
|
|
32
|
+
}, async ({ table_id }) => {
|
|
33
|
+
const result = await client.delete(`/tables/${table_id}`);
|
|
34
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
35
|
+
});
|
|
36
|
+
// --- Table columns ---
|
|
37
|
+
server.tool("tracecat_create_column", "Create a new column in a table", {
|
|
38
|
+
table_id: z.string().describe("Table ID"),
|
|
39
|
+
name: z.string().describe("Column name"),
|
|
40
|
+
type: z.string().describe("Column type: TEXT, INTEGER, NUMERIC, DATE, BOOLEAN, TIMESTAMP, TIMESTAMPTZ, JSONB, UUID, SELECT, MULTI_SELECT"),
|
|
41
|
+
}, async ({ table_id, name, type }) => {
|
|
42
|
+
const result = await client.post(`/tables/${table_id}/columns`, { name, type });
|
|
43
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
44
|
+
});
|
|
45
|
+
server.tool("tracecat_delete_column", "Delete a column from a table", {
|
|
46
|
+
table_id: z.string().describe("Table ID"),
|
|
47
|
+
column_id: z.string().describe("Column ID"),
|
|
48
|
+
}, async ({ table_id, column_id }) => {
|
|
49
|
+
const result = await client.delete(`/tables/${table_id}/columns/${column_id}`);
|
|
50
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
51
|
+
});
|
|
52
|
+
// --- Table rows ---
|
|
53
|
+
server.tool("tracecat_list_rows", "List rows in a table with optional pagination", {
|
|
54
|
+
table_id: z.string().describe("Table ID"),
|
|
55
|
+
limit: z.number().optional().describe("Maximum number of rows to return"),
|
|
56
|
+
offset: z.number().optional().describe("Number of rows to skip"),
|
|
57
|
+
}, async ({ table_id, limit, offset }) => {
|
|
58
|
+
const params = {};
|
|
59
|
+
if (limit)
|
|
60
|
+
params.limit = limit.toString();
|
|
61
|
+
if (offset)
|
|
62
|
+
params.offset = offset.toString();
|
|
63
|
+
const rows = await client.get(`/tables/${table_id}/rows`, params);
|
|
64
|
+
return { content: [{ type: "text", text: JSON.stringify(rows, null, 2) }] };
|
|
65
|
+
});
|
|
66
|
+
server.tool("tracecat_get_row", "Get a specific row by ID from a table", {
|
|
67
|
+
table_id: z.string().describe("Table ID"),
|
|
68
|
+
row_id: z.string().describe("Row ID"),
|
|
69
|
+
}, async ({ table_id, row_id }) => {
|
|
70
|
+
const row = await client.get(`/tables/${table_id}/rows/${row_id}`);
|
|
71
|
+
return { content: [{ type: "text", text: JSON.stringify(row, null, 2) }] };
|
|
72
|
+
});
|
|
73
|
+
server.tool("tracecat_insert_row", "Insert a new row into a table. Data keys must match existing column names.", {
|
|
74
|
+
table_id: z.string().describe("Table ID"),
|
|
75
|
+
data: z.record(z.unknown()).describe("Row data as key-value pairs matching column names"),
|
|
76
|
+
}, async ({ table_id, data }) => {
|
|
77
|
+
const result = await client.post(`/tables/${table_id}/rows`, { data });
|
|
78
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
79
|
+
});
|
|
80
|
+
server.tool("tracecat_update_row", "Update an existing row in a table", {
|
|
81
|
+
table_id: z.string().describe("Table ID"),
|
|
82
|
+
row_id: z.string().describe("Row ID"),
|
|
83
|
+
data: z.record(z.unknown()).describe("Updated row data as key-value pairs"),
|
|
84
|
+
}, async ({ table_id, row_id, data }) => {
|
|
85
|
+
const result = await client.patch(`/tables/${table_id}/rows/${row_id}`, { data });
|
|
86
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
87
|
+
});
|
|
88
|
+
server.tool("tracecat_delete_row", "Delete a row from a table", {
|
|
89
|
+
table_id: z.string().describe("Table ID"),
|
|
90
|
+
row_id: z.string().describe("Row ID"),
|
|
91
|
+
}, async ({ table_id, row_id }) => {
|
|
92
|
+
const result = await client.delete(`/tables/${table_id}/rows/${row_id}`);
|
|
93
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
94
|
+
});
|
|
95
|
+
server.tool("tracecat_batch_insert_rows", "Insert multiple rows into a table at once. Each row is a flat object with keys matching column names.", {
|
|
96
|
+
table_id: z.string().describe("Table ID"),
|
|
97
|
+
rows: z.array(z.record(z.unknown())).describe("Array of row objects (flat, keys = column names)"),
|
|
98
|
+
}, async ({ table_id, rows }) => {
|
|
99
|
+
const result = await client.post(`/tables/${table_id}/rows/batch`, { rows });
|
|
100
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
101
|
+
});
|
|
102
|
+
}
|