edgegate-mcp 0.7.0 → 0.8.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,148 @@
1
+ ---
2
+ name: edgegate-byo-storage
3
+ description: Wire up BYO (bring-your-own) S3 storage for an Enterprise EdgeGate workspace — register the IAM role + bucket grant, verify the readiness probe, register the first artifact directly from the customer's bucket, and confirm the audit trail. Use when the user is on the Enterprise plan and wants model bytes to live in their own AWS account.
4
+ ---
5
+
6
+ # /edgegate-byo-storage
7
+
8
+ This is the **Enterprise BYO storage onboarding** flow. The whole point of
9
+ BYO is that model bytes never leave the customer's AWS account — EdgeGate's
10
+ workers AssumeRole into their account and read directly from their bucket.
11
+
12
+ Use this skill once per workspace, after the customer's security/IAM team
13
+ has provisioned the role + bucket.
14
+
15
+ ## When to use
16
+
17
+ - The workspace is on the **Enterprise plan** (BYO storage 402s otherwise).
18
+ - The user has (or wants to provision) their own S3 bucket and IAM role.
19
+ - The user is migrating an existing workspace from EdgeGate-managed storage
20
+ to BYO, or onboarding a brand-new Enterprise workspace.
21
+
22
+ If the workspace isn't Enterprise yet, send them to
23
+ <https://edgegate.frozo.ai/enterprise> first — none of the
24
+ `edgegate_*_byo_*` tools will work until BYO is enabled on the plan.
25
+
26
+ ## Pre-flight (AWS side — the user does this in their account)
27
+
28
+ You can't do this part for them, but you can hand them the exact spec:
29
+
30
+ 1. **Provision the IAM role.** The fastest path is the EdgeGate
31
+ CloudFormation Launch Stack — link them to it from
32
+ <https://edgegate.frozo.ai/workspace/{workspace_id}/settings#byo-storage>.
33
+ (A Terraform module is also published; ask the customer which their
34
+ security team prefers.) The stack creates:
35
+ - The IAM role with `sts:AssumeRole` trusted to EdgeGate's AWS account.
36
+ - The S3 bucket policy granting that role `s3:GetObject` + `ListBucket`
37
+ scoped to the bucket only.
38
+ - (Optional) KMS key policy granting `kms:Decrypt` if the bucket uses
39
+ SSE-KMS.
40
+ 2. **Capture** the `role_arn`, `bucket` name, `region`, and (if applicable)
41
+ `kms_key_id`. The trust policy's `sts:ExternalId` is left as a
42
+ placeholder — EdgeGate mints the real one in step 1 below and the
43
+ customer pastes it back.
44
+
45
+ If they want the raw IAM JSON instead of CloudFormation/Terraform, point
46
+ them at `docs/byo-storage-onboarding.md` in the backend repo or the
47
+ dashboard's "Show raw policies" link.
48
+
49
+ ## Steps
50
+
51
+ 1. **Register the grant.** Call
52
+ `edgegate_register_byo_bucket({ workspace_id, role_arn, bucket, region, kms_key_id? })`.
53
+ The response includes an `external_id` UUID — capture it.
54
+
55
+ 2. **Paste the External ID into the IAM role trust policy.** Tell the
56
+ user, in plain English: "Open your IAM role in the AWS console, edit
57
+ the trust relationship, and replace the placeholder ExternalId with
58
+ `<external_id>`." Until they do this, AssumeRole will fail with
59
+ `BYO_ASSUME_ROLE_FAILED`.
60
+
61
+ The CloudFormation stack supports passing the External ID as a
62
+ parameter — point them at that if they used the stack.
63
+
64
+ 3. **Verify the probe.** After the user confirms the trust policy edit
65
+ is saved, call `edgegate_check_byo_bucket({ workspace_id })`. Expect
66
+ `status: "active"`. If `status: "failed"`, the response's checklist
67
+ covers every typed `BYO_*` error code — read the `last_verify_error`
68
+ to the user, suggest the matching fix, then re-run `check`.
69
+
70
+ 4. **Register the first artifact.** Pick (or ask for) an existing model
71
+ in the bucket. Call:
72
+ ```
73
+ edgegate_register_byo_artifact({
74
+ workspace_id,
75
+ s3_uri: "s3://<bucket>/<key>.onnx",
76
+ expected_sha256: "<optional but recommended>",
77
+ })
78
+ ```
79
+ Capture the returned `artifact_id`. EdgeGate did NOT download the
80
+ bytes — it only HeadObject'd the URI to confirm the key exists and
81
+ capture size + etag. The storage URL in the response will start with
82
+ `byo-s3://` (not `s3://`) — that's how downstream tooling routes
83
+ reads through the BYO service rather than EdgeGate's managed S3.
84
+
85
+ 5. **Trigger the first run.** Run the artifact against an existing
86
+ pipeline so the customer sees the end-to-end flow work:
87
+ ```
88
+ edgegate_run_gate({
89
+ workspace_id,
90
+ pipeline_id: "<existing pipeline>",
91
+ model_artifact_id: "<artifact_id from step 4>",
92
+ })
93
+ ```
94
+ Poll with `edgegate_check_status` until it terminates.
95
+
96
+ 6. **Show them the audit trail.** Call
97
+ `edgegate_get_byo_audit({ workspace_id, run_id: "<run_id from step 5>" })`.
98
+ The table includes one row per S3 / STS call with the
99
+ `aws_request_id`. Tell the user: "Cross-reference these against your
100
+ own CloudTrail in the same time window — every read should match."
101
+ This is the trust handshake the customer's security team will ask
102
+ for.
103
+
104
+ 7. **Recap + next.** Summarize:
105
+ - Grant: `active`, bucket=`<name>`, region=`<region>`
106
+ - First artifact registered + first run executed
107
+ - Audit log accessible via `edgegate_get_byo_audit`
108
+
109
+ Next concrete actions:
110
+ - "Migrate more artifacts: `edgegate_register_byo_artifact` per s3_uri"
111
+ - "Schedule periodic audit pulls into your SIEM (we can stream via API)"
112
+ - "Rotate the External ID at any time via the dashboard"
113
+
114
+ ## Failure modes
115
+
116
+ - **Register grant → 402.** Workspace is not on Enterprise. Send them to
117
+ <https://edgegate.frozo.ai/enterprise>.
118
+ - **Register grant → 409.** A grant already exists. We deliberately do
119
+ NOT auto-rotate — the existing grant may belong to a role the customer
120
+ doesn't want overwritten. Inspect with `edgegate_check_byo_bucket`,
121
+ then either keep it or `edgegate_disconnect_byo_bucket` and re-register.
122
+ External-ID-only rotation is available via the dashboard.
123
+ - **Check probe → status=failed with BYO_ASSUME_ROLE_FAILED.** External
124
+ ID drift between EdgeGate and the role's trust policy. Re-paste the
125
+ current external_id (visible via `edgegate_check_byo_bucket` or the
126
+ dashboard) into the trust policy's `sts:ExternalId` condition.
127
+ - **Check probe → BYO_KMS_ACCESS_DENIED.** SSE-KMS bucket but the role
128
+ is missing `kms:Decrypt` on the key. Add the role principal to the
129
+ KMS key policy.
130
+ - **Check probe → BYO_REGION_MISMATCH.** The bucket lives in a different
131
+ region than the `region` you registered. Disconnect and re-register
132
+ with the correct region.
133
+ - **Register artifact → 400 bucket mismatch.** The s3_uri points at a
134
+ bucket that isn't this workspace's registered one. Cross-bucket
135
+ pointers are forbidden — register the right bucket (or move the
136
+ object).
137
+ - **Register artifact → 400 BYO_OBJECT_NOT_FOUND.** The key is mistyped
138
+ or the role's bucket policy denies `ListBucket`/`GetObject` on that
139
+ prefix. HeadObject failures pass through with the typed code.
140
+ - **Disconnect → 409.** Artifacts still reference the grant. The
141
+ response lists the safe paths forward (drop the artifacts first, or
142
+ rotate the External ID via dashboard if that's what you actually
143
+ wanted).
144
+ - **Mid-run revocation** (customer revokes the role mid-run): the
145
+ in-flight cells complete, the rest fail with
146
+ `BYO_ASSUME_ROLE_FAILED`, the run terminates as `failed` (not
147
+ `error`) with the partial-success cells preserved in the bundle.
148
+ This is by design — re-grant + re-run picks up cleanly.