Architecture
MZPanel has two core pieces: the control plane (cloud) and the agent (on the
customer VPS). The control plane is one Go binary (mzpanel-api) that serves the
REST API, the MCP endpoint for AI agents, the agent WebSocket gateway, the background
scheduler and MZPanel’s own DNS server, backed by Postgres. The agent carries a native execution engine — site, backup,
database, Docker and other operations run inside the agent itself, as a single Go
binary. Nothing about MZPanel needs to be installed on your VPS except that agent.
Three ways in, one engine
Section titled “Three ways in, one engine”The same native engine backs every way of working a box, so they never drift:
-
Panel mode (web). You click an action in the dashboard (
app.mzpanel.com). The control plane sends the command down the agent’s WebSocket, the agent runs it natively, and the result streams back to the page. -
CLI mode (on-box). You SSH into the VPS and run
mzdirectly —mz site create example.com,mz cron list --json, etc. On the box,mz(/usr/local/bin/mz) is just a friendly front-end to the very same compiled agent, so a CLI action and the equivalent panel click execute identical code. -
API mode (AI agents and scripts). Your AI client connects to the MCP endpoint (
https://mcp.mzpanel.com) or calls the REST API (https://api.mzpanel.com/v1/api/) with anmzmcp_token. Every dashboard route is an operation (and an MCP tool), and every on-box action is a typed job kind run throughPOST /v1/servers/{id}/jobs. Tokens carry a level (read, operate, full), opt-in scopes for destructive actions and an optional server allowlist. On every plan. See For AI agents.
The modes are parallel and non-exclusive: a person in the dashboard, an AI agent over MCP and a power user in the shell all see the same state. See The mz CLI.
Connection model — agent dial-out
Section titled “Connection model — agent dial-out”The agent dials outbound to wss://ws.mzpanel.com:443. The customer VPS opens
no inbound ports, needs no domain, and is unaffected by NAT. Each VPS holds one
persistent WebSocket carrying:
- A heartbeat every 10s
- Status/metrics push (CPU, RAM, disk, site count)
- Commands from the web → exec natively → stdout/stderr streamed back
- Events pushed up (backup done, SSL renewed, …)
[web] app.mzpanel.com ─┐[AI agent] mcp.mzpanel.com ─┼─► api.mzpanel.com ──ws──► agent (native engine) ──► VPS[script] /v1/api (REST) ──┘ ▲ │ └────────── stream ◄───────┘Because the connection is outbound-only, firewalls and NAT don’t matter — nothing ever connects to your VPS. See The agent for the process itself.
Jobs and offline agents
Section titled “Jobs and offline agents”Every on-box action is a job: the control plane validates the kind and its fields
(GET /v1/api/job-kinds/{type} returns the schema), checks your role and plan, records
it, and sends it down the agent’s WebSocket. Output streams back live and the final
result is stored (GET /v1/jobs/{id}).
If the agent is offline when you dispatch, the job is kept and delivered when the
agent reconnects. A job that is not delivered within 24 hours ends as
expired_offline. A few jobs that print secrets once (for example attaching a database
to an app) are refused with 409 server_offline instead of queued.
Source of truth
Section titled “Source of truth”- On the customer VPS:
/etc/mz/*— the on-VPS registry (for example/etc/mz/sites/<domain>.conf). The agent reads and writes it directly; the control plane does not keep its own copy of VPS state. Agent-local config and keys live under/etc/mzagent/. - On the control plane: Postgres stores users, orgs, servers (metadata + last-seen), licenses, and the audit log. It does not mirror full VPS state — that would drift the moment you touched the box over SSH. For fast reads, the control plane keeps a cache of what the agent last pushed, but the box always wins.
Why the public site is separate from the dashboard
Section titled “Why the public site is separate from the dashboard”This public site (mzpanel.com) is a static Astro build for fast loads, good
SEO, and AI/MCP-readable content. The dashboard (app.mzpanel.com) is a separate
SPA, and the control-plane API (api.mzpanel.com) is a third service that also hosts
the WebSocket gateway (ws.mzpanel.com). See /llms.txt for the
machine-readable docs map.
Related
Section titled “Related”- The agent — the single Go binary on your VPS.
- Security model — how the three connections are authenticated.
- Tiers & quotas — what each plan unlocks and how its gates are enforced.
- The mz CLI — driving the box from the command line.