edgegate-mcp 0.9.1 → 0.11.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.
@@ -0,0 +1,111 @@
1
+ import { z } from "zod";
2
+ import { EdgeGateError } from "../client.js";
3
+ export const llmCompileInputSchema = z.object({
4
+ workspace_id: z.string().uuid(),
5
+ /**
6
+ * Pre-uploaded source artifacts (1 per component). Typical Llama-class:
7
+ * 3 artifacts (prompt + token + kv_cache). For other architectures pass
8
+ * M artifacts matching the number of components.
9
+ */
10
+ source_artifact_ids: z.array(z.string().uuid()).min(1).max(8),
11
+ /** AI Hub device id (e.g. "x_elite", "x2_elite", "sa8295p"). */
12
+ device_id: z.string().min(1),
13
+ /**
14
+ * Label only — backend always compiles to QNN_DLC under the hood. The
15
+ * label is used downstream for profile dispatch hints.
16
+ */
17
+ target_runtime: z.string().min(1).default("genie"),
18
+ /** Default [128, 1] — typical prompt/token split for Llama-class. */
19
+ sequence_lengths: z.array(z.number().int().positive()).default([128, 1]),
20
+ /** Default [4096]. */
21
+ context_lengths: z.array(z.number().int().positive()).default([4096]),
22
+ /**
23
+ * Per-component role labels (e.g. ["prompt", "token", "kv_cache"]).
24
+ * Required when source_artifact_ids has >1 entry — the AI Hub SDK
25
+ * mandates graph_names for multi-component compiles.
26
+ */
27
+ roles: z.array(z.string().min(1)).optional(),
28
+ });
29
+ export async function llmCompileHandler(client, input) {
30
+ // Client-side guard: roles required when multi-component. Surface the
31
+ // same constraint the backend enforces so the agent gets a clean error
32
+ // without a network round-trip.
33
+ if (input.source_artifact_ids.length > 1 && (!input.roles || input.roles.length === 0)) {
34
+ return {
35
+ isError: true,
36
+ content: [
37
+ {
38
+ type: "text",
39
+ text: `'roles' is required when source_artifact_ids has more than 1 entry ` +
40
+ `(the AI Hub SDK requires graph_names for multi-component compiles). ` +
41
+ `Typical Llama-class: roles=["prompt", "token", "kv_cache"].`,
42
+ },
43
+ ],
44
+ };
45
+ }
46
+ if (input.roles && input.roles.length !== input.source_artifact_ids.length) {
47
+ return {
48
+ isError: true,
49
+ content: [
50
+ {
51
+ type: "text",
52
+ text: `'roles' length (${input.roles.length}) must match source_artifact_ids ` +
53
+ `length (${input.source_artifact_ids.length}).`,
54
+ },
55
+ ],
56
+ };
57
+ }
58
+ try {
59
+ const job = await client.submitLLMCompile(input.workspace_id, {
60
+ source_artifact_ids: input.source_artifact_ids,
61
+ device_id: input.device_id,
62
+ target_runtime: input.target_runtime,
63
+ sequence_lengths: input.sequence_lengths,
64
+ context_lengths: input.context_lengths,
65
+ ...(input.roles !== undefined ? { roles: input.roles } : {}),
66
+ });
67
+ return {
68
+ content: [
69
+ {
70
+ type: "text",
71
+ text: [
72
+ `LLM compile job submitted.`,
73
+ ``,
74
+ `- compile_job_id: ${job.compile_job_id}`,
75
+ `- status: ${job.status}`,
76
+ `- components: ${input.source_artifact_ids.length}`,
77
+ `- device: ${input.device_id}`,
78
+ `- target_runtime: ${input.target_runtime} (compiled to QNN_DLC under the hood)`,
79
+ ``,
80
+ `Poll status with:`,
81
+ ` edgegate_check_llm_compile_status({ workspace_id: "${input.workspace_id}", compile_job_id: "${job.compile_job_id}" })`,
82
+ ``,
83
+ `When status=completed, composite_artifact_id is the QNN_DLC linked model ready to use in a pipeline.`,
84
+ ].join("\n"),
85
+ },
86
+ ],
87
+ };
88
+ }
89
+ catch (err) {
90
+ if (err instanceof EdgeGateError) {
91
+ return {
92
+ isError: true,
93
+ content: [
94
+ {
95
+ type: "text",
96
+ text: err.status === 402
97
+ ? `Your workspace has hit its monthly LLM compile cap (default 100/mo on Pro). ` +
98
+ `Upgrade at https://edgegate.frozo.ai/pricing or wait until next billing cycle.\n\n` +
99
+ `Detail: ${err.detail}`
100
+ : err.status === 401
101
+ ? "EDGEGATE_API_KEY is missing, expired, or revoked. Generate a fresh key at " +
102
+ "https://edgegate.frozo.ai/workspace/<id>/settings#api-keys and retry."
103
+ : `EdgeGate returned ${err.status}: ${err.detail}`,
104
+ },
105
+ ],
106
+ };
107
+ }
108
+ throw err;
109
+ }
110
+ }
111
+ //# sourceMappingURL=llm_compile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"llm_compile.js","sourceRoot":"","sources":["../../src/tools/llm_compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,gEAAgE;IAChE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B;;;OAGG;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAClD,qEAAqE;IACrE,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACxE,sBAAsB;IACtB,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;IACrE;;;;OAIG;IACH,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAA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CAAC,CAAC,EAAE,CAAC;SAC7D,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;wBACJ,4BAA4B;wBAC5B,EAAE;wBACF,qBAAqB,GAAG,CAAC,cAAc,EAAE;wBACzC,aAAa,GAAG,CAAC,MAAM,EAAE;wBACzB,iBAAiB,KAAK,CAAC,mBAAmB,CAAC,MAAM,EAAE;wBACnD,aAAa,KAAK,CAAC,SAAS,EAAE;wBAC9B,qBAAqB,KAAK,CAAC,cAAc,uCAAuC;wBAChF,EAAE;wBACF,mBAAmB;wBACnB,wDAAwD,KAAK,CAAC,YAAY,uBAAuB,GAAG,CAAC,cAAc,MAAM;wBACzH,EAAE;wBACF,sGAAsG;qBACvG,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,8EAA8E;gCAC9E,oFAAoF;gCACpF,WAAW,GAAG,CAAC,MAAM,EAAE;4BACzB,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG;gCAClB,CAAC,CAAC,4EAA4E;oCAC5E,uEAAuE;gCACzE,CAAC,CAAC,qBAAqB,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE;qBACzD;iBACF;aACF,CAAC;QACJ,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -115,7 +115,12 @@ function successText(grant) {
115
115
  text: [
116
116
  `Registered BYO storage grant for this workspace.`,
117
117
  ``,
118
- `- role: \`${roleArnTail(grant.role_arn)}\``,
118
+ // role_arn can be null on pending_role grants, but the
119
+ // register_byo_bucket tool requires role_arn in its input — so
120
+ // a successful response from this tool's endpoint always has a
121
+ // populated role_arn. Fall through to a safe default so the
122
+ // type system is satisfied for the null-tolerant ByoGrant shape.
123
+ `- role: \`${roleArnTail(grant.role_arn ?? "(not attached)")}\``,
119
124
  `- bucket: \`${grant.bucket}\` (${grant.region})`,
120
125
  grant.kms_key_id
121
126
  ? `- kms key: \`${grant.kms_key_id}\``
@@ -1 +1 @@
1
- {"version":3,"file":"register_byo_bucket.js","sourceRoot":"","sources":["../../src/tools/register_byo_bucket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,KAAK,CAAC,gCAAgC,CAAC;SACvC,QAAQ,CACP,0EAA0E;QACxE,0EAA0E;QAC1E,mEAAmE,CACtE;IACH,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,KAAK,CAAC,8BAA8B,CAAC;SACrC,QAAQ,CAAC,sDAAsD,CAAC;IACnE,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,CAAC,iDAAiD,CAAC;IAC9D,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,EAAE;SACV,QAAQ,CACP,qEAAqE;QACnE,+BAA+B,CAClC;CACJ,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAAsB,EACtB,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BAAoB,KAAK,CAAC,WAAW,IAAI;oBACzC,EAAE;oBACF,sEAAsE;wBACpE,gFAAgF;wBAChF,+DAA+D;oBACjE,EAAE;oBACF,KAAK,CAAC,MAAM,KAAK,QAAQ;wBACvB,CAAC,CAAC,wEAAwE;4BACxE,0CAA0C;wBAC5C,CAAC,CAAC,KAAK,CAAC,iBAAiB;4BACvB,CAAC,CAAC,iCAAiC,KAAK,CAAC,iBAAiB,cAAc;gCACtE,mDAAmD;gCACnD,gCAAgC;4BAClC,CAAC,CAAC,sEAAsE;iBAC7E,CAAC,IAAI,CAAC,IAAI,CAAC;aACb;SACF;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"register_byo_bucket.js","sourceRoot":"","sources":["../../src/tools/register_byo_bucket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC/B,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,KAAK,CAAC,gCAAgC,CAAC;SACvC,QAAQ,CACP,0EAA0E;QACxE,0EAA0E;QAC1E,mEAAmE,CACtE;IACH,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,KAAK,CAAC,8BAA8B,CAAC;SACrC,QAAQ,CAAC,sDAAsD,CAAC;IACnE,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,CAAC,iDAAiD,CAAC;IAC9D,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,EA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AC,IAAI;oBAChE,eAAe,KAAK,CAAC,MAAM,OAAO,KAAK,CAAC,MAAM,GAAG;oBACjD,KAAK,CAAC,UAAU;wBACd,CAAC,CAAC,gBAAgB,KAAK,CAAC,UAAU,IAAI;wBACtC,CAAC,CAAC,6CAA6C;oBACjD,eAAe,KAAK,CAAC,MAAM,IAAI;oBAC/B,oBAAoB,KAAK,CAAC,WAAW,IAAI;oBACzC,EAAE;oBACF,sEAAsE;wBACpE,gFAAgF;wBAChF,+DAA+D;oBACjE,EAAE;oBACF,KAAK,CAAC,MAAM,KAAK,QAAQ;wBACvB,CAAC,CAAC,wEAAwE;4BACxE,0CAA0C;wBAC5C,CAAC,CAAC,KAAK,CAAC,iBAAiB;4BACvB,CAAC,CAAC,iCAAiC,KAAK,CAAC,iBAAiB,cAAc;gCACtE,mDAAmD;gCACnD,gCAAgC;4BAClC,CAAC,CAAC,sEAAsE;iBAC7E,CAAC,IAAI,CAAC,IAAI,CAAC;aACb;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * edgegate_setup_byo_storage — zero-friction BYO setup orchestrator.
3
+ *
4
+ * Why this tool exists: the dashboard wizard's CloudFormation deep link
5
+ * silently fails when the template isn't S3-hosted (an AWS console
6
+ * limitation), and the Guided Steps walkthrough still asks the customer to
7
+ * click through the IAM console. An MCP-aware agent with shell access can
8
+ * do the entire flow autonomously — this tool registers a pending grant
9
+ * with EdgeGate (so the agent has the right External ID + EdgeGate
10
+ * principal ARN), then returns the exact AWS CLI commands the agent should
11
+ * run to create the role, plus a follow-up instruction to call
12
+ * edgegate_attach_byo_role with the resulting ARN.
13
+ *
14
+ * Design choice: we return INSTRUCTIONS rather than executing AWS calls
15
+ * from inside the MCP server. Two reasons:
16
+ * 1. Transparency — the user sees every AWS command the agent runs;
17
+ * they can intervene if something looks off.
18
+ * 2. Footprint — the MCP package stays small (no aws-sdk dependency).
19
+ * The user's local AWS CLI is already configured; we use it.
20
+ */
21
+ import { z } from "zod";
22
+ import { EdgeGateClient } from "../client.js";
23
+ import type { ToolResult } from "./setup_workspace.js";
24
+ export declare const setupByoStorageInputSchema: z.ZodObject<{
25
+ workspace_id: z.ZodString;
26
+ bucket: z.ZodString;
27
+ region: z.ZodString;
28
+ kms_key_id: z.ZodOptional<z.ZodString>;
29
+ role_name_override: z.ZodOptional<z.ZodString>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ workspace_id: string;
32
+ bucket: string;
33
+ region: string;
34
+ kms_key_id?: string | undefined;
35
+ role_name_override?: string | undefined;
36
+ }, {
37
+ workspace_id: string;
38
+ bucket: string;
39
+ region: string;
40
+ kms_key_id?: string | undefined;
41
+ role_name_override?: string | undefined;
42
+ }>;
43
+ export type SetupByoStorageInput = z.infer<typeof setupByoStorageInputSchema>;
44
+ export declare function setupByoStorageHandler(client: EdgeGateClient, input: SetupByoStorageInput): Promise<ToolResult>;
@@ -0,0 +1,247 @@
1
+ /**
2
+ * edgegate_setup_byo_storage — zero-friction BYO setup orchestrator.
3
+ *
4
+ * Why this tool exists: the dashboard wizard's CloudFormation deep link
5
+ * silently fails when the template isn't S3-hosted (an AWS console
6
+ * limitation), and the Guided Steps walkthrough still asks the customer to
7
+ * click through the IAM console. An MCP-aware agent with shell access can
8
+ * do the entire flow autonomously — this tool registers a pending grant
9
+ * with EdgeGate (so the agent has the right External ID + EdgeGate
10
+ * principal ARN), then returns the exact AWS CLI commands the agent should
11
+ * run to create the role, plus a follow-up instruction to call
12
+ * edgegate_attach_byo_role with the resulting ARN.
13
+ *
14
+ * Design choice: we return INSTRUCTIONS rather than executing AWS calls
15
+ * from inside the MCP server. Two reasons:
16
+ * 1. Transparency — the user sees every AWS command the agent runs;
17
+ * they can intervene if something looks off.
18
+ * 2. Footprint — the MCP package stays small (no aws-sdk dependency).
19
+ * The user's local AWS CLI is already configured; we use it.
20
+ */
21
+ import { z } from "zod";
22
+ import { EdgeGateError } from "../client.js";
23
+ export const setupByoStorageInputSchema = z.object({
24
+ workspace_id: z
25
+ .string()
26
+ .uuid()
27
+ .describe("Workspace ID. Must be Enterprise-tier with BYO storage enabled."),
28
+ bucket: z
29
+ .string()
30
+ .min(3)
31
+ .max(255)
32
+ .regex(/^[a-z0-9][a-z0-9\-.]{1,253}$/)
33
+ .describe("S3 bucket name (not the URI) you want EdgeGate to read model bytes from."),
34
+ region: z
35
+ .string()
36
+ .min(4)
37
+ .max(64)
38
+ .describe("AWS region the bucket lives in, e.g. us-east-1."),
39
+ kms_key_id: z
40
+ .string()
41
+ .max(2048)
42
+ .optional()
43
+ .describe("Optional KMS key ARN if the bucket uses SSE-KMS with a customer-managed key. " +
44
+ "The IAM role will be granted kms:Decrypt on this key. " +
45
+ "Leave unset for SSE-S3 or SSE-KMS with the AWS-managed key."),
46
+ role_name_override: z
47
+ .string()
48
+ .max(64)
49
+ .optional()
50
+ .describe("Optional override for the IAM role name. Default mirrors the CloudFormation " +
51
+ "path: edgegate-byo-read-<first-8-chars-of-external-id>."),
52
+ });
53
+ export async function setupByoStorageHandler(client, input) {
54
+ try {
55
+ // 1. Fetch the EdgeGate principal ARN — fail loudly if the deployment
56
+ // isn't configured. Templates would contain placeholder strings
57
+ // that AWS would reject, so it's better to surface the operator-side
58
+ // misconfiguration here than create a broken role.
59
+ const setupInfo = await client.getByoSetupInfo(input.workspace_id);
60
+ if (setupInfo.edgegate_aws_account_id.includes("<")) {
61
+ return errorText("This EdgeGate deployment isn't fully configured for BYO storage — " +
62
+ "BYO_EDGEGATE_AWS_ACCOUNT_ID is missing on the operator side. Setup " +
63
+ "cannot proceed until the EdgeGate operator sets that env var. " +
64
+ "Contact support@edgegate.ai.");
65
+ }
66
+ // 2. Register the pending grant (no role_arn yet). If a grant already
67
+ // exists in pending_role, re-use it; in active/failed, instruct the
68
+ // customer to disconnect first (we don't auto-rotate).
69
+ let grant;
70
+ try {
71
+ grant = await client.registerByoPendingGrant(input.workspace_id, {
72
+ bucket: input.bucket,
73
+ region: input.region,
74
+ kms_key_id: input.kms_key_id,
75
+ });
76
+ }
77
+ catch (err) {
78
+ if (err instanceof EdgeGateError && err.status === 409) {
79
+ // The 409 path: either a pending_role grant exists (which we re-use
80
+ // by GET-ing it), or an active/failed grant exists (which the
81
+ // customer must explicitly disconnect first). The GET tells us which.
82
+ const existing = await client.getByoGrant(input.workspace_id);
83
+ if (existing.status === "pending_role") {
84
+ grant = existing;
85
+ }
86
+ else {
87
+ return errorText(`This workspace already has a BYO grant in status "${existing.status}". ` +
88
+ `Setup is for new grants. Two safe paths:\n` +
89
+ `1. If the existing grant is the one you want, call edgegate_check_byo_bucket to re-verify it.\n` +
90
+ `2. If you want to replace it, call edgegate_disconnect_byo_bucket first (will 409 if artifacts still reference it), then re-run this tool.`);
91
+ }
92
+ }
93
+ else if (err instanceof EdgeGateError && err.status === 402) {
94
+ return errorText("BYO storage requires the Enterprise plan. Reach out to " +
95
+ "sales@edgegate.ai to enable it on this workspace.");
96
+ }
97
+ else {
98
+ throw err;
99
+ }
100
+ }
101
+ // 3. Render the trust + permission policies. We mirror the backend
102
+ // templates locally instead of using the server-rendered strings
103
+ // (which still have placeholders) so the agent gets ready-to-paste
104
+ // JSON.
105
+ const principalMatch = /^arn:aws:iam::(\d{12}):(user|role)\/(.+)$/.exec(setupInfo.edgegate_principal_arn);
106
+ if (!principalMatch) {
107
+ return errorText(`EdgeGate returned an unexpected principal ARN: ${setupInfo.edgegate_principal_arn}. ` +
108
+ `This usually means an operator-side misconfiguration. Contact support.`);
109
+ }
110
+ const trustPolicy = renderTrustPolicy({
111
+ principalArn: setupInfo.edgegate_principal_arn,
112
+ externalId: grant.external_id,
113
+ });
114
+ const permissionPolicy = renderPermissionPolicy({
115
+ bucket: input.bucket,
116
+ kmsKeyArn: input.kms_key_id,
117
+ });
118
+ const roleName = input.role_name_override ??
119
+ `edgegate-byo-read-${grant.external_id.slice(0, 8)}`;
120
+ return successText({
121
+ grant,
122
+ setupInfo,
123
+ roleName,
124
+ trustPolicy: JSON.stringify(trustPolicy, null, 2),
125
+ permissionPolicy: JSON.stringify(permissionPolicy, null, 2),
126
+ });
127
+ }
128
+ catch (err) {
129
+ if (err instanceof EdgeGateError) {
130
+ return errorText(`EdgeGate returned ${err.status}: ${err.detail}`);
131
+ }
132
+ throw err;
133
+ }
134
+ }
135
+ function successText(args) {
136
+ // We embed the shell commands as fenced blocks so the agent can lift them
137
+ // verbatim into its Bash tool. Naming the trust/perm files under /tmp/ is
138
+ // intentional — they contain no secrets and are convenient to inspect if
139
+ // the customer wants to verify before running. The grant's External ID is
140
+ // already in the trust policy JSON; no separate secret-handling needed.
141
+ const { grant, roleName, trustPolicy, permissionPolicy } = args;
142
+ const trustFile = `/tmp/edgegate-trust-${grant.external_id.slice(0, 8)}.json`;
143
+ const permFile = `/tmp/edgegate-perm-${grant.external_id.slice(0, 8)}.json`;
144
+ return {
145
+ content: [
146
+ {
147
+ type: "text",
148
+ text: [
149
+ `Pending BYO grant created. Now run these commands to create the IAM role in the customer's AWS account, then call \`edgegate_attach_byo_role\` with the resulting ARN.`,
150
+ ``,
151
+ `**Grant details (for the customer's confirmation):**`,
152
+ `- workspace: \`${grant.workspace_id}\``,
153
+ `- bucket: \`s3://${grant.bucket}\` (${grant.region})`,
154
+ grant.kms_key_id ? `- kms key: \`${grant.kms_key_id}\`` : `- kms key: (none)`,
155
+ `- external_id: \`${grant.external_id}\` (baked into the trust policy below)`,
156
+ `- suggested role name: \`${roleName}\``,
157
+ ``,
158
+ `**Step 1 — verify AWS credentials and account:**`,
159
+ "```bash",
160
+ `aws sts get-caller-identity`,
161
+ "```",
162
+ ``,
163
+ `**Step 2 — write the policy documents to /tmp:**`,
164
+ "```bash",
165
+ `cat > ${trustFile} <<'JSON'`,
166
+ trustPolicy,
167
+ `JSON`,
168
+ ``,
169
+ `cat > ${permFile} <<'JSON'`,
170
+ permissionPolicy,
171
+ `JSON`,
172
+ "```",
173
+ ``,
174
+ `**Step 3 — create the role and attach the inline policy:**`,
175
+ "```bash",
176
+ `aws iam create-role \\`,
177
+ ` --role-name ${roleName} \\`,
178
+ ` --assume-role-policy-document file://${trustFile} \\`,
179
+ ` --description "Allows EdgeGate read access to s3://${grant.bucket}" \\`,
180
+ ` --tags Key=edgegate:workspace_id,Value=${grant.workspace_id} \\`,
181
+ ` Key=edgegate:external_id,Value=${grant.external_id} \\`,
182
+ ` Key=edgegate:bucket,Value=${grant.bucket}`,
183
+ ``,
184
+ `aws iam put-role-policy \\`,
185
+ ` --role-name ${roleName} \\`,
186
+ ` --policy-name EdgeGateReadModels \\`,
187
+ ` --policy-document file://${permFile}`,
188
+ ``,
189
+ `# Capture the ARN for the next step:`,
190
+ `aws iam get-role --role-name ${roleName} --query 'Role.Arn' --output text`,
191
+ "```",
192
+ ``,
193
+ `**Step 4 — finalize with EdgeGate:**`,
194
+ ``,
195
+ `Take the Role ARN from Step 3 and call:`,
196
+ ``,
197
+ "```",
198
+ `edgegate_attach_byo_role(workspace_id="${grant.workspace_id}", role_arn="<paste-arn-here>")`,
199
+ "```",
200
+ ``,
201
+ `EdgeGate will run its readiness probe (sts:AssumeRole + a deny-by-default HEAD) and flip the grant to "active" on success, or "failed" with a typed error code if the role doesn't have the right trust/permission policy.`,
202
+ ``,
203
+ `**If Step 3 fails because the role already exists** (e.g. a previous run partially succeeded): the existing role's ARN is what you want — fetch it with the same \`aws iam get-role\` command and proceed to Step 4.`,
204
+ ].join("\n"),
205
+ },
206
+ ],
207
+ };
208
+ }
209
+ function errorText(message) {
210
+ return {
211
+ isError: true,
212
+ content: [{ type: "text", text: message }],
213
+ };
214
+ }
215
+ function renderTrustPolicy(args) {
216
+ return {
217
+ Version: "2012-10-17",
218
+ Statement: [
219
+ {
220
+ Effect: "Allow",
221
+ Principal: { AWS: args.principalArn },
222
+ Action: "sts:AssumeRole",
223
+ Condition: {
224
+ StringEquals: { "sts:ExternalId": args.externalId },
225
+ },
226
+ },
227
+ ],
228
+ };
229
+ }
230
+ function renderPermissionPolicy(args) {
231
+ const statements = [
232
+ {
233
+ Effect: "Allow",
234
+ Action: ["s3:GetObject", "s3:HeadObject"],
235
+ Resource: `arn:aws:s3:::${args.bucket}/*`,
236
+ },
237
+ ];
238
+ if (args.kmsKeyArn) {
239
+ statements.push({
240
+ Effect: "Allow",
241
+ Action: "kms:Decrypt",
242
+ Resource: args.kmsKeyArn,
243
+ });
244
+ }
245
+ return { Version: "2012-10-17", Statement: statements };
246
+ }
247
+ //# sourceMappingURL=setup_byo_storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup_byo_storage.js","sourceRoot":"","sources":["../../src/tools/setup_byo_storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAkB,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7D,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,IAAI,EAAE;SACN,QAAQ,CAAC,iEAAiE,CAAC;IAC9E,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,KAAK,CAAC,8BAA8B,CAAC;SACrC,QAAQ,CACP,0EAA0E,CAC3E;IACH,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,CAAC,iDAAiD,CAAC;IAC9D,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,EAAE;SACV,QAAQ,CACP,+EAA+E;QAC7E,wDAAwD;QACxD,6DAA6D,CAChE;IACH,kBAAkB,EAAE,CAAC;SAClB,MAAM,EAAE;SACR,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,EAAE;SACV,QAAQ,CACP,8EAA8E;QA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EAAE,OAAO;YACf,MAAM,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;YACzC,QAAQ,EAAE,gBAAgB,IAAI,CAAC,MAAM,IAAI;SAC1C;KACF,CAAC;IACF,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,UAAU,CAAC,IAAI,CAAC;YACd,MAAM,EAAE,OAAO;YACf,MAAM,EAAE,aAAa;YACrB,QAAQ,EAAE,IAAI,CAAC,SAAS;SACzB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAC1D,CAAC"}
package/dist/types.d.ts CHANGED
@@ -187,6 +187,22 @@ export interface AuditReport {
187
187
  generated_at?: string;
188
188
  }
189
189
  export type HFImportStatus = "queued" | "downloading" | "uploading_to_hub" | "done" | "failed";
190
+ /**
191
+ * One entry in a multi-part HF import. F-T6.2 (commit 3636c20) added
192
+ * multi-part `.bin` auto-discovery: a Volko76-style repo with 3 parts
193
+ * (prompt / token / kv_cache) now unpacks into 3 ArtifactRefs, in addition
194
+ * to the legacy single `artifact_id` field (which still points at part 1
195
+ * for backward compat with older MCP clients).
196
+ */
197
+ export interface ArtifactRef {
198
+ id: UUID;
199
+ filename: string;
200
+ size_bytes: number;
201
+ /** "prompt" | "token" | "kv_cache" for M=3 multi-part imports; "part_N" otherwise. */
202
+ role: string;
203
+ /** 1-based. */
204
+ part_index: number;
205
+ }
190
206
  export interface HFImportJob {
191
207
  import_job_id: string;
192
208
  status: HFImportStatus;
@@ -196,6 +212,36 @@ export interface HFImportJob {
196
212
  size_bytes: number | null;
197
213
  filename: string | null;
198
214
  error_detail: string | null;
215
+ /**
216
+ * Plan B / F-T6.2 — when the HF repo contains multiple .bin parts, this
217
+ * array surfaces every part (size > 1 for multi-part imports). Omitted
218
+ * or single-element for legacy single-file imports.
219
+ */
220
+ artifacts?: ArtifactRef[];
221
+ }
222
+ export type LLMCompileStatus = "queued" | "running" | "completed" | "failed";
223
+ export interface LLMCompileProgress {
224
+ compile_jobs_done: number;
225
+ compile_jobs_total: number;
226
+ }
227
+ /**
228
+ * Returned by POST /v1/workspaces/{ws}/llm-compile and GET
229
+ * /v1/workspaces/{ws}/llm-compile/{compile_job_id}. POST returns the
230
+ * initial queued state; GET reflects current state. On success,
231
+ * `composite_artifact_id` is the QNN_DLC linked composite ready to be
232
+ * referenced from a pipeline. On failure, `error_detail` is set.
233
+ */
234
+ export interface LLMCompileJob {
235
+ compile_job_id: UUID;
236
+ status: LLMCompileStatus;
237
+ composite_artifact_id: UUID | null;
238
+ error_detail: string | null;
239
+ progress: LLMCompileProgress;
240
+ /** Echoed for caller convenience. */
241
+ device_id?: string;
242
+ target_runtime?: string;
243
+ created_at?: string;
244
+ updated_at?: string;
199
245
  }
200
246
  export interface MetricDelta {
201
247
  current: number | null;
@@ -298,17 +344,35 @@ export interface PromptPackCreateBody {
298
344
  export interface ByoGrant {
299
345
  id: UUID;
300
346
  workspace_id: UUID;
301
- role_arn: string;
347
+ role_arn: string | null;
302
348
  external_id: UUID;
303
349
  bucket: string;
304
350
  region: string;
305
351
  kms_key_id: string | null;
306
- status: "active" | "revoked" | "failed";
352
+ status: "pending_role" | "active" | "revoked" | "failed";
307
353
  last_verified_at: string | null;
308
354
  last_verify_error: string | null;
309
355
  created_at: string;
310
356
  updated_at: string;
311
357
  }
358
+ /**
359
+ * GET /v1/workspaces/{ws}/byo-storage/setup-info response. Surfaces
360
+ * EdgeGate's IAM principal so the orchestrator tool can render the trust
361
+ * policy with the right ARN before asking the agent to create the role.
362
+ */
363
+ export interface ByoSetupInfo {
364
+ edgegate_aws_account_id: string;
365
+ edgegate_principal_arn: string;
366
+ docs_url: string;
367
+ trust_policy_template: string;
368
+ permission_policy_template: string;
369
+ permission_policy_with_kms_template: string;
370
+ cloudformation_template_url: string;
371
+ cloudformation_template_yaml: string;
372
+ terraform_template: string;
373
+ terraform_template_with_kms: string;
374
+ setup_info_warning: string | null;
375
+ }
312
376
  /**
313
377
  * Request body for POST /v1/workspaces/{ws}/artifacts/byo.
314
378
  * Registers an existing S3 URI in the customer's grant-registered bucket
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.9.1";
2
- export declare const USER_AGENT = "edgegate-mcp/0.9.1";
1
+ export declare const VERSION = "0.11.0";
2
+ export declare const USER_AGENT = "edgegate-mcp/0.11.0";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
- export const VERSION = "0.9.1";
1
+ export const VERSION = "0.11.0";
2
2
  export const USER_AGENT = `edgegate-mcp/${VERSION}`;
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,OAAO,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edgegate-mcp",
3
- "version": "0.9.1",
3
+ "version": "0.11.0",
4
4
  "description": "MCP server for EdgeGate — set up edge-AI regression gates from Claude Code, Cursor, or Claude Desktop.",
5
5
  "license": "MIT",
6
6
  "type": "module",