urumi-mcp-gateway

minianon/urumi-mcp-gateway Checked 2 days ago

WooCommerce hosting with a team MCP gateway on Kubernetes (Helm, k3d/k3s): self-written WooCommerce MCP server, aggregated MCP endpoint, React dashboard, chat…

An admin connects MCP servers once. Every team member then uses all of them through one MCP endpoint (Claude Code, Cursor, MCP Inspector) and through a chat agent in the dashboard, without ever seeing an upstream credential. The first data source is a WooCommerce store running in the same cluster, exposed by an MCP server I wrote. This script: 1. creates a k3d cluster urumi with ports 80/443 mapped to the bundled Traefik ingress, 2. generates random credentials into deploy/secrets/local/*.yaml (git-ignored), 3. builds the four images and imports them into k3d, 4.

Summary extracted from the README.

Urumi: WooCommerce hosting with a team MCP gateway on Kubernetes

An admin connects MCP servers once. Every team member then uses all of them through one MCP endpoint (Claude Code, Cursor, MCP Inspector) and through a chat agent in the dashboard, without ever seeing an upstream credential. The first data source is a WooCommerce store running in the same cluster, exposed by an MCP server I wrote.

Demo video: https://youtu.be/v0f-Wj4IMMk (about 17 min, with chapters)

store-main ns              mcp-tools ns           urumi ns                                   outside
┌──────────────────────┐   ┌──────────────┐   ┌───────────────────────────────────────┐
│ WordPress+WooCommerce│◀──│              │   │ Gateway x2 ── /mcp ◀── Claude Code ───┼── API key
│ MariaDB   setup Job  │   │ supplier-mcp │◀──│   MCP client to every upstream        │
│ woo-mcp (ClusterIP)  │◀──┼──────────────┼───│   MCP server for every user           │
└──────────────────────┘   └──────────────┘   │   chat agent ── Groq (OpenAI API)     │
        ▲ storefront                          │ Dashboard (React)   Postgres          │──▶ mcp.deepwiki.com
        └──────────── Traefik Ingress ────────┴───────────────────────────────────────┘
Demo video youtu.be/v0f-Wj4IMMk: the definition-of-done flow with two users, then Kubernetes, MCP internals, security and local-to-prod
Design & tradeoffs docs/DESIGN.md: architecture, tool aggregation, routing, failure handling, local vs prod
Threat model docs/THREAT_MODEL.md: shared credentials, no token passthrough, malicious upstreams, member vs member
Demo script docs/DEMO.md: the definition-of-done flow, step by step
API docs/API.md: dashboard REST API

Repository layout

services/
  woo-mcp/        WooCommerce MCP server (TypeScript, MCP SDK, Streamable HTTP, OAuth1-signed REST)
  supplier-mcp/   second upstream: wholesale catalog + FX (also has `list_products`, to show collisions)
  gateway/        dashboard API + aggregated MCP endpoint + upstream MCP client + chat agent
  dashboard/      React + Vite + Tailwind SPA served by nginx-unprivileged
charts/
  store/          WordPress, MariaDB, setup Job, woo-mcp, Ingress, NetworkPolicies   (one store per release)
  mcp-server/     generic chart to host any MCP server image privately
  platform/       gateway, dashboard, Postgres, Ingress, NetworkPolicies, PDB
  */values-local.yaml, */values-prod.yaml
scripts/          gen-secrets.sh, local-up.sh (k3d), deploy.sh (any cluster, e.g. VPS)
tests/e2e.mjs     automated definition-of-done checks with the official MCP SDK client

Local setup (k3d)

Prerequisites: Docker Desktop (give it about 6 GB of RAM), k3d, kubectl, helm (v3.14+ or v4), openssl, and bash (Git Bash works on Windows).

# optional: chat agent key (free at console.groq.com); you can also add it later
export LLM_API_KEY=gsk_...

scripts/local-up.sh

