edgegate-mcp 0.1.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/LICENSE +21 -0
- package/README.md +82 -0
- package/bin/edgegate-mcp +2 -0
- package/bin/edgegate-mcp-install +2 -0
- package/dist/client.d.ts +54 -0
- package/dist/client.js +103 -0
- package/dist/client.js.map +1 -0
- package/dist/install.d.ts +1 -0
- package/dist/install.js +118 -0
- package/dist/install.js.map +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +113 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/check_status.d.ts +15 -0
- package/dist/tools/check_status.js +48 -0
- package/dist/tools/check_status.js.map +1 -0
- package/dist/tools/create_pipeline.d.ts +68 -0
- package/dist/tools/create_pipeline.js +74 -0
- package/dist/tools/create_pipeline.js.map +1 -0
- package/dist/tools/get_audit_report.d.ts +15 -0
- package/dist/tools/get_audit_report.js +46 -0
- package/dist/tools/get_audit_report.js.map +1 -0
- package/dist/tools/get_report.d.ts +15 -0
- package/dist/tools/get_report.js +53 -0
- package/dist/tools/get_report.js.map +1 -0
- package/dist/tools/run_gate.d.ts +18 -0
- package/dist/tools/run_gate.js +48 -0
- package/dist/tools/run_gate.js.map +1 -0
- package/dist/tools/setup_github_action.d.ts +18 -0
- package/dist/tools/setup_github_action.js +69 -0
- package/dist/tools/setup_github_action.js.map +1 -0
- package/dist/tools/setup_workspace.d.ts +18 -0
- package/dist/tools/setup_workspace.js +73 -0
- package/dist/tools/setup_workspace.js.map +1 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +49 -0
- package/plugin.json +26 -0
- package/skills/edgegate-audit.md +17 -0
- package/skills/edgegate-gate.md +15 -0
- package/skills/edgegate-init.md +35 -0
- package/skills/edgegate-status.md +14 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateClient } from "../client.js";
|
|
3
|
+
import type { ToolResult } from "./setup_workspace.js";
|
|
4
|
+
export declare const createPipelineInputSchema: z.ZodObject<{
|
|
5
|
+
workspace_id: z.ZodString;
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
description: z.ZodOptional<z.ZodString>;
|
|
8
|
+
models: z.ZodArray<z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
artifact_id: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
name: string;
|
|
13
|
+
artifact_id: string;
|
|
14
|
+
}, {
|
|
15
|
+
name: string;
|
|
16
|
+
artifact_id: string;
|
|
17
|
+
}>, "many">;
|
|
18
|
+
devices: z.ZodArray<z.ZodString, "many">;
|
|
19
|
+
gates: z.ZodArray<z.ZodObject<{
|
|
20
|
+
metric: z.ZodEnum<["inference_time_ms", "peak_memory_mb", "throughput_tps"]>;
|
|
21
|
+
operator: z.ZodEnum<["<=", "<", ">=", ">", "=="]>;
|
|
22
|
+
threshold: z.ZodNumber;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
metric: "inference_time_ms" | "peak_memory_mb" | "throughput_tps";
|
|
25
|
+
operator: "<=" | "<" | ">=" | ">" | "==";
|
|
26
|
+
threshold: number;
|
|
27
|
+
}, {
|
|
28
|
+
metric: "inference_time_ms" | "peak_memory_mb" | "throughput_tps";
|
|
29
|
+
operator: "<=" | "<" | ">=" | ">" | "==";
|
|
30
|
+
threshold: number;
|
|
31
|
+
}>, "many">;
|
|
32
|
+
promptpack_id: z.ZodOptional<z.ZodString>;
|
|
33
|
+
repeats: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
workspace_id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
models: {
|
|
38
|
+
name: string;
|
|
39
|
+
artifact_id: string;
|
|
40
|
+
}[];
|
|
41
|
+
devices: string[];
|
|
42
|
+
gates: {
|
|
43
|
+
metric: "inference_time_ms" | "peak_memory_mb" | "throughput_tps";
|
|
44
|
+
operator: "<=" | "<" | ">=" | ">" | "==";
|
|
45
|
+
threshold: number;
|
|
46
|
+
}[];
|
|
47
|
+
description?: string | undefined;
|
|
48
|
+
promptpack_id?: string | undefined;
|
|
49
|
+
repeats?: number | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
workspace_id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
models: {
|
|
54
|
+
name: string;
|
|
55
|
+
artifact_id: string;
|
|
56
|
+
}[];
|
|
57
|
+
devices: string[];
|
|
58
|
+
gates: {
|
|
59
|
+
metric: "inference_time_ms" | "peak_memory_mb" | "throughput_tps";
|
|
60
|
+
operator: "<=" | "<" | ">=" | ">" | "==";
|
|
61
|
+
threshold: number;
|
|
62
|
+
}[];
|
|
63
|
+
description?: string | undefined;
|
|
64
|
+
promptpack_id?: string | undefined;
|
|
65
|
+
repeats?: number | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
export type CreatePipelineInput = z.infer<typeof createPipelineInputSchema>;
|
|
68
|
+
export declare function createPipelineHandler(client: EdgeGateClient, input: CreatePipelineInput): Promise<ToolResult>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateError } from "../client.js";
|
|
3
|
+
const MAX_CELLS = 25;
|
|
4
|
+
export const createPipelineInputSchema = z.object({
|
|
5
|
+
workspace_id: z.string().uuid(),
|
|
6
|
+
name: z.string().min(1).max(255),
|
|
7
|
+
description: z.string().optional(),
|
|
8
|
+
models: z
|
|
9
|
+
.array(z.object({ name: z.string().min(1), artifact_id: z.string().min(1) }))
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(10),
|
|
12
|
+
devices: z.array(z.string().min(1)).min(1).max(5),
|
|
13
|
+
gates: z
|
|
14
|
+
.array(z.object({
|
|
15
|
+
metric: z.enum(["inference_time_ms", "peak_memory_mb", "throughput_tps"]),
|
|
16
|
+
operator: z.enum(["<=", "<", ">=", ">", "=="]),
|
|
17
|
+
threshold: z.number().positive(),
|
|
18
|
+
}))
|
|
19
|
+
.min(1),
|
|
20
|
+
promptpack_id: z.string().uuid().optional(),
|
|
21
|
+
repeats: z.number().int().min(1).max(5).optional(),
|
|
22
|
+
});
|
|
23
|
+
export async function createPipelineHandler(client, input) {
|
|
24
|
+
const cellCount = input.models.length * input.devices.length;
|
|
25
|
+
if (cellCount > MAX_CELLS) {
|
|
26
|
+
return {
|
|
27
|
+
isError: true,
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: "text",
|
|
31
|
+
text: `${input.models.length} models × ${input.devices.length} devices = ${cellCount} cells, ` +
|
|
32
|
+
`which exceeds the per-run limit of ${MAX_CELLS}. Reduce the matrix or split ` +
|
|
33
|
+
`into multiple pipelines.`,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const pipeline = await client.createPipeline(input.workspace_id, {
|
|
40
|
+
name: input.name,
|
|
41
|
+
description: input.description,
|
|
42
|
+
models: input.models,
|
|
43
|
+
devices: input.devices,
|
|
44
|
+
gates: input.gates,
|
|
45
|
+
promptpack_id: input.promptpack_id,
|
|
46
|
+
repeats: input.repeats,
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: "text",
|
|
52
|
+
text: [
|
|
53
|
+
`Created pipeline **${pipeline.name}** (id=${pipeline.id}).`,
|
|
54
|
+
``,
|
|
55
|
+
`- ${input.models.length} model(s) × ${input.devices.length} device(s) = ${cellCount} cell(s) per run`,
|
|
56
|
+
`- ${input.gates.length} gate(s)`,
|
|
57
|
+
``,
|
|
58
|
+
`Trigger a run with \`edgegate_run_gate\`, or wire CI with \`edgegate_setup_github_action\`.`,
|
|
59
|
+
].join("\n"),
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
if (err instanceof EdgeGateError) {
|
|
66
|
+
return {
|
|
67
|
+
isError: true,
|
|
68
|
+
content: [{ type: "text", text: `Failed to create pipeline: ${err.detail}` }],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
throw err;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=create_pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_pipeline.js","sourceRoot":"","sources":["../../src/tools/create_pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7D,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAChC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,CAAC;SACN,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SAC5E,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAA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C/D,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;QACH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;wBACJ,sBAAsB,QAAQ,CAAC,IAAI,UAAU,QAAQ,CAAC,EAAE,IAAI;wBAC5D,EAAE;wBACF,KAAK,KAAK,CAAC,MAAM,CAAC,MAAM,eAAe,KAAK,CAAC,OAAO,CAAC,MAAM,gBAAgB,SAAS,kBAAkB;wBACtG,KAAK,KAAK,CAAC,KAAK,CAAC,MAAM,UAAU;wBACjC,EAAE;wBACF,6FAA6F;qBAC9F,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,aAAa,EAAE,CAAC;YACjC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;aAC9E,CAAC;QACJ,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateClient } from "../client.js";
|
|
3
|
+
import type { ToolResult } from "./setup_workspace.js";
|
|
4
|
+
export declare const getAuditReportInputSchema: z.ZodObject<{
|
|
5
|
+
workspace_id: z.ZodString;
|
|
6
|
+
run_id: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
workspace_id: string;
|
|
9
|
+
run_id: string;
|
|
10
|
+
}, {
|
|
11
|
+
workspace_id: string;
|
|
12
|
+
run_id: string;
|
|
13
|
+
}>;
|
|
14
|
+
export type GetAuditReportInput = z.infer<typeof getAuditReportInputSchema>;
|
|
15
|
+
export declare function getAuditReportHandler(client: EdgeGateClient, input: GetAuditReportInput): Promise<ToolResult>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateError } from "../client.js";
|
|
3
|
+
export const getAuditReportInputSchema = z.object({
|
|
4
|
+
workspace_id: z.string().uuid(),
|
|
5
|
+
run_id: z.string().uuid(),
|
|
6
|
+
});
|
|
7
|
+
export async function getAuditReportHandler(client, input) {
|
|
8
|
+
try {
|
|
9
|
+
const report = await client.getAuditReport(input.workspace_id, input.run_id);
|
|
10
|
+
return {
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
type: "text",
|
|
14
|
+
text: [
|
|
15
|
+
`Audit report for run ${input.run_id}:`,
|
|
16
|
+
``,
|
|
17
|
+
`Download URL: ${report.url}`,
|
|
18
|
+
`Generated: ${report.generated_at}`,
|
|
19
|
+
``,
|
|
20
|
+
`The URL is signed and time-limited (typically 1h). The PDF contains ` +
|
|
21
|
+
`the signed evidence bundle hash, device fingerprints, and gate decisions — ` +
|
|
22
|
+
`keep it with your compliance records.`,
|
|
23
|
+
].join("\n"),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
if (err instanceof EdgeGateError) {
|
|
30
|
+
return {
|
|
31
|
+
isError: true,
|
|
32
|
+
content: [
|
|
33
|
+
{
|
|
34
|
+
type: "text",
|
|
35
|
+
text: err.status === 404
|
|
36
|
+
? `No audit report for run ${input.run_id} yet. Reports are generated ` +
|
|
37
|
+
`asynchronously after the run completes — try again in 1-2 minutes.`
|
|
38
|
+
: `EdgeGate returned ${err.status}: ${err.detail}`,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=get_audit_report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_audit_report.js","sourceRoot":"","sources":["../../src/tools/get_audit_report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7D,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;CAC1B,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAsB,EACtB,KAA0B;IAE1B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7E,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;wBACJ,wBAAwB,KAAK,CAAC,MAAM,GAAG;wBACvC,EAAE;wBACF,iBAAiB,MAAM,CAAC,GAAG,EAAE;wBAC7B,cAAc,MAAM,CAAC,YAAY,EAAE;wBACnC,EAAE;wBACF,sEAAsE;4BACpE,6EAA6E;4BAC7E,uCAAuC;qBAC1C,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,aAAa,EAAE,CAAC;YACjC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EACF,GAAG,CAAC,MAAM,KAAK,GAAG;4BAChB,CAAC,CAAC,2BAA2B,KAAK,CAAC,MAAM,8BAA8B;gCACrE,oEAAoE;4BACtE,CAAC,CAAC,qBAAqB,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE;qBACvD;iBACF;aACF,CAAC;QACJ,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateClient } from "../client.js";
|
|
3
|
+
import type { ToolResult } from "./setup_workspace.js";
|
|
4
|
+
export declare const getReportInputSchema: z.ZodObject<{
|
|
5
|
+
workspace_id: z.ZodString;
|
|
6
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
workspace_id: string;
|
|
9
|
+
limit: number;
|
|
10
|
+
}, {
|
|
11
|
+
workspace_id: string;
|
|
12
|
+
limit?: number | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export type GetReportInput = z.infer<typeof getReportInputSchema>;
|
|
15
|
+
export declare function getReportHandler(client: EdgeGateClient, input: GetReportInput): Promise<ToolResult>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateError } from "../client.js";
|
|
3
|
+
export const getReportInputSchema = z.object({
|
|
4
|
+
workspace_id: z.string().uuid(),
|
|
5
|
+
limit: z.number().int().min(1).max(50).default(10),
|
|
6
|
+
});
|
|
7
|
+
export async function getReportHandler(client, input) {
|
|
8
|
+
try {
|
|
9
|
+
const runs = await client.listRuns(input.workspace_id, input.limit);
|
|
10
|
+
if (runs.length === 0) {
|
|
11
|
+
return {
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
type: "text",
|
|
15
|
+
text: "No runs in this workspace yet. Trigger one with `edgegate_run_gate`.",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const rows = runs
|
|
21
|
+
.map((r) => {
|
|
22
|
+
const dur = r.started_at && r.completed_at
|
|
23
|
+
? `${Math.round((new Date(r.completed_at).getTime() - new Date(r.started_at).getTime()) / 1000)}s`
|
|
24
|
+
: "-";
|
|
25
|
+
return `| ${r.id} | ${r.status} | ${r.trigger} | ${dur} | ${r.started_at ?? "-"} |`;
|
|
26
|
+
})
|
|
27
|
+
.join("\n");
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: "text",
|
|
32
|
+
text: [
|
|
33
|
+
`Last ${runs.length} run(s):`,
|
|
34
|
+
``,
|
|
35
|
+
`| run_id | status | trigger | duration | started_at |`,
|
|
36
|
+
`|---|---|---|---|---|`,
|
|
37
|
+
rows,
|
|
38
|
+
].join("\n"),
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
if (err instanceof EdgeGateError) {
|
|
45
|
+
return {
|
|
46
|
+
isError: true,
|
|
47
|
+
content: [{ type: "text", text: `EdgeGate returned ${err.status}: ${err.detail}` }],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=get_report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_report.js","sourceRoot":"","sources":["../../src/tools/get_report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B,KAAK,EAAE,CAAC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;wBACvD,uBAAuB;wBACvB,IAAI;qBACL,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,aAAa,EAAE,CAAC;YACjC,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;aACpF,CAAC;QACJ,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateClient } from "../client.js";
|
|
3
|
+
import type { ToolResult } from "./setup_workspace.js";
|
|
4
|
+
export declare const runGateInputSchema: z.ZodObject<{
|
|
5
|
+
workspace_id: z.ZodString;
|
|
6
|
+
pipeline_id: z.ZodString;
|
|
7
|
+
model_artifact_id: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
workspace_id: string;
|
|
10
|
+
pipeline_id: string;
|
|
11
|
+
model_artifact_id?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
workspace_id: string;
|
|
14
|
+
pipeline_id: string;
|
|
15
|
+
model_artifact_id?: string | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type RunGateInput = z.infer<typeof runGateInputSchema>;
|
|
18
|
+
export declare function runGateHandler(client: EdgeGateClient, input: RunGateInput): Promise<ToolResult>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateError } from "../client.js";
|
|
3
|
+
export const runGateInputSchema = z.object({
|
|
4
|
+
workspace_id: z.string().uuid(),
|
|
5
|
+
pipeline_id: z.string().uuid(),
|
|
6
|
+
model_artifact_id: z.string().uuid().optional(),
|
|
7
|
+
});
|
|
8
|
+
export async function runGateHandler(client, input) {
|
|
9
|
+
try {
|
|
10
|
+
const run = await client.triggerRun(input.workspace_id, input.pipeline_id, {
|
|
11
|
+
trigger: "mcp",
|
|
12
|
+
model_artifact_id: input.model_artifact_id,
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
content: [
|
|
16
|
+
{
|
|
17
|
+
type: "text",
|
|
18
|
+
text: [
|
|
19
|
+
`Triggered run **${run.id}** on pipeline ${input.pipeline_id}.`,
|
|
20
|
+
``,
|
|
21
|
+
`Poll status with:`,
|
|
22
|
+
` \`edgegate_check_status({ workspace_id: "${input.workspace_id}", run_id: "${run.id}" })\``,
|
|
23
|
+
``,
|
|
24
|
+
`Typical end-to-end time: 3-5 minutes per device.`,
|
|
25
|
+
].join("\n"),
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
if (err instanceof EdgeGateError) {
|
|
32
|
+
return {
|
|
33
|
+
isError: true,
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: "text",
|
|
37
|
+
text: err.status === 409
|
|
38
|
+
? `Another run is in flight in this workspace. EdgeGate enforces ` +
|
|
39
|
+
`workspace_concurrency=1. Wait for it to finish, then retry.`
|
|
40
|
+
: `Failed to trigger run: ${err.detail}`,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=run_gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run_gate.js","sourceRoot":"","sources":["../../src/tools/run_gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7D,MAAM,CAAC,MAAM,kBAAkB,GAAG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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateClient } from "../client.js";
|
|
3
|
+
import type { ToolResult } from "./setup_workspace.js";
|
|
4
|
+
export declare const setupGithubActionInputSchema: z.ZodObject<{
|
|
5
|
+
workspace_id: z.ZodString;
|
|
6
|
+
pipeline_id: z.ZodOptional<z.ZodString>;
|
|
7
|
+
model_artifact_id: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
workspace_id: string;
|
|
10
|
+
pipeline_id?: string | undefined;
|
|
11
|
+
model_artifact_id?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
workspace_id: string;
|
|
14
|
+
pipeline_id?: string | undefined;
|
|
15
|
+
model_artifact_id?: string | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type SetupGithubActionInput = z.infer<typeof setupGithubActionInputSchema>;
|
|
18
|
+
export declare function setupGithubActionHandler(client: EdgeGateClient, input: SetupGithubActionInput): Promise<ToolResult>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateError } from "../client.js";
|
|
3
|
+
export const setupGithubActionInputSchema = z.object({
|
|
4
|
+
workspace_id: z.string().uuid(),
|
|
5
|
+
pipeline_id: z.string().uuid().optional(),
|
|
6
|
+
model_artifact_id: z.string().uuid().optional(),
|
|
7
|
+
});
|
|
8
|
+
export async function setupGithubActionHandler(client, input) {
|
|
9
|
+
try {
|
|
10
|
+
const tmpl = await client.getWorkflowTemplate(input.workspace_id);
|
|
11
|
+
const ghCommands = buildGhCommands({
|
|
12
|
+
workspace_id: input.workspace_id,
|
|
13
|
+
pipeline_id: input.pipeline_id,
|
|
14
|
+
model_artifact_id: input.model_artifact_id,
|
|
15
|
+
});
|
|
16
|
+
const text = [
|
|
17
|
+
`## EdgeGate GitHub Action setup`,
|
|
18
|
+
``,
|
|
19
|
+
`**Step 1.** Write this workflow to your repo:`,
|
|
20
|
+
``,
|
|
21
|
+
"```yaml",
|
|
22
|
+
`# .github/workflows/edgegate.yml`,
|
|
23
|
+
tmpl.workflow_yaml.trimEnd(),
|
|
24
|
+
"```",
|
|
25
|
+
``,
|
|
26
|
+
`**Step 2.** From the repo root, run these \`gh\` CLI commands to set the secrets:`,
|
|
27
|
+
``,
|
|
28
|
+
"```bash",
|
|
29
|
+
ghCommands,
|
|
30
|
+
"```",
|
|
31
|
+
``,
|
|
32
|
+
`**Step 3.** Need an API_SECRET? Generate one in the EdgeGate dashboard:`,
|
|
33
|
+
`https://edgegate.frozo.ai/workspace/${input.workspace_id}/settings#integrations`,
|
|
34
|
+
``,
|
|
35
|
+
`Once committed and pushed, every PR to \`main\` will trigger an EdgeGate run ` +
|
|
36
|
+
`and post the results back as a PR comment.`,
|
|
37
|
+
].join("\n");
|
|
38
|
+
return { content: [{ type: "text", text }] };
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
if (err instanceof EdgeGateError) {
|
|
42
|
+
return {
|
|
43
|
+
isError: true,
|
|
44
|
+
content: [{ type: "text", text: `Failed to fetch workflow template: ${err.detail}` }],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
throw err;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function buildGhCommands(args) {
|
|
51
|
+
const lines = [
|
|
52
|
+
`gh secret set EDGEGATE_WORKSPACE_ID --body "${args.workspace_id}"`,
|
|
53
|
+
`gh secret set EDGEGATE_API_SECRET --body "<paste-secret-from-dashboard>"`,
|
|
54
|
+
];
|
|
55
|
+
if (args.pipeline_id) {
|
|
56
|
+
lines.push(`gh secret set EDGEGATE_PIPELINE_ID --body "${args.pipeline_id}"`);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
lines.push(`# Optional: gh secret set EDGEGATE_PIPELINE_ID --body "<pipeline-uuid>"`);
|
|
60
|
+
}
|
|
61
|
+
if (args.model_artifact_id) {
|
|
62
|
+
lines.push(`gh secret set EDGEGATE_MODEL_ARTIFACT_ID --body "${args.model_artifact_id}"`);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
lines.push(`# Optional: gh secret set EDGEGATE_MODEL_ARTIFACT_ID --body "<artifact-uuid>"`);
|
|
66
|
+
}
|
|
67
|
+
return lines.join("\n");
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=setup_github_action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup_github_action.js","sourceRoot":"","sources":["../../src/tools/setup_github_action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IACzC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAsB,EACtB,KAA6B;IAE7B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAClE,MAAM,UAAU,GAAG,eAAe,CAAC;YACjC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;SAC3C,CAAC,CAAC;QACH,MAAM,IAAI,GAAG;YACX,iCAAiC;YACjC,EAAE;YACF,+CAA+C;YAC/C,EAAE;YACF,SAAS;YACT,kCAAkC;YAClC,IAAI,CAAC,aA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AAC1B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateClient } from "../client.js";
|
|
3
|
+
export declare const setupWorkspaceInputSchema: z.ZodObject<{
|
|
4
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
workspace_id?: string | undefined;
|
|
7
|
+
}, {
|
|
8
|
+
workspace_id?: string | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
export type SetupWorkspaceInput = z.infer<typeof setupWorkspaceInputSchema>;
|
|
11
|
+
export interface ToolResult {
|
|
12
|
+
content: Array<{
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
}>;
|
|
16
|
+
isError?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function setupWorkspaceHandler(client: EdgeGateClient, input: SetupWorkspaceInput): Promise<ToolResult>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { EdgeGateError } from "../client.js";
|
|
3
|
+
export const setupWorkspaceInputSchema = z.object({
|
|
4
|
+
workspace_id: z
|
|
5
|
+
.string()
|
|
6
|
+
.uuid()
|
|
7
|
+
.optional()
|
|
8
|
+
.describe("Optional UUID. If omitted, lists all visible workspaces."),
|
|
9
|
+
});
|
|
10
|
+
export async function setupWorkspaceHandler(client, input) {
|
|
11
|
+
try {
|
|
12
|
+
if (input.workspace_id) {
|
|
13
|
+
const ws = await client.getWorkspace(input.workspace_id);
|
|
14
|
+
return { content: [{ type: "text", text: formatSingle(ws) }] };
|
|
15
|
+
}
|
|
16
|
+
const list = await client.listWorkspaces();
|
|
17
|
+
if (list.length === 0) {
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: "text",
|
|
22
|
+
text: "No workspaces visible to this API key. The key may have been revoked, " +
|
|
23
|
+
"or it was scoped to a deleted workspace. Generate a new one at " +
|
|
24
|
+
"https://edgegate.frozo.ai/workspace/<id>/settings#api-keys.",
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return { content: [{ type: "text", text: formatList(list) }] };
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
if (err instanceof EdgeGateError) {
|
|
33
|
+
return {
|
|
34
|
+
isError: true,
|
|
35
|
+
content: [
|
|
36
|
+
{
|
|
37
|
+
type: "text",
|
|
38
|
+
text: err.status === 401
|
|
39
|
+
? "EDGEGATE_API_KEY is missing, expired, or revoked. Generate a fresh key at " +
|
|
40
|
+
"https://edgegate.frozo.ai/workspace/<id>/settings#api-keys and retry."
|
|
41
|
+
: `EdgeGate returned ${err.status}: ${err.detail}`,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function planLabel(plan) {
|
|
50
|
+
return plan ? plan : "(unknown)";
|
|
51
|
+
}
|
|
52
|
+
function formatSingle(ws) {
|
|
53
|
+
return [
|
|
54
|
+
`Active workspace: **${ws.name}**`,
|
|
55
|
+
`- ID: ${ws.id}`,
|
|
56
|
+
`- Plan: ${planLabel(ws.plan)}`,
|
|
57
|
+
``,
|
|
58
|
+
`You can now use this workspace_id in the other EdgeGate MCP tools.`,
|
|
59
|
+
].join("\n");
|
|
60
|
+
}
|
|
61
|
+
function formatList(list) {
|
|
62
|
+
const rows = list
|
|
63
|
+
.map((w) => `- **${w.name}** (id=${w.id}, plan=${planLabel(w.plan)})`)
|
|
64
|
+
.join("\n");
|
|
65
|
+
return [
|
|
66
|
+
`Found ${list.length} workspace(s):`,
|
|
67
|
+
``,
|
|
68
|
+
rows,
|
|
69
|
+
``,
|
|
70
|
+
`Pick one and pass its id back as \`workspace_id\` to lock it in.`,
|
|
71
|
+
].join("\n");
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=setup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|
+
/** Owner UUID — may be omitted by the API depending on response shape. */
|
|
6
|
+
owner_id?: UUID;
|
|
7
|
+
/** Calling user's plan tier; null/undefined when the API hasn't been
|
|
8
|
+
* updated to include it. The MCP tool renders "(unknown)" in that case. */
|
|
9
|
+
plan?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface Pipeline {
|
|
12
|
+
id: UUID;
|
|
13
|
+
workspace_id: UUID;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string | null;
|
|
16
|
+
status: "active" | "paused";
|
|
17
|
+
pipeline_yaml: string;
|
|
18
|
+
created_at: string;
|
|
19
|
+
}
|
|
20
|
+
export interface Gate {
|
|
21
|
+
metric: string;
|
|
22
|
+
operator: "<=" | "<" | ">=" | ">" | "==";
|
|
23
|
+
threshold: number;
|
|
24
|
+
}
|
|
25
|
+
export interface RunSummary {
|
|
26
|
+
id: UUID;
|
|
27
|
+
workspace_id: UUID;
|
|
28
|
+
pipeline_id: UUID;
|
|
29
|
+
status: "pending" | "running" | "passed" | "failed" | "error";
|
|
30
|
+
started_at: string | null;
|
|
31
|
+
completed_at: string | null;
|
|
32
|
+
trigger: string;
|
|
33
|
+
}
|
|
34
|
+
export interface RunCell {
|
|
35
|
+
model_artifact_id: UUID;
|
|
36
|
+
device_name: string;
|
|
37
|
+
metrics: Record<string, number>;
|
|
38
|
+
gate_results: Array<{
|
|
39
|
+
metric: string;
|
|
40
|
+
passed: boolean;
|
|
41
|
+
threshold: number;
|
|
42
|
+
actual: number;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
export interface RunDetail extends RunSummary {
|
|
46
|
+
cells: RunCell[];
|
|
47
|
+
evidence_bundle_url: string | null;
|
|
48
|
+
}
|
|
49
|
+
export interface APIKeyCreateResponse {
|
|
50
|
+
id: UUID;
|
|
51
|
+
plaintext: string;
|
|
52
|
+
name: string;
|
|
53
|
+
prefix: string;
|
|
54
|
+
suffix: string;
|
|
55
|
+
}
|
|
56
|
+
export interface WorkflowTemplate {
|
|
57
|
+
workflow_yaml: string;
|
|
58
|
+
api_url: string;
|
|
59
|
+
secret_names: string[];
|
|
60
|
+
}
|
|
61
|
+
export interface AuditReport {
|
|
62
|
+
url: string;
|
|
63
|
+
generated_at: string;
|
|
64
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,OAAO,EAAE,CAAC"}
|