Architecture
How it's built
The demo is a single MCP server that turns tool calls into Kubernetes objects. Everything else is standard parts that already run in production: a Gateway, cert-manager and KEDA.
Two paths through the system
An agent deploys through the MCP server. A visitor opening the app goes through the Gateway. The two paths only meet at the Kubernetes objects.
mcp.apps.kotono.nl/mcpPython, streamable HTTP, OAuth or personal token
apps namespace onlyhttps://<name>.apps.kotono.nlWhat one deploy does
Calling deploy_static(name="tips", html=…) runs these steps in order. Redeploying with the same name updates the app in place and keeps the URL.
Authenticate and claim the name
The token maps to a user. If
tipsalready belongs to someone else, the call is refused. Everything gets anownerlabel.Store the files
Pages and code go into a ConfigMap (up to 50 files, 900 KB in total; bigger uploads are sent in 100 KB parts).
deploy_from_urluses an init container that downloads the repo or archive instead.Create the workload
A Deployment running nginx-unprivileged (static), python:3.12 or node:22 (code), or the given image. It runs as non-root with all capabilities dropped, a seccomp profile and no service account token.
Wire up HTTPS
A cert-manager Certificate for
tips.apps.kotono.nl, a new listener on the shared Gateway (with optimistic locking so parallel deploys don't overwrite each other) and an HTTPRoute.Enable scale to zero
A KEDA HTTPScaledObject routes the host through the interceptor and scales to 0 after 5 idle minutes.
Warm it and return the URL
The server sends one request through the interceptor so the app is already awake when the agent shares the link.
Guardrails
The agent runs code nobody reviewed, so the platform assumes every app is untrusted.
| Concern | How it's handled |
|---|---|
| Isolation between apps | Pod Security restricted, non-root, no privilege escalation, all capabilities dropped, no service account token. Plan: own kernel per app (KVM) |
| Network | Default deny. Inbound only from the Gateway and KEDA. Outbound only DNS and ports 80/443 to the public internet; all private ranges are blocked, so no internal services and no outgoing mail. |
| Capacity | Namespace quota: 10 pods, 2 CPU / 2 GiB requested, max 1 CPU / 512 MiB per container. No LoadBalancers, NodePorts or volumes. |
| Clean-up | A reaper thread deletes apps 2 hours after deploy. Approved users can set a longer lifetime or keep an app. |
| Ownership | Users only see and change apps carrying their own owner label. Names are first come, first served. |
| MCP server itself | Its Role only reaches the apps namespace plus the single Gateway object. Read-only root filesystem, non-root. |
| Access | Personal tokens kept in a Kubernetes Secret, compared in constant time. OAuth for Claude.ai with redirects limited to Claude and localhost. |
The parts
What runs where on the cluster (four nodes, Kubernetes 1.37).
| Component | Namespace | Role |
|---|---|---|
| MCP server | mcp-system | The tools, OAuth login, token check, reaper. Code is shipped as a ConfigMap; no image build needed. |
Istio Gateway public | ingress-nginx | Terminates TLS for every app. Lives there because the existing HA-IP Service can only select pods in its own namespace. |
| KEDA + HTTP add-on | keda | Scale to zero and wake on request. |
| cert-manager | cluster-wide | Let's Encrypt certificates via HTTP-01 on the Gateway, one per app. |
| Apps | apps | Everything agents deploy, with the quota and network policies above. |
The repo
Everything for the demo is in mcp-demo/, with the Gateway config next to it.
| Path | What |
|---|---|
server/server.py | MCP tools and Kubernetes logic |
server/oauth.py | OAuth provider and login page, state kept in a Secret |
k8s/mcp-server.yaml | Server Deployment, RBAC, Let's Encrypt Issuer |
k8s/apps-namespace.yaml | The apps namespace: quota, limits, network policies |
deploy.sh | Applies the manifests, ships the code, restarts the server |
add-user.sh · remove-user.sh | Issue or revoke a personal token and write ready-to-paste configs |
keep-users.sh | Who may choose app lifetimes |
install-keda.sh | Installs KEDA and the HTTP add-on |
../gateway/ | Istio Gateway, routes, certificates and reference grants |
From demo to microVMs
What carries over, and what still has to be built.
The agent interface
The MCP tools, names, URLs, lifetimes and ownership model stay the same.
The front door
One shared address, per-app certificates and wake on request. No public IP per app.
The runner
QEMU/KVM microVMs (no UEFI, minimal devices) on a dedicated server pool, kept apart from VPS.
Placement and networking
Deciding where each microVM runs, its addresses, and routing from the Gateway to it.