This script:

  1. creates a k3d cluster urumi with ports 80/443 mapped to the bundled Traefik ingress,
  2. generates random credentials into deploy/secrets/local/*.yaml (git-ignored),
  3. builds the four images and imports them into k3d,
  4. creates namespaces store-main, mcp-tools and urumi with the restricted Pod Security Standard,
  5. installs the three Helm releases and waits until everything is ready. The first run takes about 5 minutes, mostly the WooCommerce download.

It prints the URLs and the admin password at the end:

URL
Storefront http://store.127.0.0.1.nip.io
WooCommerce admin http://store.127.0.0.1.nip.io/wp-admin (user admin, password = wpAdminPassword in deploy/secrets/local/store.yaml)
Dashboard http://app.127.0.0.1.nip.io (admin@urumi.local, password = adminPassword in deploy/secrets/local/platform.yaml)
MCP endpoint http://app.127.0.0.1.nip.io/mcp

To add the LLM key later, edit llmApiKey in deploy/secrets/local/platform.yaml, then run SKIP_BUILD=1 ONLY=platform scripts/local-up.sh. The gateway pods roll automatically.

Iterating on one component: ONLY=platform scripts/local-up.sh (also store or supplier).

Local domain approach

I use nip.io wildcard DNS: anything.127.0.0.1.nip.io resolves to 127.0.0.1 through public DNS, so the storefront and dashboard get stable hostnames with no /etc/hosts edits. That works for every browser, curl, Node and MCP client. k3d maps host port 80 to Traefik, which routes by Host header.

Offline alternative: add 127.0.0.1 store.urumi.test app.urumi.test to your hosts file and set store.publicUrl, ingress.host and publicUrl in the values files to those names.

WordPress gets its URL from WP_HOME/WP_SITEURL, which come from Helm values, so moving domains never needs a database search-and-replace.


Using it

Place an order (storefront)

  1. Open http://store.127.0.0.1.nip.io, choose a product, Add to cart, then go to Checkout.
  2. Fill in any address and choose Cash on delivery. Shipping is free everywhere, so checkout always works. Click Place order.
  3. The order appears in WooCommerce → Orders in wp-admin.

Team setup (dashboard)

  1. Log in as the admin. Servers shows WooCommerce (registered by Helm, listed first) and Supplier as Connected, with their tools.
  2. Team → Invite member gives you an invite link (no email is sent). Open it in a private window and set a password.
  3. Each user opens API keys → Create key. The key is shown once.

Connect an external MCP client

Only the gateway URL and your key. You never configure the upstream servers yourself.

Claude Code

claude mcp add --transport http urumi http://app.127.0.0.1.nip.io/mcp --header "Authorization: Bearer ugw_YOUR_KEY"

Cursor (~/.cursor/mcp.json)

{ "mcpServers": { "urumi": { "url": "http://app.127.0.0.1.nip.io/mcp", "headers": { "Authorization": "Bearer ugw_YOUR_KEY" } } } }

MCP Inspector: npx @modelcontextprotocol/inspector, transport Streamable HTTP, URL http://app.127.0.0.1.nip.io/mcp, header Authorization: Bearer ugw_YOUR_KEY.

Tools appear as woocommerce__list_orders, supplier__get_quote and so on. Try:

  • "What orders came in today?"
  • "Which supplier products don't we sell yet? Quote 100 units of the cheapest one in INR." This needs both servers.

Append ?mode=search to the URL to get two meta-tools (gateway__search_tools, gateway__call_tool) instead of the full list. That's for clients that would otherwise receive hundreds of tools.

Chat agent

Dashboard → Chat. It calls tools through the same gateway endpoint as the logged-in user, shows each tool call and result as it happens, and every call lands in the audit log under that user with client = chat.

Automated end-to-end check

cd tests && npm ci
BASE_URL=http://app.127.0.0.1.nip.io ADMIN_PASSWORD=<adminPassword> node e2e.mjs

It creates a member, issues keys, and checks:

  • aggregation and prefixes,
  • role-based hiding,
  • routing,
  • denied direct calls,
  • disabling a server,
  • revoking a key,
  • the audit log.

It cleans up after itself.


Production-like VPS (k3s)

The same charts; only values-prod.yaml and the secrets differ (see the table in DESIGN.md §6).

  1. VPS: a 2 vCPU / 4 GB Ubuntu VM is enough. Point two DNS A records (store.example.com, app.example.com) at it and open ports 80/443.
  2. k3s (bundles Traefik, the local-path storage class, and a NetworkPolicy controller):
    curl -sfL https://get.k3s.io | sh -
    mkdir -p ~/.kube && sudo cat /etc/rancher/k3s/k3s.yaml > ~/.kube/config
    
  3. TLS with cert-manager and Let's Encrypt:
    helm repo add jetstack https://charts.jetstack.io
    helm install cert-manager jetstack/cert-manager -n cert-manager --create-namespace --set crds.enabled=true
    kubectl apply -f - <<'EOF'
    apiVersion: cert-manager.io/v1
    kind: ClusterIssuer
    metadata: { name: letsencrypt-prod }
    spec:
      acme:
        server: https://acme-v02.api.letsencrypt.org/directory
        email: you@example.com
        privateKeySecretRef: { name: letsencrypt-prod }
        solvers: [{ http01: { ingress: { ingressClassName: traefik } } }]
    EOF
    
  4. Images: pushing a tag such as v1.0.0 makes CI (.github/workflows/ci.yml) build multi-arch images to ghcr.io/<owner>/urumi-*:v1.0.0. The v1.0.0 images are published and public. Without a registry, use docker save urumi/gateway:TAG | ssh vps sudo k3s ctr images import - per image.
  5. Site values: copy deploy/sites/wsl-k3s/{store,platform}.yaml to deploy/sites/<site>/, and set your domain (no port) and cert-manager.io/cluster-issuer: letsencrypt-prod. These files hold only the domain and the issuer; everything else comes from values-prod.yaml.
  6. Secrets and deploy:
    LLM_API_KEY=gsk_... scripts/gen-secrets.sh prod   # writes deploy/secrets/prod/*.yaml (keep these off git)
    SITE=<site> REGISTRY=ghcr.io/<owner> TAG=v1.0.0 scripts/deploy.sh prod
    
    To manage secrets out of band instead (sealed-secrets, external-secrets, SOPS), create the Secrets yourself and set secrets.existingSecret in each chart.

What changes between local and prod: domain and publicUrl; TLS plus cert-manager annotations on the Ingress; storage class and sizes; image registry and tags; cookieSecure: true; resource sizes; replica counts.

Production rehearsal: real k3s in WSL (what the demo shows)

I don't have a VPS, so I run the production path on a real k3s install inside WSL Ubuntu, not k3d. It uses values-prod.yaml, the published ghcr.io/minianon/urumi-*:v1.0.0 images, cert-manager TLS and the prod secrets, deployed with scripts/deploy.sh prod. Compared with a VPS, only two files differ:

  • deploy/sites/wsl-k3s/issuer.yaml: a private CA issuer, because Let's Encrypt cannot reach a laptop.
  • deploy/sites/wsl-k3s/traefik-config.yaml: Traefik moves to 8080/8443, because Docker Desktop (the k3d cluster) already holds 80/443. It also runs on the host network, because WSL only forwards ports that a process really listens on, and ServiceLB uses iptables rules instead.

The dev cluster and the prod rehearsal run side by side:

Local (k3d) Prod rehearsal (k3s in WSL)
Dashboard / MCP http://app.127.0.0.1.nip.io https://app.prod.127.0.0.1.nip.io:8443
Storefront http://store.127.0.0.1.nip.io https://store.prod.127.0.0.1.nip.io:8443
kubectl default context k3d-urumi KUBECONFIG=~/.kube/wsl-k3s.yaml

Setup, from Git Bash on Windows:

export MSYS_NO_PATHCONV=1   # stop Git Bash rewriting /var/... into C:/Program Files/Git/var/...
wsl -d Ubuntu -u root -- mkdir -p /var/lib/rancher/k3s/server/manifests
wsl -d Ubuntu -u root -- cp "/mnt/d/Personal/urumi/deploy/sites/wsl-k3s/traefik-config.yaml" /var/lib/rancher/k3s/server/manifests/
wsl -d Ubuntu -u root -- sh -c "curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC='server --write-kubeconfig-mode 644' sh -"
wsl -d Ubuntu -u root -- cat /etc/rancher/k3s/k3s.yaml | sed 's/: default$/: wsl-k3s/' > ~/.kube/wsl-k3s.yaml
export KUBECONFIG=~/.kube/wsl-k3s.yaml
helm repo add jetstack https://charts.jetstack.io
helm install cert-manager jetstack/cert-manager -n cert-manager --create-namespace --set crds.enabled=true --wait
kubectl apply -f deploy/sites/wsl-k3s/issuer.yaml
scripts/gen-secrets.sh prod
SITE=wsl-k3s REGISTRY=ghcr.io/minianon TAG=v1.0.0 scripts/deploy.sh prod

WSL stops a distro when no terminal is attached, and k3s stops with it. While you use the cluster, keep an Ubuntu terminal open, or start a hidden keep-alive from PowerShell: Start-Process -WindowStyle Hidden wsl.exe '-d','Ubuntu','--','sleep','infinity'.

Browsers will warn about the certificate until you trust the CA. To trust it, export it with kubectl -n cert-manager get secret urumi-local-ca -o jsonpath='{.data.ca\.crt}' | base64 -d > urumi-local-ca.crt and import it into Trusted Root Certification Authorities. Node-based MCP clients read the same file from NODE_EXTRA_CA_CERTS. On Windows, curl needs --ssl-no-revoke, because a private CA publishes no revocation list. Verified on this setup:

  • the e2e suite passes against https://app.prod.127.0.0.1.nip.io:8443;
  • the chat agent answers through the gateway;
  • a pod in another namespace cannot reach woo-mcp, WordPress or MariaDB.

Upgrades and rollback

helm history platform -n urumi
REGISTRY=... TAG=v1.1.0 scripts/deploy.sh prod      # upgrade = new image tag
helm rollback platform <REVISION> -n urumi          # rollback = previous revision
  • Gateway / dashboard: RollingUpdate with maxUnavailable: 0, a PodDisruptionBudget, a preStop pause and in-app draining. Tested on k3d: 0 failed calls out of 525 during a rollout restart plus a helm rollback under continuous traffic. MCP sessions survive the roll because session IDs are signed tokens any replica accepts. DB migrations are forward-only and additive (expand/contract), so the previous image runs against the newer schema and rollback is safe.
  • MCP servers: stateless, so a rolling update is invisible to the gateway beyond in-flight calls. The gateway reconnects automatically.
  • Store: bump setup.woocommerceVersion (or wordpress.image). The post-upgrade hook Job installs the pinned version and runs wp wc update. helm rollback runs the same Job (post-rollback) to re-pin the previous version. WooCommerce DB migrations aren't reversible, so back up first: kubectl exec -n store-main store-mariadb-0 -- sh -c 'mariadb-dump -uroot -p"$MARIADB_ROOT_PASSWORD" wordpress' > backup.sql. MARIADB_AUTO_UPGRADE=1 handles MariaDB minor upgrades.

What's implemented beyond the core

Stand-out item Where
Tool permissions per role/tool: hidden from tools/list and rejected on direct call. Woo write tools are admin-only by default gateway/src/catalog.ts, server detail page
Security hardening: SSRF guard at validation and connect time (DNS rebinding), deny-by-default NetworkPolicies, Pod Security restricted, non-root, read-only root filesystems, no ServiceAccount tokens, credentials AES-256-GCM encrypted at rest, peppered key hashes gateway/src/ssrf.ts, crypto.ts, charts/*/networkpolicies.yaml
Tool definition pinning (rug-pull defence) with an approval diff and poisoning heuristics gateway/src/upstreams.ts syncTools, catalog.ts flagsFor
Scaling: 2 gateway replicas with no sticky sessions (signed session IDs) and cross-replica tools/list_changed push via Postgres LISTEN/NOTIFY; per-user rate limits gateway/src/mcp.ts, events.ts
Many tools: ?mode=search meta-tools; the agent switches automatically above 40 tools gateway/src/mcp.ts, agent.ts
Observability: Prometheus /metrics on an internal port (calls, errors, latency per server, upstream up/down); dashboard overview from the audit log; precise unreachable reasons gateway/src/metrics.ts, Overview page
Upgrades and rollback: zero-downtime gateway rolls, a pinned WooCommerce version, a rollback hook section above
Production-like deployment: prod values, cert-manager TLS, CI multi-arch images to GHCR (v1.0.0 published), deployed and verified on real k3s with the prod values (in WSL, not a public VPS) values-prod.yaml, deploy/sites/, .github/workflows/ci.yml, "Production rehearsal" above

Not attempted: multi-store provisioning (bonus), OAuth on the gateway, hosted MCP servers by image. The store chart is already one-store-per-namespace with its own MCP server, which is the foundation for provisioning.

Design docs

Doc What's inside
High-Level Design Architecture, components, data flow, tech choices, deployment
Low-Level Design Modules, data models, APIs and functions, key sequences