Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(oss): deep-review remediation — scrub PII/incident, fix approval route, restore READMEs

Jose Ramirez96e0d5bc8f8c
diff --git a/.agents/skills/documentation-writer/SKILL.md b/.agents/skills/documentation-writer/SKILL.md
new file mode 100644
index 000000000..93e3fbf57
--- /dev/null
+++ b/.agents/skills/documentation-writer/SKILL.md
@@ -0,0 +1,45 @@
+---
+name: documentation-writer
+description: 'Diátaxis Documentation Expert. An expert technical writer specializing in creating high-quality software documentation, guided by the principles and structure of the Diátaxis technical documentation authoring framework.'
+---
+
+# Diátaxis Documentation Expert
+
+You are an expert technical writer specializing in creating high-quality software documentation.
+Your work is strictly guided by the principles and structure of the Diátaxis Framework (https://diataxis.fr/).
+
+## GUIDING PRINCIPLES
+
+1. **Clarity:** Write in simple, clear, and unambiguous language.
+2. **Accuracy:** Ensure all information, especially code snippets and technical details, is correct and up-to-date.
+3. **User-Centricity:** Always prioritize the user's goal. Every document must help a specific user achieve a specific task.
+4. **Consistency:** Maintain a consistent tone, terminology, and style across all documentation.
+
+## YOUR TASK: The Four Document Types
+
+You will create documentation across the four Diátaxis quadrants. You must understand the distinct purpose of each:
+
+- **Tutorials:** Learning-oriented, practical steps to guide a newcomer to a successful outcome. A lesson.
+- **How-to Guides:** Problem-oriented, steps to solve a specific problem. A recipe.
+- **Reference:** Information-oriented, technical descriptions of machinery. A dictionary.
+- **Explanation:** Understanding-oriented, clarifying a particular topic. A discussion.
+
+## WORKFLOW
+
+You will follow this process for every documentation request:
+
+1. **Acknowledge & Clarify:** Acknowledge my request and ask clarifying questions to fill any gaps in the information I provide. You MUST determine the following before proceeding:
+ - **Document Type:** (Tutorial, How-to, Reference, or Explanation)
+ - **Target Audience:** (e.g., novice developers, experienced sysadmins, non-technical users)
+ - **User's Goal:** What does the user want to achieve by reading this document?
+ - **Scope:** What specific topics should be included and, importantly, excluded?
+
+2. **Propose a Structure:** Based on the clarified information, propose a detailed outline (e.g., a table of contents with brief descriptions) for the document. Await my approval before writing the full content.
+
+3. **Generate Content:** Once I approve the outline, write the full documentation in well-formatted Markdown. Adhere to all guiding principles.
+
+## CONTEXTUAL AWARENESS
+
+- When I provide other markdown files, use them as context to understand the project's existing tone, style, and terminology.
+- DO NOT copy content from them unless I explicitly ask you to.
+- You may not consult external websites or other sources unless I provide a link and instruct you to do so.
diff --git a/channel-reader/README.md b/channel-reader/README.md
index 95db84900..21d4538f6 100644
--- a/channel-reader/README.md
+++ b/channel-reader/README.md
@@ -15,7 +15,7 @@ Reads channel config from `CLERUM_CHANNEL` environment variable. No Kubernetes a
## How It Works
1. **Loads config**: From Kubernetes CRDs (production) or env var (dev mode)
-2. **Extracts transport filters**: Gets optional `userIds` (Telegram), `emails` (Email), or `userNames` (Slack)
+2. **Extracts transport filters**: Telegram `userIds` are an optional legacy pre-filter; Email requires `emails` on every group; Slack requires either `userIds` + `workspaceId` (stable identity — the only form usable for workflow approval decisions) or legacy `userNames`. The CRD enforces this (`required`/`anyOf`) and `channelConfigValidation.ts` re-checks it at load
3. **Polls channels**: Connects to messaging platforms and fetches new messages
4. **Filters transport input**: Applies configured sender pre-filters before forwarding messages to the runtime
5. **Delegates workflow identity**: Workflow approval commands are authorized later through verified approval-medium accounts and workflow permissions
@@ -24,27 +24,30 @@ Reads channel config from `CLERUM_CHANNEL` environment variable. No Kubernetes a
### Environment Variables
-| Variable | Required | Default | Description |
-| ------------------------------------ | --------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `CLERUM_DEV_MODE` | No | `false` | Enable dev mode (read config from env var) |
-| `CLERUM_CHANNEL` | Dev mode | - | Channel config JSON (dev mode only) |
-| `CLERUM_HOST_REF` | Prod mode | - | Filter CommunicationChannels by this `hostRef` |
-| `CLERUM_NAMESPACE` | No | "" (all) | Namespace to watch (production mode) |
-| `CLERUM_TELEGRAM_BOT_TOKEN` | No | - | Telegram Bot API token |
-| `CLERUM_SLACK_BOT_TOKEN` | No | - | Slack Bot OAuth token (xoxb-...) |
-| `CLERUM_EMAIL_IMAP_HOST` | No | - | IMAP server host |
-| `CLERUM_EMAIL_IMAP_PORT` | No | `993` | IMAP server port |
-| `CLERUM_EMAIL_USERNAME` | No | - | IMAP username |
-| `CLERUM_EMAIL_PASSWORD` | No | - | IMAP password |
-| `CLERUM_POLL_INTERVAL_SECONDS` | No | `2` | Seconds between polling cycles. Telegram/Slack land in an in-memory queue near-instantly via their long-polling/websocket transports; pollCycle drains it. Raise this only if IMAP polling rate on the email channel matters. |
-| `CLERUM_ENABLE_RESPONSE_ATTACHMENTS` | No | `true` | Enable response attachment delivery. Set to `false` to disable non-workflow response attachments. |
-| `CLERUM_ATTACHMENT_MAX_COUNT` | No | `3` | Max attachments delivered per response |
-| `CLERUM_ATTACHMENT_MAX_BYTES` | No | `52428800` | Max decoded bytes per attachment |
+| Variable | Required | Default | Description |
+| ------------------------------------ | --------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CLERUM_DEV_MODE` | No | `false` | Enable dev mode (read config from env var) |
+| `CLERUM_CHANNEL` | Dev mode | - | Channel config JSON (dev mode only) |
+| `CLERUM_HOST_REF` | Prod mode | - | Filter CommunicationChannels by this `hostRef` |
+| `CLERUM_NAMESPACE` | No | "" (all) | Namespace to watch (production mode) |
+| `CLERUM_TELEGRAM_BOT_TOKEN` | Dev mode | - | Telegram Bot API token. **Dev mode only** — production reads it from `spec.credentialsSecretRef` (key `telegram-bot-token`). |
+| `CLERUM_SLACK_BOT_TOKEN` | Dev mode | - | Slack Bot OAuth token (xoxb-...). **Dev mode only** — production reads it from `spec.credentialsSecretRef` (key `slack-bot-token`). |
+| `CLERUM_EMAIL_IMAP_HOST` | No | - | IMAP server host |
+| `CLERUM_EMAIL_IMAP_PORT` | No | `993` | IMAP server port |
+| `CLERUM_EMAIL_SMTP_HOST` | No | falls back to `CLERUM_EMAIL_IMAP_HOST` | SMTP host for the **send** path. Set this when your outbound host differs from IMAP. |
+| `CLERUM_EMAIL_SMTP_PORT` | No | `587` | SMTP server port (send path) |
+| `CLERUM_EMAIL_USERNAME` | Dev mode | - | IMAP username. **Dev mode only** — production reads it from `spec.credentialsSecretRef` (key `email-username`). |
+| `CLERUM_EMAIL_PASSWORD` | Dev mode | - | IMAP password. **Dev mode only** — production reads it from `spec.credentialsSecretRef` (key `email-password`). |
+| `CLERUM_POLL_INTERVAL_SECONDS` | No | `2` | Seconds between polling cycles. Telegram messages land in an in-memory queue via grammY long-polling and `pollCycle` only drains it. Slack and Email are fetched _during_ the cycle (Slack `conversations.history`, IMAP), so this interval bounds their delivery latency. |
+| `CLERUM_ENABLE_RESPONSE_ATTACHMENTS` | No | `true` | Enable response attachment delivery. Set to `false` to disable non-workflow response attachments. |
+| `CLERUM_ATTACHMENT_MAX_COUNT` | No | `3` | Max attachments delivered per response |
+| `CLERUM_ATTACHMENT_MAX_BYTES` | No | `52428800` | Max decoded bytes per attachment |
Attachment delivery behavior:
- Telegram: JPEG attachments are sent as photos. Workflow result documents and supported internal generated artifacts are sent as documents.
-- Slack/Email: text reply is sent with an attachment-availability note.
+- Slack: workflow result documents and supported internal generated artifacts are uploaded as real files (`files.uploadV2`). Any attachment outside those two categories is not delivered; the text reply then carries a note counting the undeliverable attachments.
+- Email: the text reply is sent with an attachment-availability note; no attachment is delivered.
## Dev Mode
@@ -79,30 +82,46 @@ The `CLERUM_CHANNEL` JSON matches the CommunicationChannel CRD spec:
"userIds": ["123456789", "987654321"]
}
],
- "email": {
- "channelId": "INBOX",
- "emails": ["[email protected]"]
- },
- "slack": {
- "channelId": "C01234567",
- "userNames": ["@john", "@jane"]
- }
+ "email": [
+ {
+ "channelId": "INBOX",
+ "emails": ["[email protected]"]
+ }
+ ],
+ "slack": [
+ {
+ "channelId": "C01234567",
+ "workspaceId": "T01234567",
+ "userIds": ["U01234567", "U07654321"]
+ }
+ ]
}
```
+Slack groups must supply either `userIds` + `workspaceId` or the legacy `userNames`. Only the `userIds` + `workspaceId` form is a valid workflow-approval identity; `userNames` is a legacy chat-only allowlist. When `userIds` are set, `channelId` must be a stable Slack channel ID (`C…`, `D…`, or `G…`) and `workspaceId` a team ID (`T…`).
+
## Production Mode (Kubernetes)
### Kubernetes API Access
-The channel-reader needs `list` and `watch` permissions on `communicationchannels.clerum.io`:
+The channel-reader needs cluster-wide `list` and `watch` on `communicationchannels.clerum.io` (via a ClusterRole — the CRD itself is namespaced, and `CLERUM_NAMESPACE=""` means watch all namespaces), plus `get` on Secrets in the `channels` namespace — at adapter init it reads `spec.credentialsSecretRef` through the Kubernetes API to resolve the bot tokens:
```yaml
+# ClusterRole
rules:
- apiGroups: ['clerum.io']
resources: ['communicationchannels']
verbs: ['list', 'watch']
+---
+# Role in the `channels` namespace
+rules:
+ - apiGroups: ['']
+ resources: ['secrets']
+ verbs: ['get']
```
+Both are shipped in `deploy/base/cluster-wide/clusterroles.yaml` and `deploy/base/channels/rbac.yaml`.
+
### Example CommunicationChannel CRD
```yaml
@@ -112,6 +131,10 @@ metadata:
name: my-channels
spec:
hostRef: chatllm # Must match CLERUM_HOST_REF
+ # In production mode, credentials are read ONLY from this Secret (in the
+ # `channels` namespace). The CLERUM_*_TOKEN env vars are dev-mode only.
+ credentialsSecretRef:
+ name: my-channels-credentials
telegram:
- channelId: telegram1
chatType: private
@@ -122,9 +145,10 @@ spec:
emails:
slack:
- - channelId: slack1
- userNames:
- - '@john'
+ - channelId: C01234567 # stable channel ID required when userIds are set
+ workspaceId: T01234567
+ userIds:
+ - U01234567
```
When you create, update, or delete this CRD, the channel-reader automatically detects the change and restarts.
@@ -143,14 +167,18 @@ export CLERUM_TELEGRAM_BOT_TOKEN="your-token"
npm start
```
-### Production Mode (requires kubeconfig)
+### Production Mode
+
+The CRD watcher tries `loadFromCluster()` first and falls back to `loadFromDefault()` (`src/k8sClient.ts`), so production mode can also run off-cluster against whatever `~/.kube` context is current — the ServiceAccount token is used only when the process runs as a pod. Credentials are resolved exclusively from the Secret named by `CommunicationChannel.spec.credentialsSecretRef.name` in the `channels` namespace; the `CLERUM_TELEGRAM_BOT_TOKEN` / `CLERUM_SLACK_BOT_TOKEN` / `CLERUM_EMAIL_USERNAME` / `CLERUM_EMAIL_PASSWORD` env vars are read by the dev-mode resolver only and are ignored in production. Running it locally therefore requires a kubeconfig whose user can read the CommunicationChannels and the credentials Secret.
```bash
+# Uses the in-cluster ServiceAccount when run as a pod, otherwise the current kubeconfig context.
export CLERUM_HOST_REF="chatllm"
-export CLERUM_TELEGRAM_BOT_TOKEN="your-token"
npm start
```
+For local iteration, use dev mode above.
+
## Docker
```bash
@@ -163,90 +191,36 @@ docker run --rm \
-e CLERUM_CHANNEL='{"hostRef":"dev","telegram":[{"channelId":"test","chatType":"private","userIds":["123"]}]}' \
-e CLERUM_TELEGRAM_BOT_TOKEN="your-token" \
clerum/channel-reader:latest
-
-# Run in production mode (with kubeconfig mounted)
-docker run --rm \
- -v ~/.kube:/home/node/.kube:ro \
- -e CLERUM_HOST_REF="chatllm" \
- -e CLERUM_TELEGRAM_BOT_TOKEN="your-token" \
- clerum/channel-reader:latest
-```
-
-## Deploy to Kubernetes
-
-1. **Install CRDs first** (if not already):
-
-```bash
-helm install clerum-crds ../charts/clerum-crds
```
-2. **Create namespace and RBAC**:
+Production mode inside a container needs Kubernetes credentials: as a pod it picks up the mounted ServiceAccount token, and any other runtime must have a kubeconfig mounted for the `loadFromDefault()` fallback to find. In the cluster, host-context-controller creates the per-Host `channel-reader-<host>` Deployment for you — see below.
-```bash
-kubectl apply -f deploy/namespace.yaml
-kubectl apply -f deploy/serviceaccount.yaml
-kubectl apply -f deploy/rbac.yaml
-```
-
-3. **Configure settings** (edit `deploy/configmap.yaml` - set `CLERUM_HOST_REF`):
-
-```bash
-kubectl apply -f deploy/configmap.yaml
-```
-
-4. **Configure credentials** -- copy the example and fill in your tokens:
-
-```bash
-cp deploy/example.secret.yaml deploy/secret.yaml
-```
-
-Values under `data:` must be **base64-encoded**. Encode them like this:
-
-```bash
-# Encode a value
-echo -n "your-telegram-bot-token" | base64
-
-# Example
-echo -n "<TELEGRAM_BOT_TOKEN>" | base64
-# Output: <BASE64_TELEGRAM_BOT_TOKEN>
-```
-
-Then paste the encoded value into `deploy/secret.yaml`:
-
-```yaml
-data:
- telegram-bot-token: <BASE64_TELEGRAM_BOT_TOKEN>
-```
-
-Alternatively, use `stringData:` instead of `data:` to provide plain-text values -- Kubernetes will encode them automatically:
+## Deploy to Kubernetes
-```yaml
-stringData:
- telegram-bot-token: '<TELEGRAM_BOT_TOKEN>'
-```
+There is no standalone channel-reader Deployment to apply. The legacy static Deployment was retired in favor of **per-Host `channel-reader-<host>` Deployments created by host-context-controller** (HCC) from the `Host` CR. The only static pieces are the `clerum-channel-reader` ServiceAccount and the `clerum-channel-reader-config` ConfigMap, which the per-Host pods reference — both live in `deploy/base/channels/` in the `channels` namespace and ship with the platform deploy.
-Apply the secret:
+1. **Install CRDs** (if not already), from the repo root:
```bash
-kubectl apply -f deploy/secret.yaml
+helm install clerum-crds charts/clerum-crds
```
-5. **Deploy**:
+2. **Deploy the platform** (namespaces, RBAC, ServiceAccount, ConfigMap, HCC), from the repo root:
```bash
-kubectl apply -f deploy/deployment.yaml
+kubectl apply -k deploy/overlays/minikube # or your own overlay
```
-6. **Create a CommunicationChannel CRD** (with matching `hostRef`):
+3. **Create the credentials Secret** in the `channels` namespace, holding the keys channel-reader reads (`telegram-bot-token`, `slack-bot-token`, `email-username`, `email-password`), then reference it from the CommunicationChannel via `spec.credentialsSecretRef.name`.
-```bash
-kubectl apply -f ../examples/channels.yaml
-```
+4. **Create a CommunicationChannel** with a `hostRef` matching an existing `Host` (see the example above). HCC reconciles the per-Host channel-reader Deployment; the reader picks up the CRD and restarts on change.
-7. **Check logs**:
+5. **Check logs**:
```bash
-kubectl logs -n clerum-system -l app.kubernetes.io/name=channel-reader -f
+# `app=channel-reader` matches every per-Host reader; app.kubernetes.io/name
+# is the per-Host value `channel-reader-<host>`.
+kubectl logs -n channels -l app=channel-reader -f
```
## Project Structure
@@ -254,24 +228,33 @@ kubectl logs -n clerum-system -l app.kubernetes.io/name=channel-reader -f
```
channel-reader/
├── src/
-│ ├── main.ts # Entry point, polling loop, dev/prod mode
-│ ├── config.ts # Environment configuration
-│ ├── types.ts # Shared TypeScript types
-│ ├── k8sClient.ts # Kubernetes CRD watcher (production mode)
+│ ├── main.ts # Entry point, polling loop, dev/prod mode
+│ ├── config.ts # Environment configuration
+│ ├── types.ts # Shared TypeScript types
+│ ├── k8sClient.ts # Kubernetes CRD watcher (production mode)
+│ ├── credentials.ts # Secret-backed + dev-mode credential resolvers
+│ ├── channelConfigValidation.ts # CommunicationChannel spec validation
+│ ├── handoffServer.ts # Inbound handoff HTTP listener
+│ ├── rpcClient.ts # mcp-host runtime client
+│ ├── progressClient.ts # Task progress streaming
+│ ├── progressFormatter.ts # Progress rendering
+│ ├── notificationDeliveryClient.ts
+│ ├── telegramCallbackData.ts # Telegram callback payload codec
+│ ├── workflowApproval*.ts # Workflow approval coordination/decisions
│ └── channels/
-│ ├── index.ts # Channel adapter exports
-│ ├── base.ts # Shared utilities
-│ ├── telegram.ts # Telegram adapter (grammY)
-│ ├── email.ts # Email adapter (ImapFlow)
-│ └── slack.ts # Slack adapter (@slack/web-api)
-├── deploy/
-│ ├── namespace.yaml
-│ ├── serviceaccount.yaml
-│ ├── rbac.yaml # ClusterRole with list/watch permissions
-│ ├── configmap.yaml # Settings including CLERUM_HOST_REF
-│ ├── example.secret.yaml # API tokens template (copy to secret.yaml)
-│ └── deployment.yaml
+│ ├── index.ts # Channel adapter exports
+│ ├── base.ts # Shared utilities
+│ ├── telegram.ts # Telegram adapter (grammY)
+│ ├── email.ts # Email adapter (ImapFlow)
+│ ├── slack.ts # Slack adapter (@slack/web-api)
+│ ├── slackVerification.ts
+│ ├── telegramDelivery.ts
+│ ├── telegramOperationalMessage.ts
+│ ├── telegramProviderTarget.ts
+│ └── telegramVerification.ts
├── Dockerfile
├── package.json
└── tsconfig.json
```
+
+Kubernetes manifests are not vendored here — the static ServiceAccount/ConfigMap and RBAC live in `deploy/base/channels/`, and the per-Host Deployment is generated by host-context-controller.
diff --git a/charts/clerum-crds/README.md b/charts/clerum-crds/README.md
index 036ac8137..6d41013bc 100644
--- a/charts/clerum-crds/README.md
+++ b/charts/clerum-crds/README.md
@@ -1,11 +1,22 @@
# clerum-crds Helm Chart
-Installs the Clerum Custom Resource Definitions:
+Installs evenfire Custom Resource Definitions (API group `clerum.io` — historical
+code name; public product name is **evenfire**).
-- **CommunicationChannel** (`communicationchannels.clerum.io`)
-- **Context** (`contexts.clerum.io`)
-- **Host** (`hosts.clerum.io`)
-- **McpServer** (`mcpservers.clerum.io`)
+## CRDs
+
+| Kind | Plural |
+| -------------------- | ---------------------------------- |
+| Host | `hosts.clerum.io` |
+| Context | `contexts.clerum.io` |
+| McpServer | `mcpservers.clerum.io` |
+| CommunicationChannel | `communicationchannels.clerum.io` |
+| WorkflowRecipe | `workflowrecipes.clerum.io` |
+| WorkflowRecipePolicy | `workflowrecipepolicies.clerum.io` |
+| SharedFileSystem | `sharedfilesystems.clerum.io` |
+| GlobalFileSystem | `globalfilesystems.clerum.io` |
+
+Human-readable reference: [docs/crds/README.md](../../docs/crds/README.md).
## Install
@@ -21,13 +32,30 @@ With a custom release name and/or namespace:
helm install my-crds ./charts/clerum-crds -n clerum-system --create-namespace
```
+Optional samples:
+
+```bash
+kubectl apply -f charts/clerum-crds/examples/
+```
+
## Upgrade / Uninstall
-- **Upgrade:** Helm does **not** upgrade manifests in the chart’s `crds/` directory on `helm upgrade` (Helm 3 behavior). From the repo root run **`make gcp-deploy-crds`**, which runs `helm upgrade --install` and then **`kubectl apply -f ./charts/clerum-crds/crds/`** so OpenAPI schema changes (e.g. new optional fields on `CommunicationChannel`) reach the cluster. To apply a single CRD: `kubectl apply -f charts/clerum-crds/crds/communicationchannel.yaml`.
-- **Uninstall:** `helm uninstall clerum-crds` does **not** delete the CRDs, so existing Custom Resources are not orphaned. Remove CRDs manually if needed.
+- **Upgrade:** Helm 3 does **not** upgrade manifests in the chart’s `crds/`
+ directory on `helm upgrade`. Re-apply CRD YAML after chart changes:
+
+ ```bash
+ helm upgrade --install clerum-crds ./charts/clerum-crds
+ kubectl apply -f ./charts/clerum-crds/crds/
+ ```
+
+ To apply a single CRD:
+ `kubectl apply -f charts/clerum-crds/crds/communicationchannel.yaml`.
+
+- **Uninstall:** `helm uninstall clerum-crds` does **not** delete the CRDs, so
+ existing Custom Resources are not orphaned. Remove CRDs manually if needed.
## Chart options
-| Key | Default | Description |
-|---------------|---------|--------------------------------|
-| `installCRDs` | `true` | Reserved for future use. |
+| Key | Default | Description |
+| ------------- | ------- | ------------------------ |
+| `installCRDs` | `true` | Reserved for future use. |
diff --git a/charts/clerum-crds/examples/MONGODB-STATEFULSET-README.md b/charts/clerum-crds/examples/MONGODB-STATEFULSET-README.md
index 7f15b162f..aabea5666 100644
--- a/charts/clerum-crds/examples/MONGODB-STATEFULSET-README.md
+++ b/charts/clerum-crds/examples/MONGODB-STATEFULSET-README.md
@@ -181,6 +181,5 @@ curl http://localhost:3000/mcp/tools/list
## See Also
-- [MongoDB StatefulSet Gap Analysis](../../../docs/archive/workflow-recipes/validation/MONGODB-STATEFULSET-GAP.md)
- [WorkflowRecipe CRD Reference](../../../docs/crds/workflowrecipe.md)
- [E2E Testing Guide](../../../mcp-servers/README.md#testing)
diff --git a/charts/clerum-crds/examples/airtable-mcp-deployment-recipe.yaml b/charts/clerum-crds/examples/airtable-mcp-deployment-recipe.yaml
index b777d6a81..08fcf2cf5 100644
--- a/charts/clerum-crds/examples/airtable-mcp-deployment-recipe.yaml
+++ b/charts/clerum-crds/examples/airtable-mcp-deployment-recipe.yaml
@@ -26,7 +26,7 @@ spec:
workloads:
- id: airtable-mcp
type: deployment
- image: us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp-server:latest
+ image: ghcr.io/evenfire-ai/airtable-mcp-server:latest
imagePullSecrets:
- clerum # GCP Artifact Registry secret
replicas: 1
diff --git a/control-api/README.md b/control-api/README.md
index f15f2574d..5ee08826f 100644
--- a/control-api/README.md
+++ b/control-api/README.md
@@ -190,6 +190,16 @@ Auth settings:
- `CONTROL_API_DESKTOP_PROFILE_UI_BASE_URL`: profile-ui URL used for invitation links and desktop setup.
- `CONTROL_API_DESKTOP_APP_NAME`: desktop app name associated with invitation flow configs.
+Issuance and image controls:
+
+- `CONTROL_API_ALLOWED_ISSUANCE_NAMESPACES`: comma-separated allowlist of namespaces a caller may mint host/provisioner tokens for (default: `mcp-host,sandbox-recipes`). Values are lowercased and de-duplicated. A startup guard **rejects boot** unless the list contains both the hosts and sandbox namespaces.
+- `CONTROL_API_REMOTE_MCP_EGRESS_PROXY_IMAGE`: image stamped into `spec.image` for remote-MCP entries installed from the registry (default `clerum/nginx-egress-proxy:0.1.0`).
+
+OAuth secrets — **both are required in production**; control-api refuses to start without them (see [Generating Secrets and Keys](#generating-secrets-and-keys)):
+
+- `CONTROL_API_OAUTH_STATE_HMAC_SECRET`: HMAC secret for OAuth state parameters.
+- `CONTROL_API_OAUTH_ENCRYPTION_KEY`: encryption key for stored OAuth tokens.
+
Route-policy controls:
- `CONTROL_API_POLICY_AUTH_AUDIENCE`: expected audience used by protected route-policy checks.
@@ -230,18 +240,38 @@ openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out rpc-jwt-privat
openssl pkey -in rpc-jwt-private.pem -pubout -out rpc-jwt-public.pem
```
+Generate the OAuth secrets. **Both are required in production** — control-api
+refuses to start without them (`src/config.ts`, `requiredOrDevDefault`), so a
+Secret built by hand without these will crash-loop:
+
+```bash
+# CONTROL_API_OAUTH_STATE_HMAC_SECRET
+openssl rand -hex 32
+
+# CONTROL_API_OAUTH_ENCRYPTION_KEY
+openssl rand -hex 32
+```
+
When storing PEM values in env vars/secrets, preserve line breaks (or encode as `\n` and normalize at runtime).
+> The scripted paths already do all of the above —
+> [`deploy/scripts/gen-jwt-keys.sh`](../deploy/scripts/gen-jwt-keys.sh) and
+> [`scripts/minikube/generate-keys.sh`](../scripts/minikube/generate-keys.sh)
+> generate every key in this section, including the two OAuth secrets. Prefer
+> them over assembling the Secret by hand.
+
## Deployment
+Build and push the image:
+
```bash
cd control-api
-kubectl apply -f deploy/example.secret.yaml
make docker-push
-make deploy
```
-`deploy/deployment.yaml` expects RSA key material in the `control-api-secrets` Secret:
+Manifests live under `deploy/base/control-plane/` and are applied via the Kustomize overlays from the repo root (`make minikube-deploy-all`).
+
+`deploy/base/control-plane/control-api.yaml` expects RSA key material in the `control-api-secrets` Secret, including:
- `CONTROL_API_SESSION_JWT_PRIVATE_KEY`
- `CONTROL_API_RPC_JWT_PRIVATE_KEY`
diff --git a/control-api/src/routes/rpc-access/users.ts b/control-api/src/routes/rpc-access/users.ts
index 7ab014985..21160f202 100644
--- a/control-api/src/routes/rpc-access/users.ts
+++ b/control-api/src/routes/rpc-access/users.ts
@@ -66,12 +66,12 @@ export function createRpcAccessUsersRouter(gateway: K8sGateway): Router {
)
// Authorization gate: verifies the user has an explicit user_agents row for
- // the requested host. This check was introduced in 4d8f9a7 (2026-03-10) but
- // the population path (HostWizard Step 5 "Access") was not enforced, causing
- // a ~30-day production incident where agents created without selecting users
- // were silently unusable. Fixed in 61d62d2 + 48ff7d6 (2026-04-09/10).
- // Population: PUT /admin/agents/:agentName/users (agentAccess.setAgentUsers).
- // Tests: test/routes.rpcAccessUsersMcpHost.test.ts (16 cases).
+ // the requested host (directly, or via team membership) before returning the
+ // host's invocation URL. Without an explicit grant, an agent created without
+ // selecting any authorized users would otherwise be silently unusable by
+ // everyone. Population: PUT /admin/agents/:agentName/users
+ // (agentAccess.setAgentUsers). Tests: test/routes.rpcAccessUsersMcpHost.test.ts
+ // (16 cases).
router.get(
'/rpc/access/users/:userId/mcp-hosts/:hostRef',
requireValidRpcAccessTokenAny([
diff --git a/control-api/test/imagePolicy.test.ts b/control-api/test/imagePolicy.test.ts
index 175c4b736..b19ba202f 100644
--- a/control-api/test/imagePolicy.test.ts
+++ b/control-api/test/imagePolicy.test.ts
@@ -35,7 +35,7 @@ describe('extracted helpers (behavior parity with coordinator)', () => {
describe('classifyPluginImage', () => {
it('accepts current first-party + evenfire images against the default allowlist', () => {
for (const img of [
- 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp-server:latest',
+ 'ghcr.io/evenfire-ai/airtable-mcp-server:latest',
'example.com/acme/forecast:1.2.3',
'mongodb/mongodb-mcp-server:latest',
'mcr.microsoft.com/playwright/mcp@sha256:' + 'a'.repeat(64),
@@ -90,7 +90,7 @@ describe('classifyPluginImage', () => {
describe('DEFAULT_ALLOWED_PLUGIN_IMAGE_PREFIXES', () => {
it('covers the current fleet hosts + evenfire', () => {
expect(DEFAULTS).toEqual([
- 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/',
+ 'ghcr.io/evenfire-ai/',
'example.com/',
'mongodb/',
'mcr.microsoft.com/',
diff --git a/control-api/test/network.gateway.intent.test.ts b/control-api/test/network.gateway.intent.test.ts
index 12da65d48..21208086a 100644
--- a/control-api/test/network.gateway.intent.test.ts
+++ b/control-api/test/network.gateway.intent.test.ts
@@ -478,7 +478,7 @@ describe('network/gateway intent (manifest-level)', () => {
expect(kustomization).toContain('patches/k8s-api-ip-mcp-host.yaml')
expect(patch).toContain('name: allow-k8s-api-egress-mcp-host')
expect(patch).toContain('namespace: mcp-host')
- expect(patch).toContain('cidr: 203.0.113.10/32')
+ expect(patch).toContain('cidr: 203.0.113.1/32')
expect(patch).toContain('port: 443')
expect(patch).toContain('port: 8443')
}
diff --git a/control-api/test/registryImagePullSecret.test.ts b/control-api/test/registryImagePullSecret.test.ts
index 5d4ee7f02..5210ae20c 100644
--- a/control-api/test/registryImagePullSecret.test.ts
+++ b/control-api/test/registryImagePullSecret.test.ts
@@ -41,7 +41,7 @@ describe('imageRefHost', () => {
})
it('parses a GCP Artifact Registry host', () => {
expect(
- imageRefHost('us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp:latest')
+ imageRefHost('ghcr.io/evenfire-ai/airtable-mcp:latest')
).toBe('us-central1-docker.pkg.dev')
})
it('parses a host that carries an explicit port', () => {
diff --git a/control-api/test/routes.adminAgents.test.ts b/control-api/test/routes.adminAgents.test.ts
index 2759100c7..7d294c3fc 100644
--- a/control-api/test/routes.adminAgents.test.ts
+++ b/control-api/test/routes.adminAgents.test.ts
@@ -7,9 +7,9 @@ import { createAdminRouter } from '../src/routes/admin/index.js'
/**
* HTTP-level tests for the admin agents router.
*
- * Covers the NEW PUT /admin/agents/:agentName/users|teams endpoints
- * introduced in commit 61d62d2 as the structural fix for the incident
- * documented in .local-notes/incident-403-user-agents-authorization-gap.md
+ * Covers PUT /admin/agents/:agentName/users|teams, the endpoints that grant
+ * explicit user/team access to an agent so it is invocable via the rpc-access
+ * authorization gate.
*
* The endpoints wrap setAgentUsers/setAgentTeams service functions and
* delegate to bulkSetLinkedItems (destructive semantics: replace the full
diff --git a/control-api/test/routes.registryInstall.test.ts b/control-api/test/routes.registryInstall.test.ts
index f4f1be6ae..ce6814574 100644
--- a/control-api/test/routes.registryInstall.test.ts
+++ b/control-api/test/routes.registryInstall.test.ts
@@ -1479,7 +1479,7 @@ describe('POST /admin/registry/install — evenfire imagePullSecrets attach', ()
vi.mocked(getEntryVersion).mockResolvedValueOnce({
...baseEntry,
mcp_server_meta: {
- imageRef: 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp:1.0',
+ imageRef: 'ghcr.io/evenfire-ai/airtable-mcp:1.0',
port: 3000,
},
} as any)
diff --git a/control-api/test/routes.rpcAccessUsersMcpHost.test.ts b/control-api/test/routes.rpcAccessUsersMcpHost.test.ts
index d8fc3ddb3..535442811 100644
--- a/control-api/test/routes.rpcAccessUsersMcpHost.test.ts
+++ b/control-api/test/routes.rpcAccessUsersMcpHost.test.ts
@@ -4,15 +4,12 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
import type { K8sGateway } from "../src/k8s.js";
/**
- * HTTP-level tests for the authorization gate that was the subject of the
- * 2026-04-09 production incident:
+ * HTTP-level tests for the authorization gate on:
*
* GET /rpc/access/users/:userId/mcp-hosts/:hostRef
*
- * See .local-notes/incident-403-user-agents-authorization-gap.md for the
- * full forensic reconstruction. This file locks down the HANDLER contract
- * so a future refactor cannot silently re-introduce the 403 without us
- * noticing.
+ * This file locks down the HANDLER contract so a future refactor cannot
+ * silently re-introduce a missing-authorization 403 without us noticing.
*
* Scope of these tests: the HANDLER logic (control-api/src/routes/rpc-access/users.ts:95-120).
* The handler implements THREE independent authorization checks after the
diff --git a/control-api/test/services.directory.channels.test.ts b/control-api/test/services.directory.channels.test.ts
index 5c69d54b3..5361e1a6c 100644
--- a/control-api/test/services.directory.channels.test.ts
+++ b/control-api/test/services.directory.channels.test.ts
@@ -6,18 +6,18 @@ describe('directory channel mappings', () => {
expect(
normalizeChannels({
emails: [' [email protected] ', ''],
- telegramHandles: [' @alfredo '],
+ telegramHandles: [' @testuser '],
telegramIds: [' 123456789 '],
slackUserNames: [' U123 '],
- discordUserNames: [' alfredo '],
+ discordUserNames: [' testuser '],
whatsappNumbers: [' +15551234567 '],
})
).toEqual({
emails: ['[email protected]'],
- telegramHandles: ['@alfredo'],
+ telegramHandles: ['@testuser'],
telegramIds: ['123456789'],
slackUserNames: ['U123'],
- discordUserNames: ['alfredo'],
+ discordUserNames: ['testuser'],
whatsappNumbers: ['+15551234567'],
})
})
diff --git a/control-ui/README.md b/control-ui/README.md
index 9267d2cdc..e53232456 100644
--- a/control-ui/README.md
+++ b/control-ui/README.md
@@ -1,65 +1,97 @@
-# Control UI (Next.js)
-
-Internal React/Next.js dashboard for `control-api`.
-
-## Features
-
-- Tabbed explorer for:
- - Hosts
- - Connectors
- - Communication Channels
- - LLM Secrets
-- Row-style resource listing with click-to-expand details
-- Secret-safe display (redacts secret-like fields in expanded JSON)
-- Guided host creation wizard:
- 1. Host naming
- 2. Context creation + unique connector selection
- 3. Communication channel setup (dropdown + inputs)
- 4. Existing/new LLM secret selection
- 5. Host model/provider config + review (OpenAI, Claude, Z.AI presets + custom model override)
-- Profile admin tab (team/member administration):
- - users table with row action to load selected user context
- - explicit `userId` and team selectors
- - create/rename team
- - list/delete members
- - update member role
- - invite member
-- LLM secrets management:
- - list host-secret resources
- - create/update/delete LLM API key secrets
- - backend-safe behavior (secret values are write-only from UI)
-
-## Local
+# Control UI
+
+Admin dashboard for the control plane. A Next.js (App Router) React app that manages agents, connectors, plugins, files, the marketplace, users/teams, cost, and secrets through `control-api`.
+
+## How It Works
+
+- The browser only talks to same-origin paths: all API calls go to `/control-api/*` (base overridable via `NEXT_PUBLIC_CONTROL_API_BASE_URL`).
+- A Next.js route handler (`app/control-api/[...path]/route.ts`) proxies those requests server-side to `CONTROL_API_INTERNAL_URL` (default `http://127.0.0.1:8090`), stripping hop-by-hop headers, with a 30 s upstream timeout.
+- Dashboard pages redirect unauthenticated visitors to the login page — most via `<AuthGate>` (`components/AuthGate`), either directly or through a section shell (e.g. `/cost/*` via `CostShell`); the rest use an equivalent `useAuth` redirect.
+
+## Authentication
+
+Control UI requires an admin login — it is not an open dashboard.
+
+- The root page (`app/page.tsx`) is a username/password login form with a forgot-password flow.
+- Login posts to control-api `POST /api/v1/admin/auth/login`; the session is a signed admin JWT stored in an HttpOnly cookie set by control-api (`components/AuthContext.tsx`, `lib/api.ts`).
+- control-api seeds a bootstrap admin from `CONTROL_API_ADMIN_BOOTSTRAP_USERNAME` / `CONTROL_API_ADMIN_BOOTSTRAP_PASSWORD_HASH` and locks an account after repeated failed logins (`CONTROL_API_ADMIN_AUTH_MAX_FAILURES`, default 5, for `CONTROL_API_ADMIN_AUTH_LOCK_MINUTES`, default 15).
+- The only unauthenticated routes are the public token flows — admin invitations, password resets, and email confirmations (`/admin-invitations/[token]`, `/admin-password-resets/[token]`, `/admin-email-confirmations/[token]`); the invitation and password-reset form posts are CSRF-protected with an HMAC token (`lib/controlAdminCsrf.ts`) — email confirmation has no form post.
+
+## Sections
+
+Sidebar destinations map to canonical App Router routes (`components/Sidebar/constants.tsx`):
+
+| Sidebar label | Route | Contents |
+| ----------------- | -------------------------------------------------------- | -------------------------------------------------------------------------------- |
+| Agents | `/hosts` | Host list, detail tabs, guided creation wizard, per-tool approval overrides |
+| Connectors | `/mcp-servers` | MCP server resources: list, create, edit, egress policy |
+| Plugins | `/workflow-recipes` | Workflow recipes by namespace/name: editor, secrets, integrations, runs |
+| Shared Files | `/shared-filesystems` | Shared filesystem resources |
+| Global Files | `/gfs` | Global File System browser and grant delegation |
+| Marketplace | `/registry` | Registry catalog plus `/registry/install`, `/registry/keys`, `/registry/publish` |
+| Publisher | `/publisher` | Publisher credentials, entries, shared-with-me |
+| External Channels | `/communication-channels` | Communication channel resources |
+| Users & Teams | `/profile-admin/users` | Users, teams, and admins administration |
+| Contexts | `/contexts` | Context resources with per-context tabs |
+| Secrets | `/secrets` | Secrets by scope, plus recipe secrets (values are write-only from the UI) |
+| Outputs | `/outputs` | Generated outputs |
+| Cost & Usage | `/cost/usage`, `/cost/llm-prices`, `/cost/token-budgets` | Token usage dashboard, model prices, token budgets |
+| Settings | `/settings` | Control settings panel |
+
+Routes not in the sidebar: `/control-admins/new` (invite a control admin), `/plugin-workload-sdk` (SDK grants and invocation search), and the public token flows listed above. Old top-level `/usage`, `/llm-prices`, and `/token-budgets` paths permanently redirect under `/cost/*` (`next.config.js`).
+
+## Notable Features
+
+- **UsageDashboard** (`components/UsageDashboard`) — recharts stacked-area chart of input/output tokens over time, with breakdowns including team, model, agent (host), and desktop user (8 group-by dimensions in all — also recipe, provider, LLM secret, and source kind).
+- **LlmPriceTable / TokenBudgetTable** — per-1M-token model prices (input, output, cache read/write) and token budgets with scope and progress. Budgets are cost control, not a security boundary.
+- **RegistryCatalog** (`components/RegistryCatalog.tsx`) — marketplace entries with trust levels (high/mid/low), a guided install flow, and org-scoped publish API keys (create/reveal/revoke) under `/registry/keys`.
+- **HostApprovalSection** (`components/HostApprovalSection`) — per-tool approval editor (Default/Required/Skip) for a host's native tools, with risk hints whenever a setting loosens a required-by-default approval.
+- **EgressEditor** (`components/EgressEditor.tsx`) — egress policy editor with closed-by-default, exact-host, exact-CIDR/IP, and public-web modes; private, metadata, link-local, and reserved IPv4 ranges are rejected (`lib/egressModel.ts`).
+
+## Configuration
+
+| Variable | Explanation | Canonical example |
+| ------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------- |
+| `CONTROL_API_INTERNAL_URL` | Server-side proxy target for `/control-api/*` requests. | `http://control-api.control-plane.svc.cluster.local:8090` |
+| `CONTROL_UI_PUBLIC_TOKEN_CSRF_SECRET` | HMAC secret for CSRF tokens on public token pages (invitations, password resets). | random string (set via `control-ui-secrets`) |
+| `NEXT_PUBLIC_CONTROL_API_BASE_URL` | Browser-side API base path; defaults to the same-origin `/control-api` proxy. | `/control-api` |
+| `NEXT_PUBLIC_CLERUM_ENABLE_LOCAL_TEMPLATES` | Shows local recipe templates in the recipe editor. | `true` |
+| `PORT` | Inert — the Docker `CMD` runs `next start -p 3000`, and `-p` overrides `PORT`. | `3000` |
+
+## Ports
+
+- `3000` — Next.js HTTP server (`npm run start` binds `-p 3000`; the in-cluster Service exposes the same port).
+
+## Local Development
```bash
cd control-ui
npm install
+npm run dev # needs CONTROL_API_INTERNAL_URL pointing at a control-api
```
-Then from the repository root:
+Or from the repository root, `npm run web` (→ `make local-web`) port-forwards `control-api` to `localhost:8090`, waits for it to become healthy, then starts the UI with `CONTROL_API_INTERNAL_URL=http://localhost:8090`.
-1. Start the UI with:
+### npm scripts
-```bash
-npm run web
-```
+| Script | Command |
+| ------------ | --------------------------------------------- |
+| `dev` | `NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev` |
+| `build` | `NEXT_IGNORE_INCORRECT_LOCKFILE=1 next build` |
+| `start` | `next start -p 3000` |
+| `test` | `vitest run` |
+| `test:watch` | `vitest` |
+
+## Testing
-This reuses the root `Makefile` to start `control-api` on `localhost:8090`, waits until the port is reachable, then runs `control-ui` locally. When you exit, the port-forward is stopped too.
+- **Unit/component tests**: 77 Vitest files (jsdom + Testing Library) — 54 under `components/__tests__/`, 21 under `lib/__tests__/`, 2 under `lib/hooks/__tests__/` — `npm test`.
+- **End-to-end tests**: 25 Playwright specs under `e2e/` (`npx playwright test`), covering operator journeys such as registry install, approval flows, GFS, and workflow runs against a running cluster (`CONTROL_UI_URL` sets the base URL).
## Deploy
```bash
cd control-ui
-make docker-push
-make deploy
+make docker-push # build + push the image
```
-In-cluster service URL:
-
-`http://control-ui.control-plane.svc.cluster.local:3000`
-
-Notes:
-
-- Browser requests use same-origin `/control-api/*`.
-- A dedicated Next.js route handler proxies those requests to `CONTROL_API_INTERNAL_URL`.
-- UI assumes cluster-admin trust boundary (for example SSH/VPN access controls) and does not require end-user login.
+Kubernetes manifests live in `deploy/base/control-plane/control-ui.yaml` (namespace `control-plane`); in-cluster service URL: `http://control-ui.control-plane.svc.cluster.local:3000`.
diff --git a/control-ui/components/HostWizard/index.tsx b/control-ui/components/HostWizard/index.tsx
index bf7694ddb..979daee75 100644
--- a/control-ui/components/HostWizard/index.tsx
+++ b/control-ui/components/HostWizard/index.tsx
@@ -878,9 +878,7 @@ export function HostWizard({
// Associate authorized users and teams with the new agent in a single
// atomic call each, rather than looping N×(GET+PUT) per selection.
- // Uses the agent-centric endpoints PUT /admin/agents/:name/users|teams
- // added as part of the incident fix. See:
- // .local-notes/incident-403-user-agents-authorization-gap.md
+ // Uses the agent-centric endpoints PUT /admin/agents/:name/users|teams.
if (selectedUserIds.length > 0) {
await updateAgentUsers(normalizedHostName, selectedUserIds)
}
diff --git a/control-ui/components/RecipeEditor.tsx b/control-ui/components/RecipeEditor.tsx
index 25bf54915..5c26bd52f 100644
--- a/control-ui/components/RecipeEditor.tsx
+++ b/control-ui/components/RecipeEditor.tsx
@@ -196,7 +196,7 @@ const TEMPLATES: RecipeTemplate[] = [
{
id: 'mongodb-mcp',
type: 'deployment',
- image: 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/mcp-mongodb:latest',
+ image: 'ghcr.io/evenfire-ai/mcp-mongodb:latest',
port: 3000,
transport: { type: 'streamableHttp' },
envSecret: {
diff --git a/control-ui/components/__tests__/HostWizard.test.tsx b/control-ui/components/__tests__/HostWizard.test.tsx
index 61b0cac07..8d84d99b6 100644
--- a/control-ui/components/__tests__/HostWizard.test.tsx
+++ b/control-ui/components/__tests__/HostWizard.test.tsx
@@ -6,12 +6,10 @@ import { HostWizard } from '../HostWizard'
import { ToastProvider } from '../Toast'
/**
- * Tests for the HostWizard refactor that closes the authorization gap
- * described in .local-notes/incident-403-user-agents-authorization-gap.md
- *
- * The incident root cause: admins were creating agents without selecting
- * any user in the "Access" step (labeled "optional"), which silently left
- * them unusable by everyone. The fix adds:
+ * Tests for the HostWizard refactor that closes an authorization gap: admins
+ * could create agents without selecting any user in the "Access" step
+ * (labeled "optional"), which silently left them unusable by everyone. The
+ * fix adds:
*
* 1. A visible empty-access note when selection is empty
* 2. A non-blocking access reminder before continuing
diff --git a/control-ui/lib/recipeDefaults.ts b/control-ui/lib/recipeDefaults.ts
index 8e2a879fb..00ad7c018 100644
--- a/control-ui/lib/recipeDefaults.ts
+++ b/control-ui/lib/recipeDefaults.ts
@@ -30,7 +30,7 @@ export const DEFAULT_OPERATOR_DEFAULTS: OperatorDefaults = {
nonMcpWorkloads: 'sandbox-recipes',
},
registry: {
- prefix: 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/',
+ prefix: 'ghcr.io/evenfire-ai/',
imagePullSecrets: [],
},
}
diff --git a/deploy/scripts/validate-assembled-image-allowlist.sh b/deploy/scripts/validate-assembled-image-allowlist.sh
index cebf2eb9f..7a577181c 100644
--- a/deploy/scripts/validate-assembled-image-allowlist.sh
+++ b/deploy/scripts/validate-assembled-image-allowlist.sh
@@ -19,7 +19,7 @@ for env in gcp-dev gcp-prod; do
# `value: …` on the NEXT line — capture both.
prefixes="$(printf '%s\n' "$rendered" | grep -A1 -E 'ALLOWED_IMAGE_PREFIXES' || true)"
echo "--- $env allowlist lines ---"; printf '%s\n' "$prefixes"
- if ! printf '%s\n' "$prefixes" | grep -q 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/'; then
+ if ! printf '%s\n' "$prefixes" | grep -q 'ghcr.io/evenfire-ai/'; then
echo "::error::[$env] allowlist missing real AR prefix"; fail=1
fi
if printf '%s\n' "$prefixes" | grep -qE '\$\{GCP_PROJECT\}|example\.com/'; then
diff --git a/deploy/scripts/validate-hcc-gcp-pull-ref-render.sh b/deploy/scripts/validate-hcc-gcp-pull-ref-render.sh
index fac10344e..6d09304c8 100644
--- a/deploy/scripts/validate-hcc-gcp-pull-ref-render.sh
+++ b/deploy/scripts/validate-hcc-gcp-pull-ref-render.sh
@@ -28,7 +28,7 @@ required_empty = [
# to the neutral placeholder.
required_values = {
"CONTEXT_MAPPER_ALLOWED_IMAGE_PREFIXES" =>
- "us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/,example.com/,mongodb/,mcr.microsoft.com/,clerum/",
+ "ghcr.io/evenfire-ai/,example.com/,mongodb/,mcr.microsoft.com/,clerum/",
}
def fail!(overlay, message)
diff --git a/deploy/scripts/validate-workflow-approval-reader-render.sh b/deploy/scripts/validate-workflow-approval-reader-render.sh
index cda6175dd..8e0191cee 100644
--- a/deploy/scripts/validate-workflow-approval-reader-render.sh
+++ b/deploy/scripts/validate-workflow-approval-reader-render.sh
@@ -42,7 +42,7 @@ files.each do |overlay, path|
fail!(overlay, "unexpected image #{image}") unless image == "clerum/workflow-approval-request-reader:test"
fail!(overlay, "unexpected imagePullPolicy #{pull_policy}") unless pull_policy == "IfNotPresent"
else
- expected_prefix = "us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/workflow-approval-request-reader:"
+ expected_prefix = "ghcr.io/evenfire-ai/workflow-approval-request-reader:"
fail!(overlay, "image is not rewritten to Artifact Registry: #{image}") unless image.start_with?(expected_prefix)
fail!(overlay, "unexpected imagePullPolicy #{pull_policy}") unless pull_policy == "Always"
end
diff --git a/desktop-app/README.md b/desktop-app/README.md
index d2e8ed9f6..72438795f 100644
--- a/desktop-app/README.md
+++ b/desktop-app/README.md
@@ -5,12 +5,24 @@ Electron desktop client with a React renderer. The app authenticates through `ex
## Security Model
- User session token is obtained from `external-rest-api`.
-- RPC access token is issued by `external-rest-api` via `control-api` and is scoped (`mcp:servers:list`, `mcp:server:invoke`, `host:health:read`, `host:status:read`, `host:activity:read`, `host:message:invoke`) and short-lived.
+- RPC access token is issued by `external-rest-api` via `control-api` and is scoped (`mcp:servers:list`, `mcp:server:invoke`, `host:health:read`, `host:status:read`, `host:activity:read`, `host:message:invoke`, `host:task:read`, `host:session:read`, `host:approval:write`, `desktop:view`, `sandbox:ui:view`) and short-lived.
- Desktop app calls only:
- `external-rest-api` for user/session and token issuance.
- `rpc-proxy` for agent discovery and invocation.
+ - `member-registration-service` for the invitation/activation flow (invitation profile lookup and desktop setup completion).
- `control-api` internal service tokens are never stored in the desktop app.
+> **`member-registration-service` is not in this repository.** It is an extracted
+> sibling service, expected in-cluster at
+> `member-registration-service.registration.svc.cluster.local:8092`
+> (`deploy/base/control-plane/configmaps.yaml`). Everything else the desktop app
+> needs is here; only the **invitation / activation flow** depends on it, so
+> without that service you can still log in and drive agents, but you cannot
+> complete an invitation-based signup. Point
+> `MEMBER_REGISTRATION_SERVICE_BASE_URL` at your own deployment of it — the
+> variable has no working default (see
+> [Environment Variables](#environment-variables)).
+
## Implemented Flows
- Google login with direct `idToken` submit (`POST /api/v1/auth/google`)
@@ -56,7 +68,7 @@ The app now auto-populates default RPC `hostRefs` from authorized agent names re
- `EXTERNAL_REST_API_BASE_URL` (default: `http://127.0.0.1:8091`)
- `RPC_PROXY_BASE_URL` (default: `http://127.0.0.1:8094`)
-- `MEMBER_REGISTRATION_SERVICE_BASE_URL` (default: `http://127.0.0.1:8092`)
+- `MEMBER_REGISTRATION_SERVICE_BASE_URL` (no working default — falls back to the placeholder `https://example.com`, so set it explicitly; locally this is usually `http://127.0.0.1:8092`)
- `REQUEST_TIMEOUT_MS` (default: `60000`)
## Architecture
@@ -109,60 +121,28 @@ npm run build
npm run start
```
-## Signed macOS releases
-
-The packaged macOS app uses the stable bundle ID `ai.evenfire.desktop` by default. Override it with
-`APPLE_BUNDLE_ID` only if you intentionally need a different identifier.
-
-To build a signed and notarized macOS app locally, you need:
+## Port-forward Remote Cluster Services
-- a `Developer ID Application` certificate installed in your macOS keychain
-- a notarization profile created with `xcrun notarytool store-credentials`
+The root launcher already starts the required port-forwards for normal local development.
-Local example:
+To start them manually (control-api `:8090`, external-rest-api `:8091`, rpc-proxy `:8094` — the set the desktop app and both E2E phases need), run from the repository root:
```bash
-cd desktop-app
-ENABLE_APPLE_CODESIGN=1 \
-APPLE_KEYCHAIN_PROFILE=evenfire-notary \
-npm run make:mac:arm64
+make minikube-pf-desktop
```
-If you want to authenticate notarization with a raw App Store Connect API key file instead of a
-stored keychain profile, set all three of these environment variables:
-
-- `APPLE_API_KEY`
-- `APPLE_API_KEY_ID`
-- `APPLE_API_ISSUER`
-
-GitHub Actions mac release builds expect these secrets:
-
-- `APPLE_CERT_P12_BASE64`
-- `APPLE_CERT_PASSWORD`
-- `APPLE_API_KEY_P8`
-- `APPLE_API_KEY_ID`
-- `APPLE_API_ISSUER`
-
-`APPLE_API_KEY_P8` should contain the raw multi-line contents of the downloaded
-`AuthKey_<KEY_ID>.p8` file. `APPLE_CERT_P12_BASE64` should contain the base64-encoded `.p12`
-export of your `Developer ID Application` certificate.
-
-Two `.p12` requirements for the CI keychain import:
+Individual targets, if you only need one:
-- Include the Apple "Developer ID Certification Authority (G2)" intermediate certificate in the
- `.p12` (`openssl pkcs12 -export ... -certfile DeveloperIDG2CA.pem`). Without it the imported
- identity is invalid inside the runner's temporary keychain and `codesign` finds no identity.
-- If you build the `.p12` with OpenSSL 3, use legacy-compatible encryption:
- `-certpbe PBE-SHA1-3DES -keypbe PBE-SHA1-3DES -macalg sha1`. macOS `security import` cannot
- read OpenSSL 3's default AES/PBKDF2 PKCS#12 files ("MAC verification failed").
-
-## Port-forward Remote Cluster Services
+```bash
+make minikube-pf-control-api # control-api → localhost:8090
+make minikube-pf-external-api # external-rest-api → localhost:8091
+make minikube-pf-rpc-proxy # rpc-proxy → localhost:8094
+```
-The root launcher already starts the required port-forwards for normal local development. Optional manual debugging commands:
+Optional, only for the invitation/activation flow against `profile-ui`:
```bash
kubectl -n profiles port-forward svc/profile-ui 3001:3001
-kubectl -n control-plane port-forward svc/control-api 8090:8090
```
## Testing
@@ -180,11 +160,11 @@ Runs real IPC handlers against a live cluster via port-forwards. No Electron win
**Prerequisites:**
-1. Port-forwards active (see [Port-forward Remote Cluster Services](#port-forward-remote-cluster-services))
+1. Port-forwards for external-rest-api (`:8091`) and rpc-proxy (`:8094`) active — `make minikube-pf-desktop` from the repo root covers them (see [Port-forward Remote Cluster Services](#port-forward-remote-cluster-services))
2. Copy env template: `cp .env.e2e.example .env.e2e` and set `E2E_DEV_LOGIN_EMAIL` to an authorized user and `E2E_HOST_REF` to an accessible agent.
```bash
-npm run test:e2e # 19 tests — auth, teams, catalog, messages, streams, tokens (~45s)
+npm run test:e2e # 33 tests — auth, teams, catalog, messages, sessions, streams, tokens
```
**What it tests:** Login round-trip, dependencies health, team listing, access catalog, RPC token lifecycle, direct MCP server invocation (JSON-RPC), host message delivery (LLM), host status/activity polling, SSE activity/status/progress streams, stream cleanup, token metadata/refresh, unauthenticated error path, logout.
@@ -197,31 +177,42 @@ Launches the real Electron app, interacts with the UI, and sends real prompts to
**Prerequisites:**
-1. Same as Phase 1 (port-forwards + `.env.e2e`)
+1. Same as Phase 1 (`.env.e2e`), plus a control-api port-forward (`:8090`) — the Playwright global-setup health-checks control-api, external-rest-api and rpc-proxy before any test runs.
2. App must be built first (`npm run build`)
+3. A kubectl context the global-setup allows. It defaults to `E2E_K8S_CONTEXT=clerum-test`, rejects anything outside the allow-list (`E2E_ALLOWED_CONTEXTS`, default `clerum-test` plus the GKE dev context), hard-blocks the production context, and **switches your current kubectl context** to the expected one if it differs.
+
+The supported entry point wires all of this together (context guard → port-forwards → seed → Playwright):
+
+```bash
+make e2e-desktop-app # from the repository root; override with E2E_CONTEXT=<ctx>
+```
+
+To run Playwright directly once port-forwards and context are already set up:
```bash
-npm run test:e2e:playwright # 9 tests — builds, then launches Electron (~2-3min)
+npm run test:e2e:playwright # ~81 tests across 40 spec files — builds, then launches Electron
```
-**What it tests:** Login flow (handles persisted sessions), sidebar navigation (all 4 pages), agent list rendering, sending messages with real LLM responses, MongoDB tool calls (`list-databases`), Airtable tool calls (`list_bases`), multi-tool orchestration, progress stepper expand/collapse, error resilience.
+**What it tests:** Login flow (handles persisted sessions), sidebar navigation, agent list rendering, sending messages with real LLM responses, tool calls and multi-tool orchestration, progress stepper expand/collapse, approval flows, workflow recipes and runs, artifacts, GFS, sandbox-ui, Telegram, cross-device sessions, error resilience.
### Full Suite
```bash
-npm run test:e2e:all # Phase 1 + Phase 2 (~3-4min total)
+npm run test:e2e:all # Phase 1 + Phase 2
```
### Environment Configuration (`.env.e2e`)
-| Variable | Default | Description |
-| -------------------------------------- | ----------------------- | ---------------------------------------------- |
-| `EXTERNAL_REST_API_BASE_URL` | `http://localhost:8091` | external-rest-api URL |
-| `RPC_PROXY_BASE_URL` | `http://localhost:8094` | rpc-proxy URL |
-| `MEMBER_REGISTRATION_SERVICE_BASE_URL` | `http://localhost:8092` | member-registration-service activation URL |
-| `E2E_DEV_LOGIN_EMAIL` | `[email protected]` | Test-only login email (must have agent access) |
-| `E2E_DEV_LOGIN_NAME` | `Test User` | Test-only login display name |
-| `E2E_HOST_REF` | `chatllm` | Agent hostRef to test against |
+| Variable | Default | Description |
+| -------------------------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
+| `EXTERNAL_REST_API_BASE_URL` | `http://localhost:8091` | external-rest-api URL |
+| `RPC_PROXY_BASE_URL` | `http://localhost:8094` | rpc-proxy URL |
+| `MEMBER_REGISTRATION_SERVICE_BASE_URL` | `https://example.com` (placeholder — set it) | member-registration-service activation URL. There is no working default: unset, it silently points at `example.com`. |
+| `E2E_DEV_LOGIN_EMAIL` | `[email protected]` | Test-only login email (must have agent access) |
+| `E2E_DEV_LOGIN_EMAIL_2` | `[email protected]` | Second user, required by the cross-device session tests |
+| `E2E_DEV_LOGIN_NAME` | `Test User` | Test-only login display name |
+| `E2E_HOST_REF` | `chatllm` | Agent hostRef to test against |
+| `E2E_ALLOW_DEV_PORT_FORWARD` | unset (off) | Set to `1`/`true` to let the Playwright global-setup guard accept localhost port-forward URLs |
## Notes
diff --git a/desktop-app/test/e2e-playwright/telegram-approval-medium-verification.test.ts b/desktop-app/test/e2e-playwright/telegram-approval-medium-verification.test.ts
index 872c95733..04343bd57 100644
--- a/desktop-app/test/e2e-playwright/telegram-approval-medium-verification.test.ts
+++ b/desktop-app/test/e2e-playwright/telegram-approval-medium-verification.test.ts
@@ -66,21 +66,21 @@ const VERIFIED_TELEGRAM_IDENTITY: TelegramClientIdentity = {
providerUserId: TELEGRAM_PRIVATE_ID,
providerChannelId: TELEGRAM_PRIVATE_ID,
providerChannelType: 'private',
- conversationLabel: 'Alfredo Lopez - verified Telegram private chat',
+ conversationLabel: 'Test User - verified Telegram private chat',
}
const VERIFIED_TELEGRAM_GROUP_IDENTITY: TelegramClientIdentity = {
providerUserId: TELEGRAM_PRIVATE_ID,
providerChannelId: TELEGRAM_GROUP_ID,
providerChannelType: 'group',
- conversationLabel: 'Alfredo Lopez - verified Telegram group',
+ conversationLabel: 'Test User - verified Telegram group',
}
const WRONG_CHANNEL_IDENTITY: TelegramClientIdentity = {
providerUserId: TELEGRAM_PRIVATE_ID,
providerChannelId: '424243',
providerChannelType: 'private',
- conversationLabel: 'Alfredo Lopez - mismatched Telegram private chat',
+ conversationLabel: 'Test User - mismatched Telegram private chat',
}
function telegramBinding(identity: TelegramClientIdentity): TelegramMediumBinding {
diff --git a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost-status-health.test.ts b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost-status-health.test.ts
index 0e1ad1bdf..c9f11b630 100644
--- a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost-status-health.test.ts
+++ b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost-status-health.test.ts
@@ -51,7 +51,7 @@ type TelegramClientIdentity = TelegramMediumBinding & {
const DEFAULT_TELEGRAM_CLIENT_IDENTITY: TelegramClientIdentity = {
providerUserId: TELEGRAM_PROVIDER_USER_ID,
providerChannelId: TELEGRAM_CHAT_ID,
- conversationLabel: 'Alfredo Lopez - Telegram private chat',
+ conversationLabel: 'Test User - Telegram private chat',
}
async function click(locator: Locator): Promise<void> {
diff --git a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/fakeTelegramProvider.ts b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/fakeTelegramProvider.ts
index 4623ebaec..3487e0705 100644
--- a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/fakeTelegramProvider.ts
+++ b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/fakeTelegramProvider.ts
@@ -167,15 +167,15 @@ const providerClientHtml = String.raw`<!doctype html>
<input id="provider-user-id" name="providerUserId" data-testid="telegram-provider-user-id" type="hidden" value="${TELEGRAM_PROVIDER_USER_ID}" />
<input id="provider-channel-id" name="providerChannelId" data-testid="telegram-provider-channel-id" type="hidden" value="${TELEGRAM_CHAT_ID}" />
<input id="provider-channel-type" name="providerChannelType" data-testid="telegram-provider-channel-type" type="hidden" value="private" />
- <input id="conversation-label" name="conversationLabel" data-testid="telegram-conversation-label" type="hidden" value="Alfredo Lopez - Telegram private chat" />
+ <input id="conversation-label" name="conversationLabel" data-testid="telegram-conversation-label" type="hidden" value="Test User - Telegram private chat" />
<section class="identity-card" data-testid="telegram-conversation-card" aria-label="Telegram conversation">
<span>Telegram conversation</span>
- <strong data-testid="telegram-conversation-name">Alfredo Lopez - Telegram private chat</strong>
+ <strong data-testid="telegram-conversation-name">Test User - Telegram private chat</strong>
<span>Fake provider route for channel-reader</span>
</section>
<label for="conversation-select">Conversation</label>
<select id="conversation-select" name="conversationSelect" data-testid="telegram-conversation-select">
- <option value="Alfredo Lopez - Telegram private chat" data-user-id="${TELEGRAM_PROVIDER_USER_ID}" data-channel-id="${TELEGRAM_CHAT_ID}" data-channel-type="private">Alfredo Lopez - Telegram private chat</option>
+ <option value="Test User - Telegram private chat" data-user-id="${TELEGRAM_PROVIDER_USER_ID}" data-channel-id="${TELEGRAM_CHAT_ID}" data-channel-type="private">Test User - Telegram private chat</option>
</select>
<label for="message-text">Message</label>
<textarea id="message-text" name="messageText" data-testid="telegram-message-text"></textarea>
diff --git a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/realTelegramChannel.ts b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/realTelegramChannel.ts
index a08dcc014..c4fce976f 100644
--- a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/realTelegramChannel.ts
+++ b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/realTelegramChannel.ts
@@ -32,11 +32,11 @@ export function realTelegramConfigOrNull(): RealTelegramConfig | null {
const providerChannelId = process.env.E2E_REAL_TELEGRAM_CHAT_ID || ''
if (!botToken || !providerUserId || !providerChannelId) return null
return {
- botName: process.env.E2E_REAL_TELEGRAM_BOT_NAME || 'AlfmoltyBot',
+ botName: process.env.E2E_REAL_TELEGRAM_BOT_NAME || 'TestBot',
botToken,
providerUserId,
providerChannelId,
- visualUsername: process.env.E2E_REAL_TELEGRAM_USERNAME || 'alfredolopez80',
+ visualUsername: process.env.E2E_REAL_TELEGRAM_USERNAME || 'testuser',
}
}
diff --git a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramApprovalJourneySpec.ts b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramApprovalJourneySpec.ts
index ed0295929..61500ad9d 100644
--- a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramApprovalJourneySpec.ts
+++ b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramApprovalJourneySpec.ts
@@ -67,12 +67,12 @@ test.describe('3rd-party AuthN + 1st-party MCP-host through channel-reader', ()
const verifiedTelegramIdentity: TelegramClientIdentity = {
providerUserId: TELEGRAM_CHAT_ID,
providerChannelId: TELEGRAM_CHAT_ID,
- conversationLabel: 'Alfredo Lopez - verified Telegram private chat',
+ conversationLabel: 'Test User - verified Telegram private chat',
}
const wrongChannelIdentity: TelegramClientIdentity = {
providerUserId: verifiedTelegramIdentity.providerUserId,
providerChannelId: `${TELEGRAM_CHAT_ID}-wrong`,
- conversationLabel: 'Alfredo Lopez - Telegram wrong chat',
+ conversationLabel: 'Test User - Telegram wrong chat',
}
const unboundIdentity: TelegramClientIdentity = {
providerUserId: `${verifiedTelegramIdentity.providerUserId}-unbound`,
diff --git a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramAuthzSpec.ts b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramAuthzSpec.ts
index f6cda84f1..2aa4bbb3a 100644
--- a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramAuthzSpec.ts
+++ b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramAuthzSpec.ts
@@ -51,7 +51,7 @@ test.describe('3rd-party AuthN + 1st-party MCP-host through channel-reader', ()
test.setTimeout(900_000)
expect(process.env.E2E_WORKFLOW_APPROVAL_QUADRANTS ?? '').not.toBe('1')
- const userARecipe = makeScopedE2ERecipeName('alfredo-personal')
+ const userARecipe = makeScopedE2ERecipeName('testuser-personal')
const userBRecipe = makeScopedE2ERecipeName('belen-personal')
const teamOnlyRecipe = makeScopedE2ERecipeName('acme-team')
const membershipOnlyRecipe = makeScopedE2ERecipeName('membership-only')
@@ -67,7 +67,7 @@ test.describe('3rd-party AuthN + 1st-party MCP-host through channel-reader', ()
const telegramUserA: TelegramClientIdentity = {
providerUserId: String(800_000_000 + telegramIdentitySeed * 10 + 1),
providerChannelId: String(810_000_000 + telegramIdentitySeed * 10 + 1),
- conversationLabel: 'Alfredo Lopez - Telegram private chat',
+ conversationLabel: 'Test User - Telegram private chat',
}
const telegramUserB: TelegramClientIdentity = {
providerUserId: String(800_000_000 + telegramIdentitySeed * 10 + 2),
@@ -77,7 +77,7 @@ test.describe('3rd-party AuthN + 1st-party MCP-host through channel-reader', ()
const telegramUserAWrongChannel: TelegramClientIdentity = {
providerUserId: telegramUserA.providerUserId,
providerChannelId: String(810_000_000 + telegramIdentitySeed * 10 + 3),
- conversationLabel: 'Alfredo Lopez - Telegram secondary chat',
+ conversationLabel: 'Test User - Telegram secondary chat',
}
const telegramMessageBase = Math.floor(Date.now() / 1000) * 1000
let telegramPage: Page | null = null
diff --git a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramE2eClient.ts b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramE2eClient.ts
index 4a87d5136..83842d299 100644
--- a/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramE2eClient.ts
+++ b/desktop-app/test/e2e-playwright/third-party-authn-first-party-mcphost/telegramE2eClient.ts
@@ -28,7 +28,7 @@ export type TelegramClientIdentity = TelegramMediumBinding & {
export const DEFAULT_TELEGRAM_CLIENT_IDENTITY: TelegramClientIdentity = {
providerUserId: TELEGRAM_PROVIDER_USER_ID,
providerChannelId: TELEGRAM_CHAT_ID,
- conversationLabel: 'Alfredo Lopez - Telegram private chat',
+ conversationLabel: 'Test User - Telegram private chat',
}
async function humanPause(minMs = 220, maxMs = 520): Promise<void> {
diff --git a/docs/features/ai-recipe-builder-app-architecture.md b/docs/features/ai-recipe-builder-app-architecture.md
deleted file mode 100644
index 87e421dab..000000000
--- a/docs/features/ai-recipe-builder-app-architecture.md
+++ /dev/null
@@ -1,644 +0,0 @@
-# AI Recipe Builder App Architecture
-
-The AI Recipe Builder is a Clerum-native sandbox application for designing
-`WorkflowRecipe` manifests through a guided LLM conversation. It appears inside
-the Desktop App as a custom app, lets the operator talk naturally with an AI
-agent, drafts a reviewable plan, and only generates WorkflowRecipe YAML after
-the operator confirms that plan.
-
-The app is intentionally conservative. It does not install generated recipes,
-publish registry entries, or mutate Kubernetes. Its job is to help an operator
-think through the design, produce safer starter YAML, surface required setup
-steps, and leave final install/publish decisions to Control UI or Control API.
-
-## What It Is
-
-At a high level, the app is a recipe-design assistant:
-
-- It runs inside Clerum as a `WorkflowRecipe`.
-- It exposes a custom UI inside Desktop App -> Apps.
-- It has a backend API that can call an OpenAI-compatible LLM provider.
-- It chats naturally with the operator before producing YAML.
-- It separates planning from creation with an explicit `Confirm plan` button.
-- It validates generated YAML locally before showing it to the operator.
-- It emits a registry payload and setup checklist for human review.
-
-The main product idea is simple: recipe creation should feel like working with a
-technical teammate, not filling out a brittle form. The operator can describe an
-app, workflow, MCP tool, webhook integration, OAuth flow, scheduled job, or data
-service in natural language. The assistant asks clarifying questions when the
-request is vague, drafts a concrete plan when enough detail exists, and generates
-YAML only after confirmation.
-
-## Why It Is A WorkflowRecipe
-
-We kept this as a `WorkflowRecipe` instead of a standalone MCP server because
-the desired user experience is a custom UI inside the Desktop App. MCP servers
-are excellent for exposing tools to agents, but they do not by themselves provide
-a rich embedded application surface. A WorkflowRecipe can expose a sandbox UI
-while still running a backend workload with controlled secrets and egress.
-
-This gives us the better fit for this use case:
-
-- The user gets a first-class app tile in Desktop.
-- The UI can provide chat, plan review, copy buttons, generated YAML, registry
- payloads, validation output, and theme controls.
-- The backend can hold the optional LLM secret.
-- The recipe remains permission-light and operator-approved.
-
-## Runtime Shape
-
-The deployed app has two workloads:
-
-```text
-Desktop App
- -> sandbox-ui/ui workload
- -> internal egress/proxy to sandbox-recipes/api workload
- -> optional exact-host egress to LLM provider
-```
-
-The `WorkflowRecipe` custom resource lives in `sandbox-recipes`, following the
-repo invariant that all WorkflowRecipe CRDs belong there. The rendered UI
-workload runs in `sandbox-ui`, and the backend API workload runs in
-`sandbox-recipes`.
-
-The UI workload does not receive AI provider secrets. It proxies API calls to the
-backend by using `RECIPE_BUILDER_PROXY_TARGET`, which is rendered from the recipe
-template as:
-
-```yaml
-value: 'http://{{api:host}}:{{api:port}}'
-```
-
-The API workload optionally receives the `ai-recipe-builder-llm` Secret:
-
-```text
-RECIPE_BUILDER_API_KEY
-RECIPE_BUILDER_BASE_URL
-RECIPE_BUILDER_MODEL
-```
-
-If the secret is missing, the app still works in deterministic mode. In
-deterministic mode it can infer capabilities, create a conservative plan, and
-generate starter YAML without calling an external model.
-
-## User Experience
-
-The current UI is a single-page app with these primary areas:
-
-- Header with service health, configured model, and light/dark toggle.
-- Natural-language chat panel.
-- Plan review panel.
-- Generated result panel with assistant notes.
-- Capability chips.
-- Local validation status.
-- Setup checklist.
-- Registry payload preview.
-- WorkflowRecipe YAML preview and copy button.
-
-The chat behavior is intentionally staged:
-
-1. The user can chat casually or ask what the assistant is.
-2. The assistant responds naturally in LLM text mode.
-3. If the user asks for a recipe but the request is underspecified, the assistant
- asks focused clarifying questions.
-4. Once the request is concrete, the assistant returns a structured plan.
-5. The UI shows `Confirm plan`.
-6. Only after confirmation does the backend generate YAML.
-
-This avoids the earlier bad behavior where a greeting like "hi bro" generated a
-fake recipe. A casual message is now treated as conversation, not as build
-intent.
-
-## Feature Summary
-
-The app currently supports:
-
-- Natural language LLM chat.
-- Recipe-intent detection.
-- Clarifying question mode.
-- Plan-first generation.
-- Confirm-before-YAML flow.
-- OpenAI-compatible LLM configuration.
-- Deterministic fallback when AI is disabled or unavailable.
-- Local WorkflowRecipe validation.
-- Inline secret detection guard.
-- Capability inference for UI, database, workflow, MCP, webhook, OAuth, cron,
- and egress.
-- Generated setup checklist.
-- Generated registry payload.
-- Light and dark mode using the Desktop App visual language.
-- Embedded Desktop-safe relative API paths.
-
-## Safety Model
-
-The app is a drafting tool, not an installer.
-
-It does not receive Kubernetes write privileges. It does not apply generated
-YAML. It does not create Secrets. It does not publish to the registry. This is
-intentional.
-
-The generated output still needs operator review because a WorkflowRecipe can
-describe workloads, network access, OAuth clients, webhooks, persistent storage,
-and external integrations. The app tries to make those requirements explicit
-instead of hiding them.
-
-Safety boundaries:
-
-- WorkflowRecipe CRDs are generated for `sandbox-recipes`.
-- Secrets are referenced through `envSecret`, not inline values.
-- Public internet access is represented through explicit `egressBindings`.
-- UI workloads should not receive provider secrets.
-- Generated YAML is locally validated before display.
-- Human approval is required for install and publish.
-
-## Source Layout
-
-The app lives under:
-
-```text
-workflow-recipes/samples/ai-recipe-builder/
- Dockerfile
- README.md
- recipe.yaml
- server.js
- public/
- index.html
- app.js
- styles.css
- test-control-api-permissions.sh
-```
-
-Supporting documentation:
-
-```text
-docs/features/ai-recipe-builder-minikube-operator-cheatsheet.md
-docs/features/ai-recipe-builder-app-architecture.md
-docs/features/control-ui-workflow-recipes-and-registry-guide.md
-```
-
-## WorkflowRecipe Definition
-
-The installable recipe is:
-
-```text
-workflow-recipes/samples/ai-recipe-builder/recipe.yaml
-```
-
-Important fields:
-
-```yaml
-apiVersion: clerum.io/v1alpha1
-kind: WorkflowRecipe
-metadata:
- name: ai-recipe-builder
- namespace: sandbox-recipes
-spec:
- contextRef: context1
- workloads:
- - id: api
- type: deployment
- image: clerum/ai-recipe-builder:0.1.0
- - id: ui
- type: deployment
- image: clerum/ai-recipe-builder:0.1.0
- dependsOn: [api]
- ui:
- workloadRef: ui
- port: 8080
- title: 'AI Recipe Builder'
-```
-
-The `api` workload:
-
-- Runs in `sandbox-recipes`.
-- Hosts `/api/*`.
-- Reads the optional LLM Secret.
-- Has exact-host egress to `api.openai.com` and `api.z.ai`.
-- Performs validation and generation.
-
-The `ui` workload:
-
-- Runs in `sandbox-ui`.
-- Hosts the static HTML/CSS/JS app.
-- Does not receive AI credentials.
-- Proxies `api/*` to the backend API using `RECIPE_BUILDER_PROXY_TARGET`.
-
-Both workloads use the same image. The difference is their environment and
-namespace placement.
-
-## Docker Image
-
-The image is intentionally small:
-
-```dockerfile
-FROM node:20-alpine
-
-USER node
-WORKDIR /home/node/app
-
-COPY --chown=node:node server.js ./
-COPY --chown=node:node public ./public
-
-EXPOSE 8080
-CMD ["node", "server.js"]
-```
-
-There is no `npm install` step because the implementation uses Node built-ins and
-the runtime `fetch` available in Node 20.
-
-## Backend API
-
-The backend is:
-
-```text
-workflow-recipes/samples/ai-recipe-builder/server.js
-```
-
-It uses Node's built-in `http`, `fs`, and `path` modules. It serves static files
-and JSON API routes from the same process.
-
-### Environment Variables
-
-```text
-PORT
-RECIPE_BUILDER_API_KEY
-RECIPE_BUILDER_BASE_URL
-RECIPE_BUILDER_MODEL
-RECIPE_BUILDER_PROXY_TARGET
-```
-
-Defaults:
-
-```text
-PORT=8080
-RECIPE_BUILDER_BASE_URL=https://api.openai.com/v1
-RECIPE_BUILDER_MODEL=gpt-5.4-mini
-```
-
-When `RECIPE_BUILDER_PROXY_TARGET` is present, the process behaves as the UI
-proxy for `/api/*` calls. That is how the sandbox UI reaches the backend without
-holding secrets.
-
-### Routes
-
-```text
-GET /healthz
-GET /api/health
-POST /api/chat-plan
-POST /api/create-from-plan
-POST /api/draft
-POST /api/validate
-GET /*
-```
-
-`GET /healthz` and `GET /api/health`
-
-Returns service status, AI configuration state, proxy target, and model name.
-
-`POST /api/chat-plan`
-
-Accepts chat messages:
-
-```json
-{
- "useAi": true,
- "messages": [
- { "role": "user", "content": "Build a dashboard that checks domain expiry daily" }
- ]
-}
-```
-
-Returns one of three modes:
-
-```text
-chat casual natural-language response
-question focused clarification before planning
-plan structured plan ready for operator confirmation
-```
-
-Normal conversation uses plain LLM text mode through `callAiText`. Recipe
-planning uses structured JSON through `callAiJson`.
-
-`POST /api/create-from-plan`
-
-Accepts a confirmed plan and generates the final draft.
-
-```json
-{
- "useAi": true,
- "plan": {
- "name": "domain-expiry-dashboard",
- "objective": "Build a dashboard that checks domain expiry daily"
- }
-}
-```
-
-Returns:
-
-- `recipeName`
-- `recipeYaml`
-- `capabilities`
-- `checklist`
-- `registryPayload`
-- `validation`
-- optional `aiUnderstood`, `aiAssumptions`, `aiNotes`, and `aiError`
-
-`POST /api/draft`
-
-Legacy direct drafting endpoint. It remains for smoke tests and backwards
-compatibility, but the UI now prefers chat -> plan -> confirm.
-
-`POST /api/validate`
-
-Runs local validation on a supplied YAML string.
-
-### Important Backend Functions
-
-```text
-inferCapabilities(prompt)
-isActionableBuildPrompt(prompt)
-buildDeterministicPlan(messages)
-normalizePlan(raw, fallbackMessages)
-generateDeterministicDraft({ prompt, recipeName })
-validateDraft(yaml)
-hasInlineSecretValue(yaml)
-callAiText(messages)
-callAiJson(messages)
-maybePlanWithAi(messages, useAi)
-maybeGenerateWithAi(input)
-```
-
-The design splits normal chat and structured planning:
-
-- `callAiText` is used for natural conversation.
-- `callAiJson` is used only where structured output is required.
-- `maybePlanWithAi` chooses chat, question, or plan mode.
-- `maybeGenerateWithAi` generates or improves WorkflowRecipe YAML.
-- deterministic helpers provide a no-AI fallback.
-
-## System Prompt Context
-
-The backend includes a compact system context derived from the WorkflowRecipe
-guide. It teaches the agent the local invariants:
-
-- WorkflowRecipe CRDs live in `sandbox-recipes`.
-- UI workloads run in `sandbox-ui`.
-- Backend workloads run in `sandbox-recipes`.
-- UI workloads should not receive secrets.
-- Secrets should be referenced through `envSecret`.
-- Provider access requires explicit egress bindings.
-- MCP transport children belong in `mcp-server` only when transport is declared.
-- Casual chat is allowed and should not become a fake recipe.
-- YAML generation happens after plan confirmation.
-
-This context is intentionally embedded in `server.js` so the deployed sample is
-self-contained. Future versions could load it from documentation or a
-versioned prompt file.
-
-## Frontend App
-
-The frontend lives in:
-
-```text
-workflow-recipes/samples/ai-recipe-builder/public/
- index.html
- app.js
- styles.css
-```
-
-`index.html` defines the app shell:
-
-- hero/header
-- health chip
-- light/dark toggle
-- chat panel
-- plan panel
-- generated output panel
-
-`app.js` manages browser state:
-
-```text
-currentYaml
-currentPlan
-chatMessages
-```
-
-Important UI functions:
-
-```text
-preferredTheme()
-applyTheme(theme)
-renderChat()
-renderPlan(plan)
-renderDraft(draft)
-renderValidation(validation)
-sendMessage()
-confirmPlan()
-copyYaml()
-```
-
-The browser uses relative API paths like `api/chat-plan`, not absolute `/api/*`.
-That matters inside the Desktop embedded app because the sandbox UI may be
-served from a nested path.
-
-`styles.css` ports the Desktop App visual language into this standalone sample:
-
-- dark neutral shell
-- warm light mode
-- burnt-orange accent
-- glass-like panels
-- matching controls, chips, validation states, and code blocks
-
-The selected theme is stored in:
-
-```text
-localStorage["ai-recipe-builder.theme"]
-```
-
-## LLM Connection
-
-The app expects an OpenAI-compatible chat completions API:
-
-```text
-POST <base-url>/chat/completions
-Authorization: Bearer <api-key>
-```
-
-The local minikube setup used a ZAI-compatible endpoint:
-
-```text
-base-url=https://api.z.ai/api/coding/paas/v4
-model=glm-4.7
-```
-
-The Secret shape is:
-
-```bash
-kubectl --context=clerum-test -n sandbox-recipes create secret generic ai-recipe-builder-llm \
- --from-literal=api-key="<provider-api-key>" \
- --from-literal=base-url="<openai-compatible-base-url>" \
- --from-literal=model="<model-name>"
-```
-
-For ownership and Secret discovery, the local secret should be labeled:
-
-```bash
-kubectl --context=clerum-test -n sandbox-recipes label secret ai-recipe-builder-llm \
- clerum.io/owner-recipe=ai-recipe-builder --overwrite
-```
-
-Never store real keys in documentation.
-
-## Data Flow
-
-Natural chat:
-
-```text
-User message
- -> public/app.js sendMessage()
- -> POST api/chat-plan
- -> ui workload proxy
- -> api workload /api/chat-plan
- -> callAiText()
- -> OpenAI-compatible provider
- -> assistant text response
- -> chat bubble
-```
-
-Recipe plan:
-
-```text
-Concrete build request
- -> POST api/chat-plan
- -> maybePlanWithAi()
- -> callAiJson()
- -> structured plan JSON
- -> renderPlan()
- -> Confirm plan button
-```
-
-YAML generation:
-
-```text
-Confirm plan
- -> POST api/create-from-plan
- -> maybeGenerateWithAi()
- -> generated WorkflowRecipe YAML
- -> validateDraft()
- -> registry payload + checklist + YAML preview
-```
-
-No generated resource is applied automatically.
-
-## Local Build And Rollout
-
-Build the image into the minikube Docker daemon:
-
-```bash
-cd /home/pal/Clerum/Code/clerum
-eval "$(minikube -p clerum-test docker-env)"
-
-docker build -t clerum/ai-recipe-builder:0.1.0 \
- workflow-recipes/samples/ai-recipe-builder
-```
-
-Restart both workloads:
-
-```bash
-kubectl --context=clerum-test -n sandbox-recipes rollout restart deploy/api
-kubectl --context=clerum-test -n sandbox-ui rollout restart deploy/ui
-
-kubectl --context=clerum-test -n sandbox-recipes rollout status deploy/api --timeout=120s
-kubectl --context=clerum-test -n sandbox-ui rollout status deploy/ui --timeout=120s
-```
-
-The UI may need a Desktop embedded-view refresh after rollout because the webview
-can keep old JavaScript in memory.
-
-## Live Debugging
-
-Check the API workload logs:
-
-```bash
-kubectl --context=clerum-test -n sandbox-recipes logs deploy/api --tail=160
-```
-
-Check the Secret shape without printing secret values:
-
-```bash
-kubectl --context=clerum-test -n sandbox-recipes get secret ai-recipe-builder-llm \
- -o go-template='{{range $k,$v := .data}}{{printf "%s len=%d\n" $k (len ($v | base64decode))}}{{end}}'
-```
-
-Verify env wiring:
-
-```bash
-kubectl --context=clerum-test -n sandbox-recipes get deploy api \
- -o jsonpath='{range .spec.template.spec.containers[0].env[*]}{.name}{" secret="}{.valueFrom.secretKeyRef.name}{":"}{.valueFrom.secretKeyRef.key}{"\n"}{end}'
-```
-
-Test chat from inside the pod:
-
-```bash
-kubectl --context=clerum-test -n sandbox-recipes exec -i deploy/api -- node - <<'NODE'
-(async () => {
- const res = await fetch('http://127.0.0.1:8080/api/chat-plan', {
- method: 'POST',
- headers: {'content-type':'application/json'},
- body: JSON.stringify({
- useAi: true,
- messages: [
- {role:'user', content:'hi, can you tell me who you are?'}
- ]
- })
- });
- console.log(await res.text());
-})().catch(err => {
- console.error(err.stack || err.message);
- process.exit(1);
-});
-NODE
-```
-
-Expected shape:
-
-```json
-{
- "mode": "chat",
- "assistantMessage": "..."
-}
-```
-
-## Known Limits
-
-The app is a strong v1, but it is still a drafting assistant:
-
-- It does not persist chat history across reloads.
-- It does not stream tokens.
-- It does not apply generated YAML.
-- It does not publish registry entries.
-- It does not manage provider keys.
-- It does not deeply validate every CRD field against the Kubernetes OpenAPI
- schema.
-- It uses an embedded system prompt in `server.js` rather than a separate prompt
- asset.
-
-## Good Future Improvements
-
-High-value next steps:
-
-- Add streaming chat responses.
-- Persist sessions locally or in a recipe-owned store.
-- Add an explicit edit-plan step before confirmation.
-- Add CRD schema-backed validation through Control API.
-- Add a registry publish draft flow.
-- Add model/provider selection when multiple shared LLM secrets exist.
-- Add generated diff views when the plan changes.
-- Add tests for chat mode, plan mode, fallback mode, and invalid YAML fallback.
-- Move the system prompt into a versioned markdown or prompt file.
-- Add a "copy install commands" panel for generated recipes.
-
-The important architectural principle should stay the same: the app can assist,
-draft, and validate, but human operators approve the resources that enter the
-cluster.
diff --git a/external-rest-api/test/meService.channels.test.ts b/external-rest-api/test/meService.channels.test.ts
index 0fc3fdf56..f38608830 100644
--- a/external-rest-api/test/meService.channels.test.ts
+++ b/external-rest-api/test/meService.channels.test.ts
@@ -6,18 +6,18 @@ describe('meService channel mappings', () => {
expect(
normalizeChannels({
emails: [' [email protected] '],
- telegramHandles: [' @alfredo '],
+ telegramHandles: [' @testuser '],
telegramIds: [' 123456789 '],
slackUserNames: [' U123 '],
- discordUserNames: [' alfredo '],
+ discordUserNames: [' testuser '],
whatsappNumbers: [' +15551234567 '],
})
).toEqual({
emails: ['[email protected]'],
- telegramHandles: ['@alfredo'],
+ telegramHandles: ['@testuser'],
telegramIds: ['123456789'],
slackUserNames: ['U123'],
- discordUserNames: ['alfredo'],
+ discordUserNames: ['testuser'],
whatsappNumbers: ['+15551234567'],
})
})
diff --git a/host-context-controller/README.md b/host-context-controller/README.md
index 386a74a3c..8ee40e981 100644
--- a/host-context-controller/README.md
+++ b/host-context-controller/README.md
@@ -1,12 +1,14 @@
# Host Context Controller
-The Host Context Controller is a Kubernetes operator and REST API service that sits at the heart of the Clerum platform. It performs three key roles:
+The Host Context Controller is a Kubernetes operator and REST API service that sits at the heart of the Clerum platform. It performs these key roles:
1. **McpServer Operator** — Watches `McpServer` CRDs and automatically manages Deployments and Services for each MCP server, including secret validation.
2. **Host Operator** — Watches `Host` CRDs and automatically manages one Deployment, one Service, and one PVC per host, including secret validation.
-3. **NetworkPolicy Operator** — Watches `Context` CRDs and generates Kubernetes NetworkPolicies to enforce network-level access control between `mcp-host` pods and MCP server pods.
+3. **NetworkPolicy Operator** — Watches `Context` and `McpServer` CRDs and generates a four-layer NetworkPolicy model (deny-all, infrastructure, context-allow, external-egress) plus recipe binding policies.
4. **REST API** — Exposes a curated API that `mcp-host` uses to discover available MCP servers, their status, and auth tokens.
+It also reconciles `GlobalFileSystem` (`src/gfsReconciler.ts`) and `SharedFileSystem` (`src/sharedFileSystemReconciler.ts`) CRDs.
+
## Architecture
```
@@ -15,18 +17,18 @@ The Host Context Controller is a Kubernetes operator and REST API service that s
└──────────┬──────────┘
│ watch
▼
-┌─────────────────┐ REST API ┌──────────────────────────┐ manages ┌─────────────────────┐
-│ mcp-host │ ───────────────▶ │ host-context-controller │ ──────────────▶ │ Deployments │
-│ (mcp-host)│ │ (control-plane ns) │ │ Services │
-└─────────────────┘ └──────────────────────────┘ │ NetworkPolicies │
- │ └─────────────────────┘
- watch │ reads
+┌─────────────────┐ REST API ┌───────────────────────────┐ manages ┌─────────────────────┐
+│ mcp-host │ ───────────────▶ │ host-context-controller │ ──────────────▶ │ Deployments │
+│ (mcp-host ns) │ │ (control-plane ns) │ │ Services │
+└─────────────────┘ └───────────────────────────┘ │ NetworkPolicies │
+ │ └─────────────────────┘
+ watch │ reads
┌───────────────┼───────────────┐
▼ ▼ ▼
- ┌─────────────┐ ┌───────────┐ ┌─────────────┐
- │ Context CRDs│ │ Secrets │ │ MCP Server │
- └─────────────┘ └───────────┘ │ Pods │
- └─────────────┘
+ ┌─────────────┐ ┌───────────┐ ┌─────────────┐
+ │ Context CRDs│ │ Secrets │ │ MCP Server │
+ └─────────────┘ └───────────┘ │ Pods │
+ └─────────────┘
```
## McpServer Operator
@@ -39,11 +41,11 @@ When an `McpServer` CRD is created, modified, or deleted, the host-context-contr
The reconciler builds Deployments with labels used for pod selection and network policy targeting:
-| Label | Value | Purpose |
-|-------|-------|---------|
-| `app` | `<server-name>` | Standard app selector |
-| `clerum.io/managed-by` | `host-context-controller` | Identifies operator-managed pods |
-| `clerum.io/mcpserver` | `<server-name>` | Targets a specific MCP server pod |
+| Label | Value | Purpose |
+| ---------------------- | ------------------------- | --------------------------------- |
+| `app` | `<server-name>` | Standard app selector |
+| `clerum.io/managed-by` | `host-context-controller` | Identifies operator-managed pods |
+| `clerum.io/mcpserver` | `<server-name>` | Targets a specific MCP server pod |
### Secret Validation
@@ -52,50 +54,64 @@ Before deploying an MCP server, the reconciler checks that:
1. The secret referenced by `spec.envSecret.name` exists in the namespace.
2. All keys listed in `spec.envSecret.keys[].secretKey` are present in the secret data.
-If the secret is missing or incomplete, the MCP server will **not** be deployed. Creating secrets is not the host-context-controller's responsibility — it only validates their existence.
+If the secret is missing or incomplete, the MCP server will **not** be deployed. Creating the secrets an `McpServer` references is not the host-context-controller's responsibility — for those it only validates their existence. (It does create its own Secrets elsewhere, e.g. the per-Host runtime-token Secret in `mcp-host`.)
## NetworkPolicy Operator
-The host-context-controller enforces **deny-by-default** network isolation for MCP server pods and generates allow policies based on `Context` CRDs.
+The host-context-controller enforces **deny-by-default** network isolation across all runtime namespaces and generates allow policies from `Context` and `McpServer` CRDs. The model has four layers, implemented in `src/networkPolicyReconciler.ts`, plus recipe-scoped binding policies in `src/bindingPolicyReconciler.ts`.
-### Policy Model
+### L0 — Default deny
-Three types of NetworkPolicies are managed:
+One `deny-all-<namespace>` policy per runtime namespace, configurable via `CONTEXT_MAPPER_RUNTIME_NAMESPACES` (the shipped deployment sets `mcp-server,sandbox-recipes,rpc-proxy,sandbox-ui`; the code default is `mcp-server,mcp-host,sandbox-recipes,rpc-proxy`). Empty pod selector with `policyTypes: [Ingress, Egress]` — all traffic in both directions is blocked unless a higher layer allows it.
-| Policy | Name | Purpose |
-|--------|------|---------|
-| **Default deny** | `deny-all-mcp-servers` | Blocks all ingress to pods labeled `clerum.io/managed-by: host-context-controller`. No ingress rules = zero traffic allowed. |
-| **Allow controller API** | `allow-host-context-controller-api` | Allows pods in the host namespace (`mcp-host`) to reach the host-context-controller REST API on its configured port. This ensures `mcp-host` can always discover servers. |
-| **Context allow** | `ctx-<contextId>-<serverName>` | For each MCP server listed in a Context CRD's `spec.mcpServers`, allows ingress from the host namespace to that specific MCP server pod on its transport port. |
+Note: as deployed, `mcp-host` is **not** in that list — its deny-all, DNS and K8s-API policies are static manifests (`deploy/base/mcp-host/networkpolicies.yaml`), not controller-managed.
-### How It Works
+### L1 — Infrastructure
-```
-Context CRD (context1) NetworkPolicies generated
-┌──────────────────────────┐ ┌──────────────────────────────────────┐
-│ spec: │ │ deny-all-mcp-servers │
-│ contextId: context1 │ ──reconcile──▶ │ - deny all ingress to managed pods │
-│ mcpServers: │ │ │
-│ - mongodb-server │ │ allow-host-context-controller-api │
-│ - filesystem-server │ │ - allow mcp-host → :8081 │
-│ │ │ │
-│ │ │ ctx-context1-mongodb-server │
-│ │ │ - allow mcp-host → :3000 │
-│ │ │ │
-│ │ │ ctx-context1-filesystem-server │
-│ │ │ - allow mcp-host → :3001 │
-└──────────────────────────┘ └──────────────────────────────────────┘
-```
+Baseline plumbing, created once per runtime namespace:
+
+| Policy | Allows |
+| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `allow-dns-egress-<ns>` | DNS (UDP+TCP 53) to `kube-system`; optional extra ipBlock rule for GKE NodeLocal DNSCache via `CONTEXT_MAPPER_NODELOCAL_DNS_CIDR` |
+| `allow-hcc-api-egress-<ns>` | Egress to the `host-context-controller-api-gateway` pod in the control-plane namespace, scoped per namespace to the pod classes that need discovery (managed mcp-host pods, `mcp-proxy`, `rpc-proxy`, workflow MCP hosts) |
+| `allow-k8s-api-egress-<ns>` | Egress to the Kubernetes API server (TCP 443; CIDRs from `CONTEXT_MAPPER_K8S_API_CIDRS`, falling back to `KUBERNETES_SERVICE_HOST`, then to a hardcoded `10.96.0.1/32` when that is unset). **Deny by default** outside `mcp-host`: pods in other runtime namespaces must opt in with the platform-owned label `clerum.io/k8s-api-egress: "true"` |
+
+Namespaces listed in `CONTEXT_MAPPER_MINIMAL_INFRA_NAMESPACES` get only deny-all + DNS egress (no HCC-API or K8s-API egress).
+
+`ensureDefaultPolicies` additionally creates one non-suffixed `allow-host-context-controller-api` policy — not per namespace, but a single policy in `CONTEXT_MAPPER_NAMESPACE` (`mcp-server`). It permits ingress from the `mcp-host` namespace on `CONTEXT_MAPPER_PORT` to pods matching `app: host-context-controller`. As shipped, the controller Deployment runs in `control-plane`, so this policy matches no pod in `mcp-server` and has no effect; the mcp-host → controller route is actually opened by the `allow-hcc-api-egress-<ns>` egress policies above.
+
+### L2 — Context allow
+
+For each MCP server in a `Context` CRD's `spec.mcpServers`, three paired policies open a single route on the server's transport port:
+
+- `ctx-<contextId>-<serverName>` (ingress, MCP server namespace) — the server pod accepts traffic only from mcp-host pods **labeled with that context** (`clerum.io/context`), from `rpc-proxy` pods, and from `mcp-proxy`.
+- `ctx-<contextId>-<serverName>-egress` (egress, `mcp-host` namespace) — the context-labeled mcp-host pods may reach that server (required because L0 also denies egress).
+- `rpc-egress-<contextId>-<serverName>` (egress, `rpc-proxy` namespace) — rpc-proxy pods may reach that server.
+
+Servers removed from a Context lose their policies on the next reconcile; deleting a Context removes all three families.
+
+### L3 — External egress
+
+`McpServer.spec.egressBindings` produce `ext-egress-*` policies in the server's namespace (`reconcileExternalEgress` in `src/networkPolicyReconciler.ts`):
+
+- **`exact-host`** (default) — a CIDR binding, or a public DNS hostname resolved to `/32` ipBlocks, on one declared port/protocol. CIDRs and resolved IPs are rejected if they overlap `PUBLIC_EGRESS_EXCEPT_CIDRS` (RFC1918, CGNAT, loopback, link-local incl. cloud metadata, documentation, benchmarking, multicast, reserved ranges). Hostnames like `localhost`, `metadata.goog`, `*.internal`, `*.svc`, `*.cluster.local` are rejected outright.
+- **`public-web`** — `0.0.0.0/0` on TCP 80/443 with `PUBLIC_EGRESS_EXCEPT_CIDRS` carved out via `except`.
+
+Results are written to the McpServer's `status.conditions` (`ExternalEgressReady`) and `status.resolvedEgressIPs`. A failed binding blocks runtime reconciliation of that server, so a workload cannot start before its egress converges. DNS answers are re-resolved periodically (`HCC_EXTERNAL_EGRESS_RESYNC_SEC`, default 300s).
+
+### Recipe binding policies
+
+McpServers carrying a `clerum.io/recipe-bindings` annotation (set for WorkflowRecipe bindings) get paired `bind-<recipe>-<from>-<to>-{egress,ingress}` policies connecting the MCP workload in the MCP server namespace with its counterpart in `sandbox-recipes` on the declared port/protocol (`src/bindingPolicyReconciler.ts`). Deleting the McpServer removes the recipe's binding policies.
### Reconciliation Lifecycle
-- **Startup** — Loads all `Context` CRDs, creates/updates the default policies and all context-based policies, and cleans up orphaned policies for contexts that no longer exist.
-- **Context ADDED/MODIFIED** — Creates or updates policies for the servers listed in that context. Deletes policies for servers that were removed from the list.
-- **Context DELETED** — Removes all NetworkPolicies labeled with that context ID.
+- **Startup** — Ensures L0/L1 defaults, reconciles all Contexts and all McpServer egress bindings, then deletes orphaned context-allow policies in the MCP server namespace, plus orphaned rpc-proxy-egress and external-egress policies, whose owning CRD no longer exists (`fullReconcile`).
+- **Context ADDED/MODIFIED/DELETED** — Creates, updates, or removes the L2 policy set for that context.
+- **McpServer ADDED/MODIFIED/DELETED** — Reconciles L3 external egress (before the workload Deployment is created) and recipe binding policies.
### Cross-Namespace Targeting
-NetworkPolicies use the built-in `kubernetes.io/metadata.name` namespace label to select traffic from the host namespace:
+Policies select peers with the built-in `kubernetes.io/metadata.name` namespace label combined with pod label selectors, e.g. the L2 ingress rule:
```yaml
ingress:
@@ -103,6 +119,10 @@ ingress:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: mcp-host
+ podSelector:
+ matchLabels:
+ clerum.io/managed-by: host-context-controller
+ clerum.io/context: context1
ports:
- port: 3000
protocol: TCP
@@ -112,21 +132,27 @@ ingress:
When a `Host` CRD is created, modified, or deleted in the host namespace, the host-context-controller host reconciler:
-- **ADDED** — Validates that `spec.secretRef` exists, then creates/updates:
+- **ADDED** — Validates that `spec.secretRef` exists, then creates/updates, in the host namespace (`mcp-host`):
- `Deployment/<host-name>`
- `Service/<host-name>`
- `PersistentVolumeClaim/<host-name>-workspace`
+ - `Secret/host-<host-name>-mcp-host-runtime-tokens` (runtime credentials, rotated by the reconciler)
+ - `ServiceAccount/`, `Role/` and `RoleBinding/` scoping the pod to its own Host CRD and Secrets
+ - `NetworkPolicy/allow-rpc-proxy-desktop-<host-name>` for desktop hosts
+
+ It also reconciles, in the channels namespace (`CONTEXT_MAPPER_CHANNELS_NAMESPACE`, default `channels`), a per-Host `Service/channel-reader-<host-name>`, `Deployment/channel-reader-<host-name>` and `NetworkPolicy/channel-reader-<host-name>-egress`.
+
- **MODIFIED** — Reconciles the same resources to match current runtime defaults and host identity.
-- **DELETED** — Deletes the host Deployment, Service, and per-host PVC.
+- **DELETED** — Deletes the resources listed above, in both namespaces.
Generated resources are labeled for orphan cleanup:
-| Label | Value | Purpose |
-|-------|-------|---------|
+| Label | Value | Purpose |
+| ---------------------- | ------------------------- | -------------------------------------------------- |
| `clerum.io/managed-by` | `host-context-controller` | Identifies operator-managed host runtime resources |
-| `clerum.io/host` | `<host-name>` | Tracks ownership to a specific Host CRD |
+| `clerum.io/host` | `<host-name>` | Tracks ownership to a specific Host CRD |
-On startup, a full host reconciliation pass runs and deletes orphaned host runtime resources whose Host CRD no longer exists.
+On startup, a full host reconciliation pass runs and deletes orphaned host runtime resources whose Host CRD no longer exists — including orphaned channel-reader resources in `channels` and orphaned per-Host NetworkPolicies (`sweepOrphanChannelReaderResources`, `sweepOrphanHostNetworkPolicies`).
## REST API
@@ -139,9 +165,11 @@ GET /health
```
```json
-{ "status": "ok" }
+{ "status": "ok", "ready": true }
```
+The server also exposes `GET /` (API information), `GET /ready` (readiness; 503 until the controller has started), `GET /metrics` (Prometheus), and `GET /api/v1/desktop/:hostRef` (desktop status; requires the `CONTEXT_MAPPER_DESKTOP_API_TOKEN` bearer token — the check is skipped when that variable is empty).
+
### List All McpServers
```
@@ -155,8 +183,15 @@ GET /api/v1/mcpservers
"name": "mongodb-server",
"description": "MongoDB MCP Server",
"contextRef": "context1",
- "transport": { "type": "sse", "url": "http://mongodb-server.mcp-server.svc.cluster.local:3000/sse" },
- "auth": { "type": "bearer", "secretRef": "mcp-mongodb-credentials", "secretKey": "auth-token" },
+ "transport": {
+ "type": "sse",
+ "url": "http://mongodb-server.mcp-server.svc.cluster.local:3000/sse"
+ },
+ "auth": {
+ "type": "bearer",
+ "secretRef": "mcp-mongodb-credentials",
+ "secretKey": "auth-token"
+ },
"enabled": true,
"status": { "deployed": true, "ready": true, "message": "Running" }
}
@@ -181,62 +216,216 @@ GET /api/v1/mcpservers/:name/auth
```
Response (with auth):
+
```json
{ "token": "secret-token-value" }
```
Response (no auth configured):
+
```json
{ "token": null, "message": "No auth configured for this server" }
```
## Environment Variables
-| Variable | Default | Description |
-|----------|---------|-------------|
-| `CLERUM_DEV_MODE` | `false` | Enable dev mode (reads from env vars instead of K8s) |
-| `CONTEXT_MAPPER_PORT` | `8081` | HTTP server port |
-| `CONTEXT_MAPPER_NAMESPACE` | `mcp-server` | Kubernetes namespace where MCP servers and Context CRDs live |
-| `CONTEXT_MAPPER_HOST_NAMESPACE` | `mcp-host` | Namespace where mcp-host pods run (for NetworkPolicy generation) |
-| `CONTEXT_MAPPER_HOST_IMAGE` | `your-registry.example.com/evenfire/mcp-host:0.3.0` | Container image for reconciled host Deployments |
-| `CONTEXT_MAPPER_HOST_IMAGE_PULL_POLICY` | `Always` | Pull policy for reconciled host Deployments |
-| `CONTEXT_MAPPER_HOST_PORT` | `8080` | Container/service port for host runtime |
-| `CONTEXT_MAPPER_HOST_CONFIGMAP_NAME` | `mcp-host-config` | ConfigMap loaded into host containers via `envFrom` |
-| `CONTEXT_MAPPER_HOST_SERVICE_ACCOUNT` | `mcp-host` | Service account used by host Deployments |
-| `CONTEXT_MAPPER_HOST_WORKSPACE_STORAGE_CLASS` | `do-block-storage-retain` | Storage class for per-host workspace PVCs |
-| `CONTEXT_MAPPER_HOST_WORKSPACE_SIZE` | `10Gi` | Requested per-host workspace PVC size |
-| `CONTEXT_MAPPER_HOST_WORKSPACE_PATH` | `/workspace` | Workspace mount path inside host containers |
-| `CONTEXT_MAPPER_HOST_RESOURCES_REQUEST_MEMORY` | `128Mi` | Host container memory request |
-| `CONTEXT_MAPPER_HOST_RESOURCES_REQUEST_CPU` | `100m` | Host container CPU request |
-| `CONTEXT_MAPPER_HOST_RESOURCES_LIMIT_MEMORY` | `512Mi` | Host container memory limit |
-| `CONTEXT_MAPPER_HOST_RESOURCES_LIMIT_CPU` | `500m` | Host container CPU limit |
-| `CLERUM_MCP_SERVERS` | - | (Dev mode) JSON array of McpServer objects |
-| `CLERUM_MCP_AUTH` | - | (Dev mode) JSON object mapping server name to auth token |
+HCC reads **60** environment variables (`src/config.ts`, `src/gfsConfig.ts`,
+`src/logger.ts`, `src/k8sApiCidrs.ts`). Defaults below are the literal fallbacks
+in code; where the deploy manifest overrides one, that is noted.
+
+**Parsing semantics.** `getEnv(key, default)` uses `process.env[key] ?? default`,
+so an **empty string wins over the default** — that is how the minikube overlay
+disables the image-pull secret with `value: ""`. `getEnvInt` / `getEnvBool` treat
+an empty string as unset and fall back to the default; `getEnvBool` accepts
+`true` (any case) or `1`.
+
+**Three variables fail the process closed on bad input** rather than programming
+a permissive policy — see the NetworkPolicy and GFS tables:
+`CONTEXT_MAPPER_K8S_API_CIDRS`, `CONTEXT_MAPPER_NODELOCAL_DNS_CIDR`, and
+`CONTEXT_MAPPER_GFSC_IMAGE_PULL_POLICY`.
+
+### Core / server
+
+| Variable | Default | Description |
+| --------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CONTEXT_MAPPER_PORT` | `8081` | HTTP server port. |
+| `CLERUM_DEV_MODE` | `false` | Read McpServers/Contexts/auth tokens from env instead of the K8s API. Also skips the `INTERNAL_CONTROL_JWT_HCC_HMAC_SECRET` startup assertion below. |
+| `LOG_LEVEL` | `info` | `debug` \| `info` \| `warn` \| `error`. Unrecognized values fall back to `info`. |
+
+### Namespaces
+
+| Variable | Default | Description |
+| ---------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CONTEXT_MAPPER_NAMESPACE` | `mcp-server` | Where `McpServer` / `Context` CRDs live and managed server workloads are created. |
+| `CONTEXT_MAPPER_CONTROL_PLANE_NAMESPACE` | `control-plane` | Where control-plane gateway services live. |
+| `CONTEXT_MAPPER_HOST_NAMESPACE` | `mcp-host` | Where mcp-host pods run (drives NetworkPolicy generation). |
+| `CONTEXT_MAPPER_GFS_NAMESPACE` | `gfs` | Where the GlobalFileSystem controller (gfsc) runs. |
+| `CONTEXT_MAPPER_RPC_PROXY_NAMESPACE` | `rpc-proxy` | Where rpc-proxy runs (L2 egress policy generation). |
+| `CONTEXT_MAPPER_CHANNELS_NAMESPACE` | `channels` | Per-Host channel-reader Deployments/Services. |
+| `CONTEXT_MAPPER_SANDBOX_NAMESPACE` | `sandbox-recipes` | Workflow-recipe namespace. Read only by the GFS factory. |
+| `HCC_TARGET_NAMESPACE` | `mcp-host` | Namespace HCC names when asking control-api for shared 1st-party mcp-host credentials. **Exits 1** if it resolves empty; warns if outside mcp-host/sandbox-recipes. |
+
+### MCP server provisioning
+
+| Variable | Default | Description |
+| -------------------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------- |
+| `CONTEXT_MAPPER_MCPSERVER_IMAGE_PULL_POLICY` | `IfNotPresent` | Pull policy for reconciled McpServer workloads. |
+| `CONTEXT_MAPPER_EGRESS_PROXY_IMAGE` | `clerum/nginx-egress-proxy:0.1.0` | Per-server nginx egress proxy for **remote** MCP servers (`spec.remote`). |
+| `CONTEXT_MAPPER_STDIO_BRIDGE_IMAGE` | (registry-qualified `stdio-bridge`) | stdio-bridge sidecar image for managed stdio MCP servers. Manifest pins `clerum/stdio-bridge:0.9.5`. |
+| `CONTEXT_MAPPER_STDIO_BRIDGE_REQUEST_MEMORY` | `32Mi` | stdio-bridge sidecar memory request. |
+| `CONTEXT_MAPPER_STDIO_BRIDGE_REQUEST_CPU` | `50m` | stdio-bridge sidecar CPU request. |
+| `CONTEXT_MAPPER_STDIO_BRIDGE_LIMIT_MEMORY` | `128Mi` | stdio-bridge sidecar memory limit. |
+| `CONTEXT_MAPPER_STDIO_BRIDGE_LIMIT_CPU` | `200m` | stdio-bridge sidecar CPU limit. |
+| `HCC_EXTERNAL_EGRESS_RESYNC_SEC` | `300` | Periodic external-egress DNS resync (seconds), so DNS changes converge without a watch event. `0` disables. |
+
+### mcp-host provisioning
+
+| Variable | Default | Description |
+| --------------------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
+| `CONTEXT_MAPPER_HOST_IMAGE` | (registry-qualified `mcp-host`) | Image for reconciled Host Deployments. Manifest pins `clerum/mcp-host:0.9.5`. |
+| `CONTEXT_MAPPER_HOST_IMAGE_PULL_POLICY` | `Always` | Pull policy. Minikube overlay sets `IfNotPresent`. |
+| `CONTEXT_MAPPER_HOST_IMAGE_PULL_SECRET` | `clerum` | `imagePullSecrets` name. Minikube overlay sets `""` to disable (empty string overrides the default). |
+| `CONTEXT_MAPPER_HOST_PORT` | `8080` | Container/service port for the host runtime. |
+| `CONTEXT_MAPPER_HOST_CONFIGMAP_NAME` | `mcp-host-config` | ConfigMap loaded into host containers via `envFrom`. |
+| `CONTEXT_MAPPER_HOST_SERVICE_ACCOUNT` | `mcp-host` | ServiceAccount used by Host Deployments. |
+| `CONTEXT_MAPPER_HOST_WORKSPACE_STORAGE_CLASS` | `do-block-storage-retain` | StorageClass for per-host workspace PVCs. Minikube overlay sets `standard`. |
+| `CONTEXT_MAPPER_HOST_WORKSPACE_SIZE` | `10Gi` | Requested per-host workspace PVC size. |
+| `CONTEXT_MAPPER_HOST_WORKSPACE_PATH` | `/workspace` | Workspace mount path inside host containers. |
+| `CONTEXT_MAPPER_HOST_RESOURCES_REQUEST_MEMORY` | `128Mi` | Host container memory request. |
+| `CONTEXT_MAPPER_HOST_RESOURCES_REQUEST_CPU` | `100m` | Host container CPU request. |
+| `CONTEXT_MAPPER_HOST_RESOURCES_LIMIT_MEMORY` | `512Mi` | Host container memory limit. |
+| `CONTEXT_MAPPER_HOST_RESOURCES_LIMIT_CPU` | `500m` | Host container CPU limit. |
+| `CONTEXT_MAPPER_HOST_RESYNC_SEC` | `300` | Periodic Host `fullReconcile` (seconds); guards against dropped watch events and drives auth-degraded self-heal. `0` disables. |
+| `HCC_MCP_HOST_RUNTIME_BOOTSTRAP_REFRESH_BEFORE_SEC` | `900` | How long before expiry HCC refreshes the mcp-host bootstrap credential Secret. |
+
+### Desktop (Host CRD `spec.desktop`)
+
+| Variable | Default | Description |
+| ------------------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CONTEXT_MAPPER_DESKTOP_IMAGE` | `clerum/mcp-host-desktop:latest` | Desktop sidecar image. |
+| `CONTEXT_MAPPER_DESKTOP_PORT` | `3000` | Desktop container port. |
+| `CONTEXT_MAPPER_DESKTOP_RESOURCES_REQUEST_MEMORY` | `256Mi` | Desktop memory request. |
+| `CONTEXT_MAPPER_DESKTOP_RESOURCES_REQUEST_CPU` | `250m` | Desktop CPU request. |
+| `CONTEXT_MAPPER_DESKTOP_RESOURCES_LIMIT_MEMORY` | `4Gi` | Desktop memory limit. |
+| `CONTEXT_MAPPER_DESKTOP_RESOURCES_LIMIT_CPU` | `1000m` | Desktop CPU limit. |
+| `CONTEXT_MAPPER_DESKTOP_API_TOKEN` | `` (empty) | Bearer token required by `GET /api/v1/desktop/:hostRef`. **When empty the check is skipped and the endpoint is unauthenticated** — a dev-mode convenience. Set it in any shared cluster. |
+
+### channel-reader provisioning
+
+| Variable | Default | Description |
+| ------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------- |
+| `CONTEXT_MAPPER_CHANNEL_READER_IMAGE` | `clerum/channel-reader:0.9.5` | Image for per-Host channel-reader Deployments. |
+| `CONTEXT_MAPPER_CHANNEL_READER_IMAGE_PULL_POLICY` | `Always` | Pull policy. Minikube overlay sets `IfNotPresent` to use locally-loaded images. |
+| `CONTEXT_MAPPER_CHANNEL_READER_HANDOFF_PORT` | `8099` | Internal handoff port on per-Host channel-reader Services. |
+
+### workspace-files-controller (WFC) provisioning
+
+| Variable | Default | Description |
+| --------------------------------------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CONTEXT_MAPPER_WFC_IMAGE` | (registry-qualified `wfc`) | Per-SharedFileSystem WFC image. Manifest pins `clerum/workspace-files-controller:0.9.5`. |
+| `CONTEXT_MAPPER_WFC_IMAGE_PULL_POLICY` | `IfNotPresent` | Pull policy for WFC Deployments. |
+| `CONTEXT_MAPPER_WFC_IMAGE_PULL_SECRET` | `clerum` | `imagePullSecrets` name. Minikube overlay sets `""` to disable. |
+| `CONTEXT_MAPPER_WFC_PORT` | `8086` | WFC container/service port. |
+| `CONTEXT_MAPPER_WFC_INIT_IMAGE` | `busybox:1.36` | Init container that seeds directories and chowns the fresh PVC. |
+| `CONTEXT_MAPPER_WFC_RESOURCES_REQUEST_MEMORY` | `64Mi` | WFC memory request. |
+| `CONTEXT_MAPPER_WFC_RESOURCES_REQUEST_CPU` | `50m` | WFC CPU request. |
+| `CONTEXT_MAPPER_WFC_RESOURCES_LIMIT_MEMORY` | `128Mi` | WFC memory limit. |
+| `CONTEXT_MAPPER_WFC_RESOURCES_LIMIT_CPU` | `200m` | WFC CPU limit. |
+| `CONTEXT_MAPPER_WFC_JWT_PUBLIC_KEY_CM` | `mcp-host-config` | ConfigMap holding the JWT public key the WFC verifies against. |
+| `CONTEXT_MAPPER_WFC_JWT_PUBLIC_KEY_CM_KEY` | `CLERUM_AUTH_JWT_PUBLIC_KEY` | Key within that ConfigMap. |
+| `CONTEXT_MAPPER_WFC_MAX_UPLOAD_BYTES` | `104857600` (100 MiB) | Upload size cap forwarded to the WFC container. |
+| `CONTEXT_MAPPER_WFC_MAX_LIST_ENTRIES` | `5000` | Max directory entries the WFC will list. |
+| `CONTEXT_MAPPER_WFC_MAX_PATH_DEPTH` | `32` | Max path depth the WFC will traverse. |
+| `CONTEXT_MAPPER_SFS_RESYNC_SEC` | `60` | Periodic SharedFileSystem `fullReconcile` (seconds). The SFS watch fires only on CRD changes — not on PVC binding or WFC readiness — so this is what drives `Initializing`/`Degraded` → `Ready`. `0` disables. |
+
+### GlobalFileSystem (GFS) provisioning
+
+Read by `src/gfsConfig.ts`. Invalid values **throw at startup** rather than silently defaulting.
+
+| Variable | Default | Description |
+| --------------------------------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
+| `CONTEXT_MAPPER_GFSC_PORT` | `8087` | gfsc service port. |
+| `CONTEXT_MAPPER_GFSC_IMAGE` | `clerum/gfs-controller:test` | gfsc writer Deployment image. **The default is a `:test` tag** — override it. |
+| `CONTEXT_MAPPER_GFSC_IMAGE_PULL_POLICY` | `IfNotPresent` | Must be exactly `Always` \| `IfNotPresent` \| `Never`; any other non-empty value **throws** at startup. |
+| `CONTEXT_MAPPER_GFSC_IMAGE_PULL_SECRET` | _(unset)_ | Optional `imagePullSecrets` name for gfsc. |
+| `CONTEXT_MAPPER_GFSC_PRIORITY_CLASS` | _(unset)_ | Optional `priorityClassName` for the gfsc Deployment. |
+| `CONTEXT_MAPPER_GFSC_INIT_IMAGE` | `busybox:1.36` | gfsc init-container image. |
+| `CONTEXT_MAPPER_GFSC_REQUEST_MEMORY` | `128Mi` | gfsc memory request. |
+| `CONTEXT_MAPPER_GFSC_REQUEST_CPU` | `100m` | gfsc CPU request. |
+| `CONTEXT_MAPPER_GFSC_LIMIT_MEMORY` | `256Mi` | gfsc memory limit. |
+| `CONTEXT_MAPPER_GFSC_LIMIT_CPU` | `500m` | gfsc CPU limit. |
+| `CONTEXT_MAPPER_GFS_POSTGRES_APP_LABEL` | `control-postgres` | `app` pod label selecting the Postgres pods gfsc may reach (NetworkPolicy). |
+| `CONTEXT_MAPPER_GFS_POSTGRES_PORT` | `5432` | Postgres port for the gfsc egress policy. |
+| `CONTEXT_MAPPER_GFS_JWT_CONFIGMAP` | `gfs-config` | ConfigMap holding the JWT public key gfsc verifies against. |
+| `CONTEXT_MAPPER_GFS_JWT_CONFIGMAP_KEY` | `jwt-public-key` | Key within that ConfigMap. |
+| `CONTEXT_MAPPER_GFS_PG_SECRET` | `gfs-controller-db` | Secret holding the gfsc Postgres connection string. |
+| `CONTEXT_MAPPER_GFS_PG_SECRET_KEY` | `connection-string` | Key within that Secret. |
+| `CONTEXT_MAPPER_GFS_DRIVE_NAME` | `main` | Default GFS drive name. |
+| `CONTEXT_MAPPER_GFS_TOKEN_AUDIENCE` | `gfs-controller` | Expected `aud` claim on GFS access tokens. |
+| `CONTEXT_MAPPER_GFS_RESYNC_SEC` | `60` | Periodic GlobalFileSystem `fullReconcile` (seconds); drives convergence to `Ready` and the root-directory seed. `0` disables. |
+
+### NetworkPolicy
+
+| Variable | Default | Description |
+| ----------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CONTEXT_MAPPER_RUNTIME_NAMESPACES` | `mcp-server,mcp-host,sandbox-recipes,rpc-proxy` | Namespaces that get L0 deny-all + L1 infrastructure policies. Manifest overrides to `mcp-server,sandbox-recipes,rpc-proxy,sandbox-ui` — note it **drops `mcp-host`**, whose policies are static (`deploy/base/mcp-host/networkpolicies.yaml`), because an HCC deny-all would block mcp-host from reaching LLM APIs. |
+| `CONTEXT_MAPPER_MINIMAL_INFRA_NAMESPACES` | `` (empty) | Subset of runtime namespaces that get **only** deny-all + DNS egress — no HCC-API or K8s-API egress. Manifest sets `sandbox-ui`. |
+| `CONTEXT_MAPPER_K8S_API_CIDRS` | _(unset → `[]`)_ | K8s API-server CIDRs for `allow-k8s-api-egress-*`. Empty falls back to `KUBERNETES_SERVICE_HOST`. **Validated fail-closed at module load**: a malformed entry, or one broader than `/24` (IPv4) or `/120` (IPv6), **crashes startup** rather than programming a permissive policy. |
+| `CONTEXT_MAPPER_NODELOCAL_DNS_CIDR` | `` (empty) | DNS infrastructure CIDR for NodeLocal DNSCache / kube-dns. Must be exactly one IPv4 `/32`; anything else throws at startup. |
+| `KUBERNETES_SERVICE_HOST` | _(injected by Kubernetes)_ | Not set by the operator — the `/32` fallback source when `CONTEXT_MAPPER_K8S_API_CIDRS` is empty. |
+
+### Plugin image allowlist
+
+| Variable | Default | Description |
+| ---------------------------------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CONTEXT_MAPPER_ALLOWED_IMAGE_PREFIXES` | see `packages/image-policy` | Comma-separated trusted image prefixes for local-mode `McpServer` images. Manifest sets `ghcr.io/evenfire-ai/,mongodb/,mcr.microsoft.com/,clerum/`. |
+| `CONTEXT_MAPPER_ENFORCE_IMAGE_ALLOWLIST` | `false` | `false` = audit mode (log would-be denials without blocking). `true` = enforce. Manifest sets `"false"`. |
+
+### Control-API integration
+
+| Variable | Default | Description |
+| -------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CONTROL_API_BASE_URL` | `http://control-api.control-plane.svc.cluster.local:8090` | Cluster-internal control-api URL. HCC calls it directly to issue mcp-host runtime tokens for the pods it provisions. |
+| `INTERNAL_CONTROL_JWT_HCC_HMAC_SECRET` | `` (empty) | HS256 secret for signing InternalControl JWTs. **Required whenever `CLERUM_DEV_MODE` is not `true`** — the process logs `[HCC] FATAL` and exits 1 if empty or still a `replace-with-…` placeholder. |
+| `MCP_HOST_GATEWAY_URL` | `http://nginx-workflow-approval-gateway.control-plane.svc:8092` | The nginx allowlist proxy mediating mcp-host → control-api. HCC **injects this into the mcp-host pods it provisions**; it does not call it itself. |
+
+### Dev mode
+
+Parsed only when `CLERUM_DEV_MODE` is truthy. A JSON parse failure logs an error and yields an empty result rather than crashing.
+
+| Variable | Default | Description |
+| -------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CLERUM_MCP_SERVERS` | `[]` | JSON array of McpServer objects. |
+| `CLERUM_CONTEXTS` | `[]` | JSON array of Context objects. When set, `GET /api/v1/mcpservers/context/:contextRef` filters by the Context's `mcpServers` allow-list; when unset it falls back to matching `spec.contextRef`. |
+| `CLERUM_MCP_AUTH` | `{}` | JSON object mapping MCP server name → auth token. |
## Kubernetes RBAC
-The host-context-controller requires permissions in both `mcp-server` and `mcp-host` namespaces:
+The shipped Roles and RoleBindings are the source of truth — see `deploy/base/<namespace>/rbac.yaml`. The controller's ServiceAccount lives in `control-plane` and is bound into `mcp-server`, `mcp-host`, `channels`, `rpc-proxy`, `sandbox-recipes`, `sandbox-ui` and `gfs`. The table below is an overview of the two main namespaces, not a complete Role definition — do not build a Role from it.
+
+In `mcp-server` (`deploy/base/mcp-server/rbac.yaml`):
+
+| API Group | Resource | Verbs | Purpose |
+| ------------------- | ------------------- | --------------------------------- | ------------------------------------------------------------ |
+| `clerum.io` | `mcpservers` | get, list, watch, patch | Watch McpServer CRDs |
+| `clerum.io` | `mcpservers/status` | get, patch | Publish readiness / secret-resolution conditions |
+| `clerum.io` | `contexts` | get, list, watch | Watch Context CRDs for NetworkPolicy reconciliation |
+| `networking.k8s.io` | `networkpolicies` | get, list, create, update, delete | Manage generated NetworkPolicies |
+| `apps` | `deployments` | get, list, create, update, delete | Manage MCP server Deployments |
+| _(core)_ | `services` | get, list, create, update, delete | Manage MCP server Services |
+| _(core)_ | `configmaps` | get, list, create, update, delete | Manage the remote egress proxy nginx config |
+| _(core)_ | `secrets` | get, list, watch | Read auth tokens, validate `envSecret`, re-enqueue on change |
-| API Group | Resource | Verbs | Purpose |
-|-----------|----------|-------|---------|
-| `clerum.io` | `mcpservers` | get, list, watch | Watch McpServer CRDs |
-| `clerum.io` | `contexts` | get, list, watch | Watch Context CRDs for NetworkPolicy reconciliation |
-| `clerum.io` | `hosts` | get, list, watch | Watch Host CRDs in host namespace |
-| `networking.k8s.io` | `networkpolicies` | get, list, create, update, delete | Manage generated NetworkPolicies |
-| `apps` | `deployments` | get, list, create, update, delete | Manage MCP server Deployments |
-| `apps` | `deployments` | get, list, create, update, delete | Manage per-host runtime Deployments |
-| _(core)_ | `services` | get, list, create, update, delete | Manage MCP server and host runtime Services |
-| _(core)_ | `persistentvolumeclaims` | get, list, create, update, delete | Manage per-host workspace PVCs |
-| _(core)_ | `secrets` | get | Read auth tokens and validate secret references (`McpServer` + `Host`) |
+In `mcp-host` (`deploy/base/mcp-host/rbac.yaml`), the controller additionally manages per-Host identity and SharedFileSystem resources: `hosts` (get, list, watch), `sharedfilesystems` + `sharedfilesystems/status`, `batch/jobs`, `deployments`, `services`, `persistentvolumeclaims`, `networkpolicies`, `serviceaccounts`, `roles`/`rolebindings`, `configmaps` (get, watch, list), `pods` (get, list), and `secrets` with **get, watch, list, create, update, patch, delete** — it creates the per-Host `host-<hostRef>-mcp-host-runtime-tokens` Secret and the per-Host ServiceAccount + Role + RoleBinding on every reconcile.
## Namespaces
-| Component | Namespace | Purpose |
-|-----------|-----------|---------|
-| host-context-controller | `control-plane` | Operator and API service |
-| MCP server pods + CRDs | `mcp-server` | `McpServer` and `Context` source of truth + managed server workloads |
-| mcp-host | `mcp-host` | Consumer of the REST API, target of NetworkPolicy `from` rules |
-| channel-reader | `channels` | Communication layer |
+| Component | Namespace | Purpose |
+| ----------------------- | --------------- | -------------------------------------------------------------------- |
+| host-context-controller | `control-plane` | Operator and API service |
+| MCP server pods + CRDs | `mcp-server` | `McpServer` and `Context` source of truth + managed server workloads |
+| mcp-host | `mcp-host` | Consumer of the REST API, target of NetworkPolicy `from` rules |
+| channel-reader | `channels` | Communication layer |
## Local Development
@@ -255,44 +444,50 @@ make dev
# Option 2: Run with inline example servers (quick test)
make dev-example
+```
-# Or provide your own servers:
-CLERUM_DEV_MODE=true \
-CLERUM_MCP_SERVERS='[
- {
- "name": "filesystem",
- "spec": {
- "contextRef": "dev-context",
- "description": "Filesystem operations",
- "image": "mcp/filesystem:latest",
- "transport": {"type": "sse", "url": "http://localhost:3001/sse", "port": 3001},
- "enabled": true
- }
- }
-]' \
-CLERUM_MCP_AUTH='{"github":"ghp_your_token_here"}' \
-make dev
+`make dev` requires a `.env` file — it sources `./.env` and exits with an error if the file is absent. Because the recipe re-sources `.env` after make has exported the environment, any key defined in `.env` overrides a value passed inline on the command line; a variable _not_ present in `.env` is passed through untouched. To provide your own servers, put them in `.env`:
+
+```bash
+CLERUM_DEV_MODE=true
+CLERUM_MCP_SERVERS='[{"name":"filesystem","spec":{"contextRef":"dev-context","description":"Filesystem operations","image":"mcp/filesystem:latest","transport":{"type":"sse","url":"http://localhost:3001/sse","port":3001},"enabled":true}}]'
+CLERUM_CONTEXTS='[{"name":"dev-context","namespace":"dev","spec":{"contextId":"dev-context","description":"Dev context","mcpServers":["filesystem"]}}]'
+CLERUM_MCP_AUTH='{"github":"ghp_your_token_here"}'
```
+In dev mode, `GET /api/v1/mcpservers/context/:contextRef` uses `CLERUM_CONTEXTS` when it is set: it returns the enabled servers named in the matching Context's `mcpServers` list, and returns an empty list if no Context with that name was loaded. When `CLERUM_CONTEXTS` is unset, it falls back to returning the enabled servers whose own `spec.contextRef` matches.
+
### Production Mode (with Kubernetes)
+Run against the cluster in your current kubeconfig (watches K8s for McpServer and Context CRDs) with `CLERUM_DEV_MODE` unset. Outside dev mode the process also requires `INTERNAL_CONTROL_JWT_HCC_HMAC_SECRET` — without it, startup aborts with `[HCC] FATAL: INTERNAL_CONTROL_JWT_HCC_HMAC_SECRET env var is required` and exit code 1:
+
```bash
-# Run with kubectl access (watches K8s for McpServer and Context CRDs)
-make dev
+make build
+INTERNAL_CONTROL_JWT_HCC_HMAC_SECRET=<hmac-secret> npm start
```
+`make dev` also works, but only if a `.env` file exists (see above) — it is the same target, so it aborts when `.env` is absent. Leave `CLERUM_DEV_MODE` out of that `.env` and set `INTERNAL_CONTROL_JWT_HCC_HMAC_SECRET` in it to run against a real cluster.
+
## Deployment
+`host-context-controller/Dockerfile` copies `packages/workflow-recipe-capability-policy`, `packages/image-policy` and `host-context-controller/`, so **the build context must be the repo root**, not this directory. Build from the repo root and point `-f` at the Dockerfile:
+
```bash
-# Build Docker image
-make docker-build
+# From the repo root
+export IMAGE=ghcr.io/<org>/host-context-controller:$(git describe --tags --always)
-# Build and push to registry
-make docker-push
+# Build
+docker build -f host-context-controller/Dockerfile -t "$IMAGE" .
-# Deploy to Kubernetes (namespace, RBAC, deployment, service)
-make deploy
+# Push
+docker push "$IMAGE"
-# Undeploy
-make undeploy
+# Multi-platform build + push (ARM host targeting an amd64 cluster)
+docker buildx build --platform linux/amd64 -f host-context-controller/Dockerfile -t "$IMAGE" --push .
```
+
+For a local minikube cluster, `scripts/minikube/build-images.sh` builds this image (and the other services) with the correct root context.
+
+> The component Makefile's `docker-build` / `docker-push` / `docker-push-cross` targets pass this directory as the build context, so the `COPY packages/...` layer cannot resolve and the build fails. Use the root-context commands above.
+
+The component Makefile does not deploy. The controller's ServiceAccount, Deployment and Service live in `deploy/base/control-plane/host-context-controller.yaml`; namespaces are in `deploy/base/namespaces.yaml` and RBAC in `deploy/base/<namespace>/rbac.yaml`. All are applied with kustomize from the repo root, e.g. `kubectl apply -k deploy/overlays/minikube`.
diff --git a/host-context-controller/src/config.ts b/host-context-controller/src/config.ts
index 70d56812c..7f4db6a3d 100644
--- a/host-context-controller/src/config.ts
+++ b/host-context-controller/src/config.ts
@@ -384,7 +384,7 @@ export const config: Config = {
// stdio-bridge sidecar image
stdioBridgeImage: getEnv(
'CONTEXT_MAPPER_STDIO_BRIDGE_IMAGE',
- 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/stdio-bridge:0.1.0'
+ 'ghcr.io/evenfire-ai/stdio-bridge:0.1.0'
)!,
// stdio-bridge sidecar resource defaults
@@ -437,7 +437,7 @@ export const config: Config = {
// Host runtime defaults
hostImage: getEnv(
'CONTEXT_MAPPER_HOST_IMAGE',
- 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/mcp-host:0.6.0'
+ 'ghcr.io/evenfire-ai/mcp-host:0.6.0'
)!,
hostImagePullPolicy: getEnv('CONTEXT_MAPPER_HOST_IMAGE_PULL_POLICY', 'Always') as
| 'Always'
@@ -493,7 +493,7 @@ export const config: Config = {
// workspace-files-controller (per-SharedFileSystem) reconciliation defaults
wfcImage: getEnv(
'CONTEXT_MAPPER_WFC_IMAGE',
- 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/workspace-files-controller:0.1.0'
+ 'ghcr.io/evenfire-ai/workspace-files-controller:0.1.0'
)!,
wfcImagePullPolicy: getEnv('CONTEXT_MAPPER_WFC_IMAGE_PULL_POLICY', 'IfNotPresent') as
| 'Always'
diff --git a/host-context-controller/src/gfsConfig.test.ts b/host-context-controller/src/gfsConfig.test.ts
index 104ca6043..de9af97dd 100644
--- a/host-context-controller/src/gfsConfig.test.ts
+++ b/host-context-controller/src/gfsConfig.test.ts
@@ -31,7 +31,7 @@ describe('gfsDefaultFactoryConfig', () => {
process.env.CONTEXT_MAPPER_NODELOCAL_DNS_CIDR = '203.0.113.10/32'
expect(gfsDefaultFactoryConfig().nodeLocalDnsCidr).toBe('203.0.113.10/32')
- process.env.CONTEXT_MAPPER_NODELOCAL_DNS_CIDR = '34.118.224.0/24'
+ process.env.CONTEXT_MAPPER_NODELOCAL_DNS_CIDR = '203.0.113.0/24'
expect(() => gfsDefaultFactoryConfig()).toThrow(/expected \/32 CIDR/)
})
})
diff --git a/host-context-controller/test/config.k8sApiCidrs.test.ts b/host-context-controller/test/config.k8sApiCidrs.test.ts
index 50a3a90bf..e8ca5766c 100644
--- a/host-context-controller/test/config.k8sApiCidrs.test.ts
+++ b/host-context-controller/test/config.k8sApiCidrs.test.ts
@@ -13,9 +13,9 @@ describe('config.k8sApiCidrs', () => {
})
it('parses a comma-separated value', async () => {
- process.env.CONTEXT_MAPPER_K8S_API_CIDRS = '203.0.113.10/32,10.128.0.2/32'
+ process.env.CONTEXT_MAPPER_K8S_API_CIDRS = '203.0.113.1/32,10.128.0.2/32'
const { config } = await import('../src/config')
- expect(config.k8sApiCidrs).toEqual(['203.0.113.10/32', '10.128.0.2/32'])
+ expect(config.k8sApiCidrs).toEqual(['203.0.113.1/32', '10.128.0.2/32'])
})
it('crashes module load on an over-broad value (fail-closed)', async () => {
diff --git a/host-context-controller/test/k8sApiCidrs.test.ts b/host-context-controller/test/k8sApiCidrs.test.ts
index 29311c463..920834646 100644
--- a/host-context-controller/test/k8sApiCidrs.test.ts
+++ b/host-context-controller/test/k8sApiCidrs.test.ts
@@ -12,12 +12,12 @@ describe('parseK8sApiCidrs', () => {
})
it('accepts a single /32', () => {
- expect(parseK8sApiCidrs('203.0.113.10/32')).toEqual(['203.0.113.10/32'])
+ expect(parseK8sApiCidrs('203.0.113.1/32')).toEqual(['203.0.113.1/32'])
})
it('accepts two CIDRs and trims whitespace', () => {
- expect(parseK8sApiCidrs(' 203.0.113.10/32 , 10.128.0.2/32 ')).toEqual([
- '203.0.113.10/32',
+ expect(parseK8sApiCidrs(' 203.0.113.1/32 , 10.128.0.2/32 ')).toEqual([
+ '203.0.113.1/32',
'10.128.0.2/32',
])
})
@@ -27,7 +27,7 @@ describe('parseK8sApiCidrs', () => {
})
it('rejects a missing prefix', () => {
- expect(() => parseK8sApiCidrs('203.0.113.10')).toThrow(/missing prefix/)
+ expect(() => parseK8sApiCidrs('203.0.113.1')).toThrow(/missing prefix/)
})
it('rejects an invalid IP', () => {
@@ -56,7 +56,7 @@ describe('parseK8sApiCidrs', () => {
})
it('throws if any entry in a list is bad (no partial accept)', () => {
- expect(() => parseK8sApiCidrs('203.0.113.10/32,0.0.0.0/0')).toThrow(/over-broad/)
+ expect(() => parseK8sApiCidrs('203.0.113.1/32,0.0.0.0/0')).toThrow(/over-broad/)
})
})
@@ -86,6 +86,6 @@ describe('parseNodeLocalDnsCidr', () => {
})
it('rejects ranges wider than a single service IP', () => {
- expect(() => parseNodeLocalDnsCidr('34.118.224.0/24')).toThrow(/expected \/32/)
+ expect(() => parseNodeLocalDnsCidr('203.0.113.0/24')).toThrow(/expected \/32/)
})
})
diff --git a/host-context-controller/test/networkPolicyReconciler.k8sApiEgress.test.ts b/host-context-controller/test/networkPolicyReconciler.k8sApiEgress.test.ts
index fa7fd9cf2..4737802dc 100644
--- a/host-context-controller/test/networkPolicyReconciler.k8sApiEgress.test.ts
+++ b/host-context-controller/test/networkPolicyReconciler.k8sApiEgress.test.ts
@@ -11,7 +11,7 @@ vi.mock('../src/config', () => ({
rpcProxyNamespace: 'rpc-proxy',
runtimeNamespaces: ['mcp-server', 'rpc-proxy', 'sandbox-recipes'],
port: 8081,
- k8sApiCidrs: ['203.0.113.10/32', '10.128.0.2/32'],
+ k8sApiCidrs: ['203.0.113.1/32', '10.128.0.2/32'],
},
}))
@@ -48,7 +48,7 @@ describe('ensureK8sApiEgress', () => {
const np = k8sApiEgressFor('mcp-server')
expect(np).toBeDefined()
const blocks = np!.spec!.egress![0].to!.map(t => t.ipBlock!.cidr)
- expect(blocks).toEqual(['203.0.113.10/32', '10.128.0.2/32'])
+ expect(blocks).toEqual(['203.0.113.1/32', '10.128.0.2/32'])
})
it('applies the same CIDR set to every runtime namespace', async () => {
diff --git a/mcp-host/README.md b/mcp-host/README.md
index 2a8aab82a..a104d0ddd 100644
--- a/mcp-host/README.md
+++ b/mcp-host/README.md
@@ -1,12 +1,12 @@
# MCP Host
-MCP Host is a Kubernetes-native service that reads Host CRD configuration and provides LLM access via OpenAI or Claude. It exposes an HTTP RPC endpoint for receiving messages from channel-reader and connects to MCP (Model Context Protocol) servers for tool capabilities.
+MCP Host is a Kubernetes-native service that reads Host CRD configuration and provides LLM access via OpenAI, Anthropic Claude, Z.AI, or Alibaba Bailian. It exposes an HTTP RPC endpoint for receiving messages from channel-reader and connects to MCP (Model Context Protocol) servers for tool capabilities.
## Features
- Reads Host CRD from Kubernetes
- Fetches API keys from referenced Kubernetes Secret
-- Supports both OpenAI and Anthropic Claude providers
+- Supports OpenAI, Anthropic Claude, Z.AI, and Bailian providers (see [Supported LLM Providers](#supported-llm-providers))
- Watches for Host CRD changes and reloads configuration
- HTTP RPC server for receiving messages from channel-reader
- Connects to MCP servers via host-context-controller service for tool capabilities
@@ -17,47 +17,47 @@ MCP Host is a Kubernetes-native service that reads Host CRD configuration and pr
### Environment Variables
-| Variable | Explanation | Canonical example |
-| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `CLERUM_DEV_MODE` | Enables local/dev bootstrap mode that bypasses Host CRD discovery and reads host/runtime config from env. | `CLERUM_DEV_MODE=true` |
-| `CLERUM_HOST_NAME` | Selects which Host CRD to load in production mode; in non-production fallback it defaults to `dev-host`. | `CLERUM_HOST_NAME=chatllm` |
-| `CLERUM_NAMESPACE` | Sets the Kubernetes namespace used for Host and Secret lookup when running in cluster mode. | `CLERUM_NAMESPACE=mcp-host` |
-| `CLERUM_SERVER_PORT` | Sets the HTTP listen port for the runtime API server. | `CLERUM_SERVER_PORT=8080` |
-| `CLERUM_CONTEXT_MAPPER_URL` | Points to the host-context-controller endpoint used to resolve MCP servers for a context. | `CLERUM_CONTEXT_MAPPER_URL=http://host-context-controller-api-gateway.control-plane.svc.cluster.local:8081` |
-| `CLERUM_CONTEXT_MAPPER_POLL_INTERVAL` | Controls polling interval (milliseconds) for MCP server config changes from context mapper. | `CLERUM_CONTEXT_MAPPER_POLL_INTERVAL=30000` |
-| `CLERUM_HOST_CONFIG` | Provides a full Host spec as JSON in dev mode, overriding provider/model context env composition. | `CLERUM_HOST_CONFIG={"host":"dev-host","contextRef":"dev-context","secretRef":"dev-secret","model":{"provider":"openai","name":"gpt-5.4-mini"}}` |
-| `CLERUM_MODEL_PROVIDER` | Chooses the model provider in dev mode when `CLERUM_HOST_CONFIG` is not set. | `CLERUM_MODEL_PROVIDER=openai` |
-| `CLERUM_MODEL_NAME` | Overrides the default provider model name in dev mode. | `CLERUM_MODEL_NAME=gpt-5.4-mini` |
-| `CLERUM_MCP_SERVERS` | Supplies dev MCP server definitions as JSON so you can run without context mapper. | `CLERUM_MCP_SERVERS=[{"name":"filesystem","transport":{"type":"streamableHttp","url":"http://localhost:3101"}}]` |
-| `CLERUM_MCP_TOOL_TIMEOUT_MS` | Per-call timeout passed to MCP SDK `Client.callTool(...)` requests. The effective timeout is still bounded by any caller workflow or snippet step budget. | `CLERUM_MCP_TOOL_TIMEOUT_MS=3600000` |
-| `CLERUM_MCP_TOOL_MAX_TOTAL_TIMEOUT_MS` | Maximum total MCP SDK tool-call budget used at the SDK request boundary. Operators may tune it up to the existing workflow step ceiling; invalid values fail closed at runtime. | `CLERUM_MCP_TOOL_MAX_TOTAL_TIMEOUT_MS=3600000` |
-| `OPENAI_API_KEY` | OpenAI API key used by dev mode when provider selection resolves to OpenAI. | `OPENAI_API_KEY=sk-xxxx` |
-| `CLAUDE_API_KEY` | Anthropic API key used by dev mode when provider selection resolves to Claude. | `CLAUDE_API_KEY=sk-ant-xxxx` |
-| `ZAI_API_KEY` | ZAI API key used by dev mode when provider selection resolves to ZAI. | `ZAI_API_KEY=zai-xxxx` |
-| `BAILIAN_API_KEY` | Bailian API key used by dev mode when provider selection resolves to Bailian/Qwen. | `BAILIAN_API_KEY=ba-xxxx` |
-| `CLERUM_AGENT_TASK_DELAY` | Delay in milliseconds between queued task processing attempts in the state machine loop. | `CLERUM_AGENT_TASK_DELAY=100` |
-| `CLERUM_AGENT_MAX_TASK_DURATION` | Maximum task runtime in milliseconds before task execution is treated as timed out. | `CLERUM_AGENT_MAX_TASK_DURATION=300000` |
-| `CLERUM_AGENT_MAX_TOOL_CALLS` | Hard cap on tool calls per task to prevent unbounded tool loops. | `CLERUM_AGENT_MAX_TOOL_CALLS=50` |
-| `CLERUM_AGENT_MAX_QUEUE_SIZE` | Maximum pending queue size before new tasks are rejected/back-pressured. | `CLERUM_AGENT_MAX_QUEUE_SIZE=100` |
-| `CLERUM_ENABLE_APPROVAL` | Enables the approval gate workflow for tool execution decisions. | `CLERUM_ENABLE_APPROVAL=true` |
-| `CLERUM_APPROVAL_CONFIG` | JSON config for approval policy/channels when not sourced from Host CRD. | `CLERUM_APPROVAL_CONFIG={"defaultPolicy":"designated_approvers","channels":{"telegram":{"enabled":true,"approvers":["123456"]}}}` |
-| `CLERUM_ENABLE_NUDGE` | Enables the nudge controller that pushes model/tool retry guidance when output is rejected. | `CLERUM_ENABLE_NUDGE=false` |
-| `CLERUM_NUDGE_MAX_ITERATIONS` | Maximum number of nudge cycles allowed for a task. | `CLERUM_NUDGE_MAX_ITERATIONS=3` |
-| `CLERUM_CONTEXT_MAX_TOKENS` | Token budget used by context compaction logic before pruning/summarization. | `CLERUM_CONTEXT_MAX_TOKENS=100000` |
-| `CLERUM_WORKSPACE_PATH` | Base workspace path used by native tools and workspace-aware operations. | `CLERUM_WORKSPACE_PATH=/workspace` |
-| `CLERUM_SHELL_TIMEOUT` | Maximum execution time in milliseconds for shell native-tool commands. | `CLERUM_SHELL_TIMEOUT=30000` |
-| `CLERUM_TOOL_TIMEOUT` | Maximum execution time in milliseconds for native tool wrapper calls. This is separate from the MCP SDK request timeout controlled by `CLERUM_MCP_TOOL_TIMEOUT_MS`. | `CLERUM_TOOL_TIMEOUT=660000` |
-| `CLERUM_HTTP_ALLOWLIST` | Comma-separated allowlist of outbound hosts/URLs allowed for HTTP native tools. With an allowlist set, you can also skip per-call approval by adding `tools: { http_request: false }` under `Host.spec.approval` (see Host CRD). | `CLERUM_HTTP_ALLOWLIST=api.github.com,example.com` |
-| `CLERUM_ENV_ALLOWLIST` | Comma-separated list of environment variables forwarded into native tool execution contexts. | `CLERUM_ENV_ALLOWLIST=PATH,HOME,USER,SHELL,LANG,TERM` |
-| `CLERUM_MEMORY_MAX_SIZE` | Maximum bytes reserved for in-memory native tool buffers/state. | `CLERUM_MEMORY_MAX_SIZE=1048576` |
-| `CLERUM_ENABLE_RESPONSE_ATTACHMENTS` | Enables attachment passthrough in runtime responses when tools return supported media. | `CLERUM_ENABLE_RESPONSE_ATTACHMENTS=true` |
-| `CLERUM_ATTACHMENT_MAX_COUNT` | Maximum number of attachments returned per response. | `CLERUM_ATTACHMENT_MAX_COUNT=3` |
-| `CLERUM_ATTACHMENT_MAX_BYTES` | Maximum decoded size per attachment in bytes (oversized payloads are dropped). | `CLERUM_ATTACHMENT_MAX_BYTES=52428800` |
-| `CLERUM_MEMORY_ENABLED` | Enables workspace memory persistence features. | `CLERUM_MEMORY_ENABLED=true` |
-| `CLERUM_MEMORY_WORKSPACE_PATH` | Sets workspace directory path used when memory mode is enabled. | `CLERUM_MEMORY_WORKSPACE_PATH=/workspace` |
-| `CLERUM_PERSONALIZATION_ENABLED` | Enables identity/personalization seeding behavior. | `CLERUM_PERSONALIZATION_ENABLED=true` |
-| `CLERUM_IDENTITY_SEED` | JSON identity seed used to initialize personalization artifacts when enabled. | `CLERUM_IDENTITY_SEED={"displayName":"Clerum Agent","tone":"concise"}` |
-| `NODE_ENV` | Influences production checks and defaults (for example strict host-name requirement in production). | `NODE_ENV=production` |
+| Variable | Explanation | Canonical example |
+| -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CLERUM_DEV_MODE` | Enables local/dev bootstrap mode that bypasses Host CRD discovery and reads host/runtime config from env. | `CLERUM_DEV_MODE=true` |
+| `CLERUM_HOST_NAME` | Selects which Host CRD to load in production mode; in non-production fallback it defaults to `dev-host`. | `CLERUM_HOST_NAME=chatllm` |
+| `CLERUM_NAMESPACE` | Sets the Kubernetes namespace used for Host and Secret lookup when running in cluster mode. | `CLERUM_NAMESPACE=mcp-host` |
+| `CLERUM_SERVER_PORT` | Sets the HTTP listen port for the runtime API server. | `CLERUM_SERVER_PORT=8080` |
+| `CLERUM_CONTEXT_MAPPER_URL` | Points to the host-context-controller endpoint used to resolve MCP servers for a context. | `CLERUM_CONTEXT_MAPPER_URL=http://host-context-controller-api-gateway.control-plane.svc.cluster.local:8081` |
+| `CLERUM_CONTEXT_MAPPER_POLL_INTERVAL` | Controls polling interval (milliseconds) for MCP server config changes from context mapper. | `CLERUM_CONTEXT_MAPPER_POLL_INTERVAL=30000` |
+| `CLERUM_HOST_CONFIG` | Provides a full Host spec as JSON in dev mode, overriding provider/model context env composition. | `CLERUM_HOST_CONFIG={"host":"dev-host","contextRef":"dev-context","secretRef":"dev-secret","model":{"provider":"openai","name":"gpt-5.4-mini"}}` |
+| `CLERUM_MODEL_PROVIDER` | Chooses the model provider in dev mode when `CLERUM_HOST_CONFIG` is not set. | `CLERUM_MODEL_PROVIDER=openai` |
+| `CLERUM_MODEL_NAME` | Overrides the default provider model name in dev mode. | `CLERUM_MODEL_NAME=gpt-5.4-mini` |
+| `CLERUM_MCP_SERVERS` | Supplies dev MCP server definitions as JSON so you can run without context mapper. Each entry needs `name`, `contextRef`, `transport`, `enabled`, and a `status` object — a server whose `status.ready` is not `true` is parsed but skipped as "not ready". | `CLERUM_MCP_SERVERS=[{"name":"filesystem","contextRef":"dev-context","transport":{"type":"streamableHttp","url":"http://localhost:3101"},"enabled":true,"status":{"deployed":true,"ready":true}}]` |
+| `CLERUM_MCP_TOOL_TIMEOUT_MS` | Per-call timeout passed to MCP SDK `Client.callTool(...)` requests. The effective timeout is still bounded by any caller workflow or snippet step budget. | `CLERUM_MCP_TOOL_TIMEOUT_MS=3600000` |
+| `CLERUM_MCP_TOOL_MAX_TOTAL_TIMEOUT_MS` | Maximum total MCP SDK tool-call budget used at the SDK request boundary. Operators may tune it up to the existing workflow step ceiling; invalid values fail closed at runtime. | `CLERUM_MCP_TOOL_MAX_TOTAL_TIMEOUT_MS=3600000` |
+| `OPENAI_API_KEY` | OpenAI API key used by dev mode when provider selection resolves to OpenAI. | `OPENAI_API_KEY=sk-xxxx` |
+| `CLAUDE_API_KEY` | Anthropic API key used by dev mode when provider selection resolves to Claude. | `CLAUDE_API_KEY=sk-ant-xxxx` |
+| `ZAI_API_KEY` | ZAI API key used by dev mode when provider selection resolves to ZAI. | `ZAI_API_KEY=zai-xxxx` |
+| `BAILIAN_API_KEY` | Bailian API key used by dev mode when provider selection resolves to Bailian/Qwen. | `BAILIAN_API_KEY=ba-xxxx` |
+| `CLERUM_AGENT_TASK_DELAY` | Delay in milliseconds between queued task processing attempts in the state machine loop. | `CLERUM_AGENT_TASK_DELAY=100` |
+| `CLERUM_AGENT_MAX_TASK_DURATION` | Maximum task runtime in milliseconds before task execution is treated as timed out. | `CLERUM_AGENT_MAX_TASK_DURATION=1800000` |
+| `CLERUM_AGENT_MAX_TOOL_CALLS` | Hard cap on tool calls per task to prevent unbounded tool loops. | `CLERUM_AGENT_MAX_TOOL_CALLS=50` |
+| `CLERUM_AGENT_MAX_QUEUE_SIZE` | Maximum pending queue size before new tasks are rejected/back-pressured. | `CLERUM_AGENT_MAX_QUEUE_SIZE=100` |
+| `CLERUM_ENABLE_APPROVAL` | Enables the approval gate workflow for tool execution decisions. | `CLERUM_ENABLE_APPROVAL=true` |
+| `CLERUM_APPROVAL_CONFIG` | JSON config for approval policy/channels when not sourced from Host CRD. | `CLERUM_APPROVAL_CONFIG={"defaultPolicy":"designated_approvers","channels":{"telegram":{"enabled":true,"approvers":["123456"]}}}` |
+| `CLERUM_ENABLE_NUDGE` | Enables the nudge controller that pushes model/tool retry guidance when output is rejected. | `CLERUM_ENABLE_NUDGE=false` |
+| `CLERUM_NUDGE_MAX_ITERATIONS` | Maximum number of nudge cycles allowed for a task. | `CLERUM_NUDGE_MAX_ITERATIONS=3` |
+| `CLERUM_CONTEXT_MAX_TOKENS` | Token budget used by context compaction logic before pruning/summarization. | `CLERUM_CONTEXT_MAX_TOKENS=100000` |
+| `CLERUM_WORKSPACE_PATH` | Base workspace path used by native tools and workspace-aware operations. | `CLERUM_WORKSPACE_PATH=/workspace` |
+| `CLERUM_SHELL_TIMEOUT` | Maximum execution time in milliseconds for shell native-tool commands. | `CLERUM_SHELL_TIMEOUT=600000` |
+| `CLERUM_TOOL_TIMEOUT` | Maximum execution time in milliseconds for native tool wrapper calls. This is separate from the MCP SDK request timeout controlled by `CLERUM_MCP_TOOL_TIMEOUT_MS`. | `CLERUM_TOOL_TIMEOUT=660000` |
+| `CLERUM_HTTP_ALLOWLIST` | Comma-separated allowlist of outbound hosts/URLs allowed for HTTP native tools. With an allowlist set, you can also skip per-call approval by adding `tools: { http_request: false }` under `Host.spec.approval` (see Host CRD). | `CLERUM_HTTP_ALLOWLIST=api.github.com,example.com` |
+| `CLERUM_ENV_ALLOWLIST` | Comma-separated list of environment variables forwarded into native tool execution contexts. | `CLERUM_ENV_ALLOWLIST=PATH,HOME,USER,SHELL,LANG,TERM` |
+| `CLERUM_MEMORY_MAX_SIZE` | Maximum bytes reserved for in-memory native tool buffers/state. | `CLERUM_MEMORY_MAX_SIZE=1048576` |
+| `CLERUM_ENABLE_RESPONSE_ATTACHMENTS` | Enables attachment passthrough in runtime responses when tools return supported media. | `CLERUM_ENABLE_RESPONSE_ATTACHMENTS=true` |
+| `CLERUM_ATTACHMENT_MAX_COUNT` | Maximum number of attachments returned per response. | `CLERUM_ATTACHMENT_MAX_COUNT=3` |
+| `CLERUM_ATTACHMENT_MAX_BYTES` | Maximum decoded size per attachment in bytes (oversized payloads are dropped). | `CLERUM_ATTACHMENT_MAX_BYTES=52428800` |
+| `CLERUM_MEMORY_ENABLED` | Enables workspace memory persistence features. | `CLERUM_MEMORY_ENABLED=true` |
+| `CLERUM_MEMORY_WORKSPACE_PATH` | Sets workspace directory path used when memory mode is enabled. | `CLERUM_MEMORY_WORKSPACE_PATH=/workspace` |
+| `CLERUM_PERSONALIZATION_ENABLED` | Enables identity/personalization seeding behavior. | `CLERUM_PERSONALIZATION_ENABLED=true` |
+| `CLERUM_IDENTITY_SEED` | JSON identity seed used to initialize personalization artifacts when enabled. | `CLERUM_IDENTITY_SEED={"displayName":"Clerum Agent","tone":"concise"}` |
+| `NODE_ENV` | Influences production checks and defaults (for example strict host-name requirement in production). | `NODE_ENV=production` |
### Host CRD
@@ -81,6 +81,37 @@ spec:
- slack-channel
```
+### Supported LLM Providers
+
+Configured via the Host CRD `spec.model.provider` field (or
+`CLERUM_MODEL_PROVIDER` in dev mode):
+
+| Provider | `provider` value | Default Model | API |
+| ------------------------------------ | ---------------- | ------------------- | ----------------------- |
+| OpenAI | `openai` | `gpt-5.4-mini` | OpenAI Chat Completions |
+| Anthropic Claude | `claude` | `claude-sonnet-4-6` | Anthropic Messages |
+| ZAI (z.ai) | `zai` | `glm-5.1` | OpenAI-compatible |
+| Alibaba Cloud Model Studio (Bailian) | `bailian` | `qwen3-coder-plus` | OpenAI-compatible |
+
+Providers are defined data-first in `src/llm/registryCore.ts` — OpenAI-compatible
+providers are pure data entries (adding one requires a descriptor, not new code).
+
+#### Bailian (Alibaba Cloud Model Studio)
+
+Bailian provides access to multiple models through Alibaba Cloud's Coding Plan,
+including Qwen, MiniMax, GLM, and Kimi models.
+
+Available models: `qwen3-coder-plus`, `qwen3.5-plus`, `qwen3-coder-next`,
+`qwen3-max-2026-01-23`, `MiniMax-M2.5`, `glm-5.1`, `glm-5`, `glm-4.7`, `kimi-k2.5`
+
+**Dev mode:**
+
+```bash
+CLERUM_DEV_MODE=true BAILIAN_API_KEY=sk-... CLERUM_MODEL_PROVIDER=bailian npm run dev
+```
+
+Get your Coding Plan API key at: https://modelstudio.console.alibabacloud.com/
+
### Per-Tool Approval Overrides
`Host.spec.approval.tools` is an optional map that overrides each native tool's hard-coded `requiresApproval()` default. Use it to skip per-call approval for tools whose risk you mitigate via a different gate (e.g. `http_request` paired with `CLERUM_HTTP_ALLOWLIST`).
@@ -116,11 +147,7 @@ kubectl create secret generic mcp-host-keys \
--from-literal=claude-api-key=sk-ant-xxx
```
-Or apply the example secret (edit with your keys first):
-
-```bash
-kubectl apply -f deploy/secret.yaml
-```
+The Secret name is what you reference from `Host.spec.secretRef`.
## Development
@@ -204,15 +231,18 @@ make build
make docker-push
```
-4. Deploy:
- ```bash
- make deploy
- ```
+4. That's it — there is no `make deploy`. mcp-host Deployments are never applied
+ by hand: host-context-controller reconciles the Host CRD and creates the
+ per-Host Deployment, ServiceAccount and Role (`host-<hostRef>-sa`,
+ `host-<hostRef>-config-reader`) for you.
### Undeploy
+Delete the Host CRD; host-context-controller tears down the per-Host workload it
+created.
+
```bash
-make undeploy
+kubectl delete host chatllm
```
## Architecture
@@ -262,6 +292,16 @@ Each runtime route is backed by an internal RPCServer callback (`onMessage`, `on
| Read pending cron deliveries | `GET /v1/runtime/cron/results` | `onCronResults(handler)` | Yes |
| Acknowledge cron delivery | `DELETE /v1/runtime/cron/results/:taskId` | `onCronResultAck(handler)` | Yes |
+These routes are not directly callable by end users. Every route above except
+`GET /v1/runtime` and `GET /v1/runtime/health` is wrapped in `runtimeEdgeGuard`,
+which requires the `x-clerum-edge-caller` header (one of `rpc-proxy`,
+`channel-reader`, `workflow-approval-request-reader`), `x-clerum-edge-host-ref`
+matching this pod's own host (403 otherwise), and `x-clerum-edge-user-id` when
+the caller is `rpc-proxy`. A request carrying an `Authorization` header is
+rejected with 401 on these routes. In practice you reach mcp-host through
+rpc-proxy or channel-reader, which set those headers; the body below is what
+they forward.
+
### Canonical message request example
```json
@@ -288,4 +328,8 @@ The MCP Host requires the following permissions:
Note: McpServer CRD access is handled by the `host-context-controller` service, so mcp-host does not need direct permissions for McpServer resources.
-These are configured in `deploy/rbac.yaml`.
+These are not granted by a static manifest. host-context-controller provisions a
+per-Host ServiceAccount (`host-<hostRef>-sa`) bound to a narrow Role
+(`host-<hostRef>-config-reader`) on every reconcile, scoped to exactly the Host
+CRD by name, its env ConfigMap/Secret, and the LLM Secret named by
+`spec.secretRef` — so one Host cannot read another Host's resources.
diff --git a/mcp-host/src/agent/__tests__/statelessCronApprovalNotification.test.ts b/mcp-host/src/agent/__tests__/statelessCronApprovalNotification.test.ts
index 692ecc824..f581c1981 100644
--- a/mcp-host/src/agent/__tests__/statelessCronApprovalNotification.test.ts
+++ b/mcp-host/src/agent/__tests__/statelessCronApprovalNotification.test.ts
@@ -62,7 +62,9 @@ describe('buildApprovalNotification — cron×stateless prompt (cron×stateless)
const msg = buildNotification(makeApproval(), cliConfig, 'telegram')
expect(msg.startsWith(STATELESS_CRON_APPROVAL_PROMPT)).toBe(true)
expect(msg).toContain('Request ID: approval-test-1')
- expect(msg).toContain('Please approve via CLI: POST /approve')
+ expect(msg).toContain('Please approve via CLI: POST /v1/runtime/approvals/approve')
+ // F16 guard: the server serves ONLY the full route; a bare `POST /approve` is a 404 instruction.
+ expect(msg).not.toMatch(/POST \/approve(?![\w/])/)
})
it('keeps the generic lead for every other approval (regression guard)', () => {
diff --git a/mcp-host/src/agent/stateMachine.ts b/mcp-host/src/agent/stateMachine.ts
index 665a7e815..923369d6f 100644
--- a/mcp-host/src/agent/stateMachine.ts
+++ b/mcp-host/src/agent/stateMachine.ts
@@ -1136,7 +1136,7 @@ export class AgentStateMachine extends EventEmitter {
? channelType === 'slack'
? 'Use the approval controls to continue or cancel.'
: 'Reply /approve or /deny to this message.'
- : `Request ID: ${approval.request_id}. Please approve via CLI: POST /approve`)
+ : `Request ID: ${approval.request_id}. Please approve via CLI: POST /v1/runtime/approvals/approve`)
)
}
@@ -1154,7 +1154,7 @@ export class AgentStateMachine extends EventEmitter {
`Tool \`${approval.tool_name}\` requires approval. ` +
`Parameters: ${paramSummary}. ` +
`Request ID: ${approval.request_id}. ` +
- `Please approve via CLI: POST /approve`
+ `Please approve via CLI: POST /v1/runtime/approvals/approve`
)
}
diff --git a/mcp-host/src/core/orchestration/__tests__/toolUseLoop.workflowTriggerRecovery.test.ts b/mcp-host/src/core/orchestration/__tests__/toolUseLoop.workflowTriggerRecovery.test.ts
index e0c556a8b..36ca82e00 100644
--- a/mcp-host/src/core/orchestration/__tests__/toolUseLoop.workflowTriggerRecovery.test.ts
+++ b/mcp-host/src/core/orchestration/__tests__/toolUseLoop.workflowTriggerRecovery.test.ts
@@ -267,7 +267,7 @@ describe('runToolUseLoop workflow trigger recovery', () => {
JSON.stringify({
items: [
{
- name: 'e2e-risk-review-alfredo-personal',
+ name: 'e2e-risk-review-testuser-personal',
inputs: [],
},
],
@@ -293,7 +293,7 @@ describe('runToolUseLoop workflow trigger recovery', () => {
expect(result.type).toBe('response')
if (result.type === 'response') {
- expect(result.content).toContain('e2e-risk-review-alfredo-personal')
+ expect(result.content).toContain('e2e-risk-review-testuser-personal')
expect(result.content).toContain('Required business inputs: none')
expect(result.content).not.toContain('e2e-ondemand-approval')
}
diff --git a/mcp-servers/README.md b/mcp-servers/README.md
index ea93a618a..d467228b5 100644
--- a/mcp-servers/README.md
+++ b/mcp-servers/README.md
@@ -8,10 +8,16 @@ This directory contains MCP server implementations, test suites, and Kubernetes
## Available Servers
-| Server | Description | Transport | Port |
-|--------|-------------|-----------|------|
-| **Airtable** | Airtable API integration for bases, tables, and records | StreamableHTTP | 3000 |
-| **MongoDB** | MongoDB integration for querying, aggregation, and schema inspection | StreamableHTTP | 3000 |
+| Server | Description | Transport | Port | Status |
+| ---------------------------------------------- | --------------------------------------------------------------------------------------- | -------------- | ---- | ---------------------------------- |
+| **[Airtable](./airtable/README.md)** | Airtable API integration for bases, tables, and records | StreamableHTTP | 3000 | Tested — dedicated unit-test suite |
+| **[MongoDB](./mongodb/README.md)** | MongoDB integration for querying, aggregation, and schema inspection | StreamableHTTP | 3000 | Tested — dedicated unit-test suite |
+| **[Web Search](./web-search/README.md)** | Brave Search API web/news search and page fetching (first-party source) | StreamableHTTP | 3000 | Available — no test suite yet |
+| **[Playwright](./playwright/README.md)** | Browser automation via the upstream Microsoft Playwright MCP image | StreamableHTTP | 8931 | Available — no test suite yet |
+| **[Doc Generator](./doc-generator/README.md)** | Markdown → print-ready HTML documents and Excel (.xlsx) generation (first-party source) | StreamableHTTP | 3000 | Available — no test suite yet |
+| **[Alpha Vantage](./alphavantage/README.md)** | Secret template only — no Dockerfile, source, or CRD yet | — | — | Experimental stub |
+
+"Tested" refers to the unit-test suites under `__tests__/` in this package (see [Testing](#testing)); the servers marked "available" build and deploy but do not have test suites here yet. Web Search and Doc Generator ship no in-tree `mcpserver.yaml` — see their READMEs for how to deploy them.
## Project Structure
@@ -33,6 +39,11 @@ mcp-servers/
│ ├── mongodb.connection.test.ts
│ ├── mongodb.mcp.test.ts
│ └── mongodb.statefulset.test.ts
+├── web-search/ # Web Search MCP server (first-party src/ + Dockerfile)
+├── playwright/ # Playwright MCP server (upstream image + CRD spec)
+├── doc-generator/ # Doc Generator MCP server (first-party src/ + Dockerfile)
+├── alphavantage/ # Experimental stub (secret template only)
+├── makefile # deploy-* / undeploy-* targets (mongodb, airtable, playwright)
├── utils/ # Shared utilities
│ └── yaml-loader.ts # YAML parser for tests
├── vitest.config.ts # Test configuration
@@ -85,7 +96,7 @@ metadata:
namespace: mcp-server
spec:
contextRef: context1
- description: "Airtable MCP server for data operations"
+ description: 'Airtable MCP server for data operations'
image: your-registry.example.com/evenfire/airtable-mcp-server:latest
imagePullPolicy: Always
transport:
@@ -102,11 +113,11 @@ spec:
envVar: AIRTABLE_API_KEY
resources:
requests:
- memory: "128Mi"
- cpu: "100m"
+ memory: '128Mi'
+ cpu: '100m'
limits:
- memory: "256Mi"
- cpu: "500m"
+ memory: '256Mi'
+ cpu: '500m'
auth:
type: none
enabled: true
@@ -170,10 +181,13 @@ All servers use **StreamableHTTP** transport:
## Resource Requirements
-| Server | Memory Request | Memory Limit | CPU Request | CPU Limit |
-|--------|----------------|--------------|-------------|-----------|
-| Airtable | 128Mi | 256Mi | 100m | 500m |
-| MongoDB | 128Mi | 256Mi | 100m | 500m |
+| Server | Memory Request | Memory Limit | CPU Request | CPU Limit |
+| ---------- | -------------- | ------------ | ----------- | --------- |
+| Airtable | 128Mi | 256Mi | 100m | 500m |
+| MongoDB | 128Mi | 256Mi | 100m | 500m |
+| Playwright | 512Mi | 1Gi | 250m | 1000m |
+
+Web Search and Doc Generator have no in-tree `McpServer` CRD, so no resource requirements are defined here.
## Architecture
@@ -197,6 +211,7 @@ MCP servers are deployed as Kubernetes Deployments (or StatefulSets for stateful
### Test Structure
Follow the established test pattern:
+
- `*.config.test.ts` - CRD configuration validation
- `*.api.test.ts` - API interaction mocks
- `*.mcp.test.ts` - MCP protocol operations
@@ -230,6 +245,7 @@ kubectl logs -n mcp-server -l app=airtable-server
### Connection Failures
Verify:
+
1. Secret exists and has correct keys
2. Service is reachable: `kubectl get svc -n mcp-server`
3. NetworkPolicies allow traffic
@@ -244,22 +260,24 @@ Complete guide for testing the MCP servers (Airtable, MongoDB) in the Clerum pro
### Test Statistics
-| Metric | Value |
-|--------|-------|
-| **Total Test Cases** | 343 unit tests |
-| **Test Framework** | Vitest 4.0.18 |
-| **Test Environment** | Node.js |
-| **Coverage** | Configuration, API, MCP, K8s resources |
+| Metric | Value |
+| -------------------- | -------------------------------------- |
+| **Total Test Cases** | 343 unit tests |
+| **Test Framework** | Vitest 4.0.18 |
+| **Test Environment** | Node.js |
+| **Coverage** | Configuration, API, MCP, K8s resources |
### Test Files by Server
**Airtable**
+
- `airtable.config.test.ts` — CRD and configuration validation
- `airtable.api.test.ts` — Airtable API mocking and interactions
- `airtable.mcp.test.ts` — MCP protocol operations
- `airtable.k8s.test.ts` — Kubernetes resource generation
**MongoDB**
+
- `mongodb.config.test.ts` — CRD and configuration validation
- `mongodb.connection.test.ts` — MongoDB connection handling
- `mongodb.mcp.test.ts` — MCP protocol operations
@@ -307,6 +325,7 @@ Tests are organized into four categories. A given server may have several or all
Validate CRD specifications, environment variable mappings, resource requirements, and secret configurations.
**What they test:**
+
- CRD metadata (API version, kind, names)
- Context references
- Transport configuration (StreamableHTTP)
@@ -316,9 +335,9 @@ Validate CRD specifications, environment variable mappings, resource requirement
- Authentication configuration
```typescript
-expect(crd.apiVersion).toBe('clerum.io/v1alpha1');
-expect(crd.kind).toBe('McpServer');
-expect(crd.spec.transport.type).toBe('streamableHttp');
+expect(crd.apiVersion).toBe('clerum.io/v1alpha1')
+expect(crd.kind).toBe('McpServer')
+expect(crd.spec.transport.type).toBe('streamableHttp')
```
#### 2. API Tests (`*.api.test.ts`)
@@ -326,6 +345,7 @@ expect(crd.spec.transport.type).toBe('streamableHttp');
Test external API interactions using mocks. Validate API client behavior, error handling, and rate limiting.
**What they test:**
+
- API mock setup
- Response parsing
- Error handling (rate limits, auth failures)
@@ -333,6 +353,7 @@ Test external API interactions using mocks. Validate API client behavior, error
- Retry logic
**Key fixtures:**
+
- `MockAirtableClient` — Simulates Airtable API
- `MockMongoClient` — Simulates MongoDB connections
@@ -341,6 +362,7 @@ Test external API interactions using mocks. Validate API client behavior, error
Validate MCP protocol operations including `tools/list`, `tools/call`, and session management.
**What they test:**
+
- MCP `tools/list` endpoint
- Tool parameter validation
- Tool execution (`tools/call`)
@@ -348,6 +370,7 @@ Validate MCP protocol operations including `tools/list`, `tools/call`, and sessi
- Error responses
**Example MCP tools validated:**
+
- `airtable_list_bases`, `airtable_list_tables`, `airtable_list_records`
- `mongodb_find`, `mongodb_aggregate`, `mongodb_count_documents`
@@ -356,6 +379,7 @@ Validate MCP protocol operations including `tools/list`, `tools/call`, and sessi
Validate Kubernetes resource generation (Deployments, Services, StatefulSets).
**What they test:**
+
- Deployment resource generation
- Service resource generation
- StatefulSet generation (MongoDB)
@@ -370,15 +394,16 @@ Validate Kubernetes resource generation (Deployments, Services, StatefulSets).
Simple YAML parser for loading test fixtures from CRD files.
```typescript
-import { loadYaml } from '../../utils/yaml-loader';
+import { loadYaml } from '../../utils/yaml-loader'
-const crd = loadYaml(yamlContent);
-expect(crd.kind).toBe('McpServer');
+const crd = loadYaml(yamlContent)
+expect(crd.kind).toBe('McpServer')
```
#### Mock Clients
Test files include mock implementations for:
+
- `MockAirtableClient` — Airtable API mock
- `MockMongoClient` — MongoDB connection mock
- `MockAirtableMcpServer` — MCP server mock
@@ -386,6 +411,7 @@ Test files include mock implementations for:
### Test Fixtures
Test fixtures are located alongside test files:
+
- `mcpserver.yaml` — CRD specification
- `example.secret.yaml` — Secret template
@@ -409,20 +435,20 @@ Test fixtures are located alongside test files:
### Writing New Tests
```typescript
-import { describe, it, expect, beforeEach } from 'vitest';
-import { loadYaml } from '../../utils/yaml-loader';
+import { beforeEach, describe, expect, it } from 'vitest'
+import { loadYaml } from '../../utils/yaml-loader'
describe('Feature Name', () => {
- let fixture: any;
+ let fixture: any
beforeEach(() => {
- fixture = loadFixture();
- });
+ fixture = loadFixture()
+ })
it('should validate behavior', () => {
- expect(fixture.property).toBe('expected');
- });
-});
+ expect(fixture.property).toBe('expected')
+ })
+})
```
**Best practices:**
@@ -448,9 +474,9 @@ describe('Feature Name', () => {
export default defineConfig({
test: {
testTimeout: 10000, // 10 seconds
- hookTimeout: 10000
- }
-});
+ hookTimeout: 10000,
+ },
+})
```
### CI/CD Integration
diff --git a/mcp-servers/airtable/README.md b/mcp-servers/airtable/README.md
index 7366200d0..094524932 100644
--- a/mcp-servers/airtable/README.md
+++ b/mcp-servers/airtable/README.md
@@ -48,7 +48,7 @@ kubectl apply -f mcpserver.yaml
See `mcpserver.yaml` for the full CRD spec. Key fields:
-- **Image**: `us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp-server:latest`
+- **Image**: `ghcr.io/evenfire-ai/airtable-mcp-server:latest`
- **Namespace**: `mcp-server`
- **Transport**: StreamableHTTP at `http://airtable-server.mcp-server.svc.cluster.local:3000/mcp`
- **EgressBindings**: `api.airtable.com:443/TCP` so HCC can generate the required outbound NetworkPolicy
diff --git a/mcp-servers/airtable/__tests__/airtable.config.test.ts b/mcp-servers/airtable/__tests__/airtable.config.test.ts
index a0cc3b502..21f55fef7 100644
--- a/mcp-servers/airtable/__tests__/airtable.config.test.ts
+++ b/mcp-servers/airtable/__tests__/airtable.config.test.ts
@@ -149,7 +149,7 @@ describe('Airtable MCP Server - CRD Configuration', () => {
describe('Image Configuration', () => {
it('should use correct image registry', () => {
expect(crd.spec.image).toBe(
- 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp-server:latest'
+ 'ghcr.io/evenfire-ai/airtable-mcp-server:latest'
)
})
diff --git a/mcp-servers/airtable/__tests__/airtable.k8s.test.ts b/mcp-servers/airtable/__tests__/airtable.k8s.test.ts
index c91e835d3..c3f66c86c 100644
--- a/mcp-servers/airtable/__tests__/airtable.k8s.test.ts
+++ b/mcp-servers/airtable/__tests__/airtable.k8s.test.ts
@@ -152,7 +152,7 @@ function generateExpectedDeployment(): K8sDeployment {
{
name: 'airtable-server',
image:
- 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp-server:latest',
+ 'ghcr.io/evenfire-ai/airtable-mcp-server:latest',
ports: [
{
containerPort: 3000,
@@ -296,7 +296,7 @@ describe('Airtable MCP Server - Kubernetes Deployment', () => {
it('should use correct image', () => {
expect(container.image).toBe(
- 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp-server:latest'
+ 'ghcr.io/evenfire-ai/airtable-mcp-server:latest'
)
})
@@ -467,7 +467,7 @@ describe('Airtable MCP Server - Kubernetes Deployment', () => {
it('should map CRD image to container image', () => {
expect(crd.spec.image).toBe(
- 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp-server:latest'
+ 'ghcr.io/evenfire-ai/airtable-mcp-server:latest'
)
const deployment = generateExpectedDeployment()
expect(deployment.spec.template.spec.containers[0].image).toBe(crd.spec.image)
diff --git a/mcp-servers/airtable/mcpserver.yaml b/mcp-servers/airtable/mcpserver.yaml
index 14aa330dd..edbfe867a 100644
--- a/mcp-servers/airtable/mcpserver.yaml
+++ b/mcp-servers/airtable/mcpserver.yaml
@@ -13,7 +13,7 @@ spec:
Airtable MCP Server - provides tools for interacting with Airtable bases
including listing bases, querying and searching records, creating/updating/deleting
records, managing tables and fields, and working with comments.
- image: us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp-server:latest
+ image: ghcr.io/evenfire-ai/airtable-mcp-server:latest
imagePullPolicy: Always
transport:
type: streamableHttp
diff --git a/packages/image-policy/index.cjs b/packages/image-policy/index.cjs
index d58235e51..1d65a9359 100644
--- a/packages/image-policy/index.cjs
+++ b/packages/image-policy/index.cjs
@@ -51,7 +51,7 @@ function matchesAllowedImagePrefix(image, rawPrefix) {
// fully-qualified 'docker.io/mongodb/x' — add the docker.io/-qualified prefix
// too if an org publishes that form.
const DEFAULT_ALLOWED_PLUGIN_IMAGE_PREFIXES = Object.freeze([
- 'us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/',
+ 'ghcr.io/evenfire-ai/',
'example.com/',
'mongodb/',
'mcr.microsoft.com/',
diff --git a/profile-ui/README.md b/profile-ui/README.md
index 3a73db009..5dc29fc67 100644
--- a/profile-ui/README.md
+++ b/profile-ui/README.md
@@ -6,7 +6,8 @@
- Password login through `external-rest-api /api/v1/auth/password-login`
- Authenticated profile home with the signed-in user and email
-- Authenticated settings route placeholder
+- Authenticated settings surface at `/settings` (redirects to `/settings/profile`) for editing your profile, changing your password, and managing social channels (`/settings/social`, `/settings/social/[network]`)
+- Authenticated member invitation route at `/members/invite`, which posts to `external-rest-api /api/v1/members/invite`
- Invitation confirmation route at `/invitations/[token]`
- Desktop app authorization route at `/desktop-setup`
@@ -29,16 +30,15 @@ EXTERNAL_REST_API_INTERNAL_URL=http://localhost:8091 npm run dev -- --port 3001
Invitation flow:
-- `control-ui` creates the invite in `control-api`
-- `control-ui` asks `external-rest-api` to trigger invite delivery, and `external-rest-api` delegates the actual email send to `member-registration-service`
+- an invite is created either by `control-ui` in `control-api`, or by an authenticated `profile-ui` user through `/members/invite`
+- `control-ui` (or an authenticated `profile-ui` user via `/members/invite`) asks `external-rest-api` to create the invitation, which it does through `control-api`
- `profile-ui` loads `/invitations/[token]` without requiring profile login
- the invited user accepts the invitation through the unauthenticated invitation route
- after confirmation, `profile-ui` lets the invited user set their password before downloading Evenfire
-- password setup sends only the invitation token, email, and password to `external-rest-api`; the temporary invitation session stays server-side
+- password setup sends the invitation token, email, invitation id, and password to `external-rest-api`; the temporary invitation session stays server-side
## Deploy
-```bash
-cd profile-ui
-make deploy
-```
+profile-ui ships as part of the platform Kustomize bases — its manifest is
+`deploy/base/profiles/profile-ui.yaml`, applied from the repo root via the
+overlays (`make minikube-deploy-all`). There is no per-service `make deploy`.
diff --git a/profile-ui/test/profileSettings.test.ts b/profile-ui/test/profileSettings.test.ts
index c8f8167cb..7d927608d 100644
--- a/profile-ui/test/profileSettings.test.ts
+++ b/profile-ui/test/profileSettings.test.ts
@@ -27,15 +27,15 @@ test('normalizeProfileChannels fills missing social network keys', () => {
})
test('uniqueTrimmed removes blanks and exact duplicates while preserving order', () => {
- assert.deepEqual(uniqueTrimmed([' @alfredo ', '', '@alfredo', '@other']), ['@alfredo', '@other'])
+ assert.deepEqual(uniqueTrimmed([' @testuser ', '', '@testuser', '@other']), ['@testuser', '@other'])
})
test('normalizeProfileChannels stores Telegram handles with @ prefix', () => {
assert.deepEqual(
normalizeProfileChannels({
- telegramHandles: [' alfredo ', '@other'],
+ telegramHandles: [' testuser ', '@other'],
}).telegramHandles,
- ['@alfredo', '@other']
+ ['@testuser', '@other']
)
})
@@ -44,7 +44,7 @@ test('profile channel draft serializes only non-empty values', () => {
const draft = channelsToDraft(
{
emails: ['[email protected]'],
- telegramHandles: ['@alfredo'],
+ telegramHandles: ['@testuser'],
slackUserNames: [],
telegramIds: [],
discordUserNames: [],
@@ -58,7 +58,7 @@ test('profile channel draft serializes only non-empty values', () => {
assert.deepEqual(draftToChannels(draft), {
emails: ['[email protected]'],
- telegramHandles: ['@alfredo'],
+ telegramHandles: ['@testuser'],
slackUserNames: [],
telegramIds: ['123456789'],
discordUserNames: [],
@@ -71,7 +71,7 @@ test('appendDraftValue normalizes Telegram handles and adds verified chat IDs wi
const draft = channelsToDraft(
{
emails: [],
- telegramHandles: ['@alfredo'],
+ telegramHandles: ['@testuser'],
slackUserNames: [],
telegramIds: [],
discordUserNames: [],
@@ -80,7 +80,7 @@ test('appendDraftValue normalizes Telegram handles and adds verified chat IDs wi
() => `row-${++nextId}`
)
- const duplicate = appendDraftValue(draft, 'telegramHandles', ' alfredo ', () => 'duplicate')
+ const duplicate = appendDraftValue(draft, 'telegramHandles', ' testuser ', () => 'duplicate')
assert.equal(duplicate, draft)
const appended = appendDraftValue(draft, 'telegramIds', ' 721954225 ', () => 'verified-chat')
diff --git a/scripts/minikube/build-images.sh b/scripts/minikube/build-images.sh
index 5953410f4..70c6a8901 100644
--- a/scripts/minikube/build-images.sh
+++ b/scripts/minikube/build-images.sh
@@ -77,7 +77,7 @@ MINIKUBE_BASE_IMAGE_PULL_DELAY_SECS="${MINIKUBE_BASE_IMAGE_PULL_DELAY_SECS:-5}"
MINIKUBE_BUILD_DESKTOP_IMAGE="${MINIKUBE_BUILD_DESKTOP_IMAGE:-false}"
MINIKUBE_BUILD_PLAYWRIGHT_MCP_IMAGE="${MINIKUBE_BUILD_PLAYWRIGHT_MCP_IMAGE:-false}"
MINIKUBE_REUSE_PLAYWRIGHT_MCP_IMAGE="${MINIKUBE_REUSE_PLAYWRIGHT_MCP_IMAGE:-true}"
-MINIKUBE_PLAYWRIGHT_MCP_SOURCE_IMAGE="${MINIKUBE_PLAYWRIGHT_MCP_SOURCE_IMAGE:-us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/playwright-server:latest}"
+MINIKUBE_PLAYWRIGHT_MCP_SOURCE_IMAGE="${MINIKUBE_PLAYWRIGHT_MCP_SOURCE_IMAGE:-ghcr.io/evenfire-ai/playwright-server:latest}"
SKIP_UIS="${MINIKUBE_SKIP_UIS:-false}"
case "${SKIP_UIS}" in
diff --git a/scripts/tests/test-gcp-scripts.sh b/scripts/tests/test-gcp-scripts.sh
index 43c3511ff..492611d0b 100644
--- a/scripts/tests/test-gcp-scripts.sh
+++ b/scripts/tests/test-gcp-scripts.sh
@@ -66,7 +66,7 @@ spec:
egress:
- to:
- ipBlock:
- cidr: 203.0.113.10/32
+ cidr: 203.0.113.1/32
ports:
- port: 443
protocol: TCP
@@ -91,10 +91,10 @@ assert_bump_tag() {
cat > "$tmp/kustomization.yaml" <<'YAML'
images:
- name: clerum/mcp-host
- newName: us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/mcp-host-slim
+ newName: ghcr.io/evenfire-ai/mcp-host-slim
newTag: "sha-OLD"
- name: clerum/rpc-proxy
- newName: us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/rpc-proxy
+ newName: ghcr.io/evenfire-ai/rpc-proxy
newTag: "0.9.8"
YAML
bash deploy/scripts/bump-image-tag.sh "$tmp" mcp-host sha-NEW >/dev/null 2>&1
diff --git a/scripts/tests/test-lint-networkpolicies.sh b/scripts/tests/test-lint-networkpolicies.sh
index 2400d8517..b73481924 100644
--- a/scripts/tests/test-lint-networkpolicies.sh
+++ b/scripts/tests/test-lint-networkpolicies.sh
@@ -62,7 +62,7 @@ write_policy "${TMP_DIR}/safe-specific.yaml" ' - ports:
protocol: TCP
to:
- ipBlock:
- cidr: 203.0.113.10/32'
+ cidr: 203.0.113.1/32'
run_lint "${TMP_DIR}/safe-specific.yaml" >/dev/null
echo "PASS: lint-networkpolicies allows explicit port plus specific destination"
diff --git a/scripts/tests/test-verify-networkpolicies.sh b/scripts/tests/test-verify-networkpolicies.sh
index b77e514ca..7fe670fd9 100644
--- a/scripts/tests/test-verify-networkpolicies.sh
+++ b/scripts/tests/test-verify-networkpolicies.sh
@@ -16,7 +16,7 @@ if [[ "${1:-}" == "--context" ]]; then
fi
if [[ "${1:-}" == "kustomize" ]]; then
- cidr="203.0.113.10/32"
+ cidr="203.0.113.1/32"
if [[ "${mode}" == "forbidden" ]]; then
cidr="10.109.0.1/32"
fi
@@ -71,7 +71,7 @@ if [[ "${1:-}" == "get" && "${2:-}" == "networkpolicy" ]]; then
printf '{"items":[]}\n'
exit 0
fi
- cidr="203.0.113.10/32"
+ cidr="203.0.113.1/32"
if [[ "${mode}" == "drift" ]]; then
cidr="35.199.192.1/32"
fi
diff --git a/skills-lock.json b/skills-lock.json
new file mode 100644
index 000000000..403fd4d31
--- /dev/null
+++ b/skills-lock.json
@@ -0,0 +1,11 @@
+{
+ "version": 1,
+ "skills": {
+ "documentation-writer": {
+ "source": "github/awesome-copilot",
+ "sourceType": "github",
+ "skillPath": "skills/documentation-writer/SKILL.md",
+ "computedHash": "ee53d65b163cd7eb953a930c95841cfe398cc2c0bd24c06508bbaa07c432be35"
+ }
+ }
+}
diff --git a/tests/ci/enumerate-promoted-prs.test.sh b/tests/ci/enumerate-promoted-prs.test.sh
deleted file mode 100644
index fe63bafb3..000000000
--- a/tests/ci/enumerate-promoted-prs.test.sh
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-
-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
-SUT="$ROOT/.github/scripts/enumerate-promoted-prs.sh"
-FIXTURES="$SCRIPT_DIR/fixtures"
-
-GREEN='\033[0;32m'
-RED='\033[0;31m'
-NC='\033[0m'
-
-PASS=0
-FAIL=0
-
-# ── Build a `gh` stub ────────────────────────────────────────────────
-# Behavior:
-# gh pr view 999 --json commits --jq ... → cat $GH_COMMITS_FIXTURE
-# gh pr view <N> --json title,author,body → emit canned JSON for known PRs
-# gh pr view 404 ... → exit 1 (simulate missing PR)
-# gh pr view 999 (master PR detail) → emit canned JSON
-
-STUBDIR="$(mktemp -d)"
-trap 'rm -rf "$STUBDIR"' EXIT
-
-cat > "$STUBDIR/gh" <<'STUB'
-#!/usr/bin/env bash
-set -euo pipefail
-# Args: gh pr view <N> --json <fields> [--jq <expr>]
-shift # drop "pr"
-shift # drop "view"
-PR_NUM="$1"
-shift
-# Find --json arg
-FIELDS=""
-for ((i=1; i<=$#; i++)); do
- if [[ "${!i}" == "--json" ]]; then
- j=$((i+1))
- FIELDS="${!j}"
- fi
-done
-
-case "$PR_NUM" in
- 999)
- if [[ "$FIELDS" == *"commits"* ]]; then
- cat "$GH_COMMITS_FIXTURE"
- else
- echo '{"title":"chore(deploy): promote dev → master","author":{"login":"github-actions[bot]"},"body":""}'
- fi
- ;;
- 218) echo '{"title":"fix(rpc-proxy): handle SSE 401","author":{"login":"joseramirezencinas"},"body":"## Summary\nDetects 3× 401s and emits auth-expired."}' ;;
- 220) echo '{"title":"feat(desktop): MCP server list","author":{"login":"otherperson"},"body":"## Summary\nAdds visibility for connected MCP servers."}' ;;
- 222) echo '{"title":"chore(ci): bump deploy timeout","author":{"login":"thirduser"},"body":"No summary section here."}' ;;
- 225) echo '{"title":"refactor(conversation): split manager","author":{"login":"fourthuser"},"body":"## Summary\nExtracts ConversationManager evictor into its own module."}' ;;
- 404) exit 1 ;;
- *) echo "{}" ;;
-esac
-STUB
-chmod +x "$STUBDIR/gh"
-
-PATH="$STUBDIR:$PATH"
-export PATH GH_COMMITS_FIXTURE="$FIXTURES/master-pr-commits-4-bundled.json"
-
-assert_contains() {
- local name=$1 needle=$2 haystack=$3
- if [[ "$haystack" == *"$needle"* ]]; then
- echo -e "${GREEN}✓${NC} $name"
- PASS=$((PASS + 1))
- else
- echo -e "${RED}✗${NC} $name"
- echo " needle: $(printf '%q' "$needle")"
- echo " in: $(printf '%q' "$haystack")"
- FAIL=$((FAIL + 1))
- fi
-}
-
-assert_line_count() {
- local name=$1 expected=$2 text=$3
- local actual
- actual="$(printf '%s' "$text" | grep -c . || true)"
- if [[ "$expected" == "$actual" ]]; then
- echo -e "${GREEN}✓${NC} $name (expected $expected, got $actual lines)"
- PASS=$((PASS + 1))
- else
- echo -e "${RED}✗${NC} $name (expected $expected, got $actual)"
- FAIL=$((FAIL + 1))
- fi
-}
-
-# ── Test: enumerates 4 bundled PRs ───────────────────────────────────
-out=$("$SUT" 999)
-assert_line_count "emits 4 records for 4 bundled PRs" 4 "$out"
-assert_contains "includes #218 title" "fix(rpc-proxy): handle SSE 401" "$out"
-assert_contains "includes #218 author" "joseramirezencinas" "$out"
-assert_contains "includes #218 summary" "Detects 3× 401s" "$out"
-assert_contains "includes #220 title" "feat(desktop): MCP server list" "$out"
-assert_contains "includes #225 title" "refactor(conversation)" "$out"
-
-# ── Test: PR without summary section omits summary field ─────────────
-# #222 has no `## Summary` — the record should still be emitted with empty summary
-assert_contains "includes #222 with empty summary" "chore(ci): bump deploy timeout" "$out"
-
-# ── Test: empty commit list → empty stdout ───────────────────────────
-GH_COMMITS_FIXTURE="$FIXTURES/master-pr-commits-empty.json" "$SUT" 999 > /tmp/enum-empty.out 2>/dev/null || true
-out=$(cat /tmp/enum-empty.out)
-assert_line_count "emits 0 records when no Merge pull request commits" 0 "$out"
-
-# ── Test: 404 on a bundled PR doesn't kill the script ────────────────
-# Create a fixture where one bundled PR is #404 (simulated missing)
-cat > /tmp/commits-with-404.json <<'JSON'
-{
- "commits": [
- { "messageHeadline": "Merge pull request #218 from your-org/feat/x" },
- { "messageHeadline": "Merge pull request #404 from your-org/deleted" },
- { "messageHeadline": "Merge pull request #220 from your-org/feat/y" }
- ]
-}
-JSON
-GH_COMMITS_FIXTURE="/tmp/commits-with-404.json" out=$("$SUT" 999 2>/tmp/enum-404.err)
-assert_line_count "skips 404'd PRs (2 records, not 3)" 2 "$out"
-assert_contains "logs warning to stderr for 404" "404" "$(cat /tmp/enum-404.err)"
-
-echo
-echo "── Results: $PASS passed, $FAIL failed"
-[[ $FAIL -eq 0 ]] || exit 1
diff --git a/workflow-recipes/README.md b/workflow-recipes/README.md
index 0b6a6f228..28e0dc06f 100644
--- a/workflow-recipes/README.md
+++ b/workflow-recipes/README.md
@@ -112,7 +112,6 @@ Test files are co-located with source in `src/` (e.g., `reconciler/resourceBuild
## Further Reading
- [WorkflowRecipe CRD reference](../docs/crds/workflowrecipe.md)
-- [Workflow Recipes feature hub](../docs/features/workflow-recipes.md)
## Source Layout
diff --git a/workflow-recipes/samples/mcp-batch-processor.yaml b/workflow-recipes/samples/mcp-batch-processor.yaml
index 38c1c97e3..00f6381bb 100644
--- a/workflow-recipes/samples/mcp-batch-processor.yaml
+++ b/workflow-recipes/samples/mcp-batch-processor.yaml
@@ -8,7 +8,7 @@ spec:
workloads:
- id: batch-processor
type: job
- image: us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/batch-processor:latest
+ image: ghcr.io/evenfire-ai/batch-processor:latest
backoffLimit: 2
command: ['node', 'process.js']
env:
diff --git a/workflow-recipes/samples/mcp-file-browser.yaml b/workflow-recipes/samples/mcp-file-browser.yaml
index ceace3e28..1be5d8b70 100644
--- a/workflow-recipes/samples/mcp-file-browser.yaml
+++ b/workflow-recipes/samples/mcp-file-browser.yaml
@@ -9,7 +9,7 @@ spec:
workloads:
- id: file-browser
type: deployment
- image: us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/file-browser-mcp:latest
+ image: ghcr.io/evenfire-ai/file-browser-mcp:latest
port: 3000
transport:
type: streamableHttp
diff --git a/workflow-recipes/samples/mcp-health-monitor.yaml b/workflow-recipes/samples/mcp-health-monitor.yaml
index d5f3e6ced..4af43decf 100644
--- a/workflow-recipes/samples/mcp-health-monitor.yaml
+++ b/workflow-recipes/samples/mcp-health-monitor.yaml
@@ -8,7 +8,7 @@ spec:
workloads:
- id: health-monitor
type: daemonset
- image: us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/health-monitor:latest
+ image: ghcr.io/evenfire-ai/health-monitor:latest
port: 9090
resources:
requests:
diff --git a/workflow-recipes/samples/prod/stdio-mcp-with-postgres.yaml b/workflow-recipes/samples/prod/stdio-mcp-with-postgres.yaml
index 49d86cd86..610b8dd1b 100644
--- a/workflow-recipes/samples/prod/stdio-mcp-with-postgres.yaml
+++ b/workflow-recipes/samples/prod/stdio-mcp-with-postgres.yaml
@@ -38,7 +38,7 @@ spec:
- id: pg-stdio-mcp
type: deployment
- image: us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/mock-stdio-mcp-server:prod
+ image: ghcr.io/evenfire-ai/mock-stdio-mcp-server:prod
imagePullPolicy: Always
imagePullSecrets:
- clerum
diff --git a/workflow-recipes/src/cli/backfillRecipeSecretOwnership.ts b/workflow-recipes/src/cli/backfillRecipeSecretOwnership.ts
index ae357f22c..b810ae01c 100644
--- a/workflow-recipes/src/cli/backfillRecipeSecretOwnership.ts
+++ b/workflow-recipes/src/cli/backfillRecipeSecretOwnership.ts
@@ -1,10 +1,10 @@
#!/usr/bin/env node
// Issue #637 back-fill CLI — stamps `clerum.io/owner-recipe=<recipe>` on
// pre-existing recipe Secrets that predate the ownership-label model and would be
-// fail-closed-denied by the WRC reconciler (prod incident 2026-06-26: leadforge +
-// agentic-task-board plugins broke because leadforge-mcp-credentials / atb-secrets
-// were unlabeled). The decision logic lives in the unit-tested
-// `planSecretOwnershipBackfill`; this file only does cluster I/O via kubectl.
+// fail-closed-denied by the WRC reconciler (e.g. a recipe's envSecret created
+// before ownership labelling existed). The decision logic lives in the
+// unit-tested `planSecretOwnershipBackfill`; this file only does cluster I/O
+// via kubectl.
//
// DRY-RUN by default — prints the plan and exits without mutating. Pass `--apply`
// to label. Against a prod context `--apply` additionally requires CONFIRM=yes.
diff --git a/workflow-recipes/src/reconciler/k8sErrors.test.ts b/workflow-recipes/src/reconciler/k8sErrors.test.ts
index b58302402..1813f17cf 100644
--- a/workflow-recipes/src/reconciler/k8sErrors.test.ts
+++ b/workflow-recipes/src/reconciler/k8sErrors.test.ts
@@ -33,7 +33,7 @@ describe('isRetryableInfraError', () => {
// FetchError carries the socket code on `.code` as a string.
const err = Object.assign(
new Error(
- 'request to https://203.0.113.10/apis/networking.k8s.io/v1/namespaces/sandbox-recipes/networkpolicies failed, reason: connect ETIMEDOUT 203.0.113.10:443'
+ 'request to https://203.0.113.1/apis/networking.k8s.io/v1/namespaces/sandbox-recipes/networkpolicies failed, reason: connect ETIMEDOUT 203.0.113.1:443'
),
{ code: 'ETIMEDOUT', name: 'FetchError' }
)
@@ -65,14 +65,14 @@ describe('isRetryableInfraError', () => {
it('matches a wrapped error message that lost its .code', () => {
// WRC re-wraps pre-deploy failures: `new Error("Pre-deploy ... : connect ETIMEDOUT ...")`.
const wrapped = new Error(
- 'Pre-deploy Context allowlist failed for "recipe-helpdesk": request to https://203.0.113.10/... failed, reason: connect ETIMEDOUT 203.0.113.10:443'
+ 'Pre-deploy Context allowlist failed for "recipe-helpdesk": request to https://203.0.113.1/... failed, reason: connect ETIMEDOUT 203.0.113.1:443'
)
expect(isRetryableInfraError(wrapped)).toBe(true)
})
it('matches a persisted status.message string (already-latched recipe)', () => {
const persisted =
- 'FetchError: request to https://203.0.113.10/apis/apps/v1/namespaces/sandbox-recipes/deployments/x failed, reason: connect ETIMEDOUT 203.0.113.10:443'
+ 'FetchError: request to https://203.0.113.1/apis/apps/v1/namespaces/sandbox-recipes/deployments/x failed, reason: connect ETIMEDOUT 203.0.113.1:443'
expect(isRetryableInfraError(persisted)).toBe(true)
})
@@ -111,7 +111,7 @@ describe('isRetryableInfraError', () => {
})
it('DOES match the anchored transport shapes (syscall-prefixed / reason:)', () => {
- expect(isRetryableInfraError('connect ETIMEDOUT 203.0.113.10:443')).toBe(true)
+ expect(isRetryableInfraError('connect ETIMEDOUT 203.0.113.1:443')).toBe(true)
expect(isRetryableInfraError('read ECONNRESET')).toBe(true)
expect(isRetryableInfraError('getaddrinfo EAI_AGAIN registry.example.com')).toBe(true)
expect(
diff --git a/workflow-recipes/src/reconciler/k8sErrors.ts b/workflow-recipes/src/reconciler/k8sErrors.ts
index ed419c37e..9ce03c504 100644
--- a/workflow-recipes/src/reconciler/k8sErrors.ts
+++ b/workflow-recipes/src/reconciler/k8sErrors.ts
@@ -93,7 +93,7 @@ const TRANSPORT_PREFIXED_PHRASE_RE = new RegExp(
/**
* Node renders socket errors as `<syscall> <CODE> <addr>` (e.g.
- * `connect ETIMEDOUT 203.0.113.10:443`, `read ECONNRESET`,
+ * `connect ETIMEDOUT 203.0.113.1:443`, `read ECONNRESET`,
* `getaddrinfo EAI_AGAIN host`) and node-fetch wraps them as
* `request to <url> failed, reason: connect ETIMEDOUT …`.
*
diff --git a/workflow-recipes/src/reconciler/reconciler.test.ts b/workflow-recipes/src/reconciler/reconciler.test.ts
index 63d124460..16e82985b 100644
--- a/workflow-recipes/src/reconciler/reconciler.test.ts
+++ b/workflow-recipes/src/reconciler/reconciler.test.ts
@@ -7828,7 +7828,7 @@ describe('WorkflowRecipeReconciler', () => {
function etimedout(): Error {
return Object.assign(
new Error(
- 'request to https://203.0.113.10/api/v1/namespaces/sandbox-recipes/services/app failed, reason: connect ETIMEDOUT 203.0.113.10:443'
+ 'request to https://203.0.113.1/api/v1/namespaces/sandbox-recipes/services/app failed, reason: connect ETIMEDOUT 203.0.113.1:443'
),
{ code: 'ETIMEDOUT', name: 'FetchError' }
)
@@ -7888,7 +7888,7 @@ describe('WorkflowRecipeReconciler', () => {
status: {
phase: 'failed',
message:
- 'FetchError: request to https://203.0.113.10/apis/networking.k8s.io/v1/namespaces/sandbox-recipes/networkpolicies failed, reason: connect ETIMEDOUT 203.0.113.10:443',
+ 'FetchError: request to https://203.0.113.1/apis/networking.k8s.io/v1/namespaces/sandbox-recipes/networkpolicies failed, reason: connect ETIMEDOUT 203.0.113.1:443',
workloads: [{ id: 'app', type: 'deployment', phase: 'deployed', ready: true }],
},
})
@@ -8080,11 +8080,11 @@ describe('WorkflowRecipeReconciler', () => {
it('self-heals recipes latched by the real dev API-timeout messages', async () => {
const devMessages = [
// helpdesk — pre-deploy Context allowlist fetch
- 'Error: Pre-deploy failed for WorkflowRecipe "recipe-helpdesk-v1-0-0-4549198b". WRC cannot start transport workloads until HCC can reconcile child McpServers: Error: Pre-deploy Context allowlist failed for "recipe-helpdesk-v1-0-0-4549198b": request to https://203.0.113.10/apis/clerum.io/v1alpha1/namespaces/mcp-server/contexts/context1 failed, reason: connect ETIMEDOUT 203.0.113.10:443',
+ 'Error: Pre-deploy failed for WorkflowRecipe "recipe-helpdesk-v1-0-0-4549198b". WRC cannot start transport workloads until HCC can reconcile child McpServers: Error: Pre-deploy Context allowlist failed for "recipe-helpdesk-v1-0-0-4549198b": request to https://203.0.113.1/apis/clerum.io/v1alpha1/namespaces/mcp-server/contexts/context1 failed, reason: connect ETIMEDOUT 203.0.113.1:443',
// leadforge — NetworkPolicy fetch
- 'FetchError: request to https://203.0.113.10/apis/networking.k8s.io/v1/namespaces/sandbox-recipes/networkpolicies/wl-egress-recipe-leadforge-app-v1-0-0-bdb457b6-prospector-api failed, reason: connect ETIMEDOUT 203.0.113.10:443',
+ 'FetchError: request to https://203.0.113.1/apis/networking.k8s.io/v1/namespaces/sandbox-recipes/networkpolicies/wl-egress-recipe-leadforge-app-v1-0-0-bdb457b6-prospector-api failed, reason: connect ETIMEDOUT 203.0.113.1:443',
// recap — NetworkPolicy list
- 'FetchError: request to https://203.0.113.10/apis/networking.k8s.io/v1/namespaces/sandbox-recipes/networkpolicies failed, reason: connect ETIMEDOUT 203.0.113.10:443',
+ 'FetchError: request to https://203.0.113.1/apis/networking.k8s.io/v1/namespaces/sandbox-recipes/networkpolicies failed, reason: connect ETIMEDOUT 203.0.113.1:443',
]
for (const message of devMessages) {
const recipe = makeRecipe({
diff --git a/workflow-recipes/src/reconciler/secretOwnershipBackfill.ts b/workflow-recipes/src/reconciler/secretOwnershipBackfill.ts
index 2385e894a..013fe4479 100644
--- a/workflow-recipes/src/reconciler/secretOwnershipBackfill.ts
+++ b/workflow-recipes/src/reconciler/secretOwnershipBackfill.ts
@@ -2,10 +2,10 @@
// pre-existing recipe Secrets that were created before the ownership-label model
// and are therefore UNLABELED. The #637 fail-closed gate denies unlabeled
// envSecret / imagePullSecrets / snippet capability Secrets at reconcile time,
-// which silently breaks plugins whose credential Secrets predate the model (prod
-// incident 2026-06-26: leadforge-mcp-credentials, atb-secrets). New Secrets
-// created via control-api's /admin/recipe-secrets are already labeled; only
-// legacy / `kubectl apply`-created Secrets need this.
+// which silently breaks any recipe whose credential Secrets predate the model
+// (e.g. leadforge-mcp-credentials). New Secrets created via control-api's
+// /admin/recipe-secrets are already labeled; only legacy / `kubectl
+// apply`-created Secrets need this.
//
// CORRECTNESS: this planner mirrors the reconciler's two authoritative rules so it
// cannot drift from enforcement:
diff --git a/workflow-recipes/tests/e2e/airtable-lifecycle.test.ts b/workflow-recipes/tests/e2e/airtable-lifecycle.test.ts
index ad38aff89..3681671eb 100644
--- a/workflow-recipes/tests/e2e/airtable-lifecycle.test.ts
+++ b/workflow-recipes/tests/e2e/airtable-lifecycle.test.ts
@@ -281,7 +281,7 @@ describe('Airtable MCP Server - E2E Lifecycle', () => {
// E10.3: Pod Ready + Health check passing
// Note: In minikube without DOCR registry credentials, the image
- // us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/airtable-mcp-server:latest may fail to pull
+ // ghcr.io/evenfire-ai/airtable-mcp-server:latest may fail to pull
// (ImagePullBackOff). We attempt to wait but skip gracefully if image pull fails.
it(
'E10.3 — Pod Ready and MCP server healthy (skips if image unavailable)',
diff --git a/workflow-recipes/tests/e2e/mongodb-lifecycle.test.ts b/workflow-recipes/tests/e2e/mongodb-lifecycle.test.ts
index cb0caa0e1..aa0d12377 100644
--- a/workflow-recipes/tests/e2e/mongodb-lifecycle.test.ts
+++ b/workflow-recipes/tests/e2e/mongodb-lifecycle.test.ts
@@ -43,7 +43,7 @@ const LOCAL_PORT = 18086
const MCP_REMOTE_PORT = 3000
const HEALTH_REMOTE_PORT = 3001
-// Expected MongoDB MCP tool names (from us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/mongodb-mcp-server:latest)
+// Expected MongoDB MCP tool names (from ghcr.io/evenfire-ai/mongodb-mcp-server:latest)
// Verified 2026-03-06: Server returns 15 READ-ONLY tools (no insert/update/delete)
// Actual tools: aggregate, collection-indexes, collection-schema, collection-storage-size,
// connect, count, db-stats, explain, export, find, list-collections,
diff --git a/workflow-recipes/tests/e2e/mongodb-statefulset-recipe.test.ts b/workflow-recipes/tests/e2e/mongodb-statefulset-recipe.test.ts
index 3ba2c78b7..4a0ca09ee 100644
--- a/workflow-recipes/tests/e2e/mongodb-statefulset-recipe.test.ts
+++ b/workflow-recipes/tests/e2e/mongodb-statefulset-recipe.test.ts
@@ -41,7 +41,7 @@ const LOCAL_PORT = 18086
const MCP_REMOTE_PORT = 3000
const HEALTH_REMOTE_PORT = 3001
-// Expected MongoDB MCP tool names (from us-central1-docker.pkg.dev/${GCP_PROJECT}/clerum/mongodb-mcp-server:latest)
+// Expected MongoDB MCP tool names (from ghcr.io/evenfire-ai/mongodb-mcp-server:latest)
// Verified 2026-03-06: Server returns 15 READ-ONLY tools (no insert/update/delete)
// Actual tools: aggregate, collection-indexes, collection-schema, collection-storage-size,
// connect, count, db-stats, explain, export, find, list-collections,