Tokens, levels & scopes
One kind of credential serves both MCP and the
REST API: an API token (mzmcp_…). The workspace owner
mints it at Advanced → Developer (/developer), and it is available on every plan (on
Free, writes are a 30-day trial, then 402 automation_trial_ended).
Four things set what a token can do: its access level, its opt-in scopes, its
server allowlist and the role of the user who minted it.
Ability presets
Section titled “Ability presets”The Developer page offers four presets. A preset is only a named combination of a level
and scopes; pick Custom to set both yourself. Each token row in GET /v1/mcp-tokens
carries preset (read, deploy, operate, full or custom), and
POST /v1/mcp-tokens / PATCH /v1/mcp-tokens/{id} accept preset in place of
accessLevel + scopes.
| Preset | Level | Scopes | For |
|---|---|---|---|
| Read only | read | none | Reports, audits, dashboards |
| Deploy | deploy | apps:own | An AI agent that ships code: deploy and redeploy Docker apps, set their env vars, attach a database, and delete or roll back only the apps this token created |
| Operate | operate | none | Day-2 operations (the dashboard default) |
| Full | full | every scope except mail:* | Full control; mailbox access stays opt-in |
Delete only what the token created (apps:own)
Section titled “Delete only what the token created (apps:own)”When a token creates a new Docker app (apps_deploy, apps_fleet_deploy, or
jobs_create with app.create / app.build), MZPanel records that token as the app’s
creator. A token holding apps:own may then run app.delete and app.rollback on that
app at level deploy, without sites:delete / backups:restore and a full level.
Every other app still needs those. Redeploying an existing app never makes the token its
creator, and an app re-created later by someone else is not the token’s.
Access levels
Section titled “Access levels”| Level | Intended for | Examples |
|---|---|---|
read | Inspect only | List servers, sites, stacks and inventory; read metrics, logs, DNS records, backups and uptime; jobs_get. Read job kinds (site.list, ssl.list, db.list, …) are allowed over REST. |
deploy | The Docker app loop only | apps_source_upload, apps_deploy, apps_fleet_source_upload, apps_fleet_deploy, and jobs_create with app.create, app.build, app.rebuild, app.update, app.env-set, app.env-unset, app.db-attach. No service restarts, sites or other day-2 work. |
operate | Day-2 operations | Restart services and apps, renew and issue certificates, purge caches, create sites, apps, stacks and databases, add DNS records, run backups, create monitors. |
full | Provisioning and replacement | Install PHP versions or the mail stack, apply OS updates, provision a server, edit DNS connections, configure the status page. |
New tokens default to the Operate preset in the dashboard. The API still defaults to
full without scopes when a mint names neither preset nor accessLevel.
Levels are cumulative (read < deploy < operate < full). A read token sees no
jobs_create tool over MCP, because job dispatch is a deploy operation. Over REST, a read token
may still dispatch read-only job kinds. For each job kind, the real level is decided by
its type (see Job kinds).
Opt-in danger scopes
Section titled “Opt-in danger scopes”Destructive or sensitive operations also need an opt-in scope. The access level
never implies a scope: a full token without sites:delete still cannot delete a
site. Scopes are chosen when the token is created and can be changed later with Edit
(PATCH /v1/mcp-tokens/{id} with scopes or preset; a recent sign-in is required).
The dashboard offers no scopes on read tokens.
| Scope | Allows | Examples (operations / job kinds) |
|---|---|---|
servers:enroll | Add servers | servers_create, install_tokens_revoke |
servers:delete | Remove servers from the fleet | servers_delete, lite_delete |
sites:delete | Delete sites, apps and stacks | site.delete, app.delete, stack.delete, stack.down, *.preview-destroy, moves_finish, moves_rollback |
data:delete | Destroy data | db.drop, db.user-drop, pg.db-drop, pg.role-drop, mongo.db-drop, mongo.user-drop, qdrant.collection-delete, volume.remove, volume.prune, docker.system-prune, dns.zone-delete, mail.domain-del, mail.mailbox-del, dns_records_delete, backup_snapshots_delete, uptime_monitors_delete |
backups:restore | Overwrite live data | backup_snapshots_restore, db.import, mongo.import, pg.import, migrate.import, site.push, site.pull, app.rollback, stack.rollback, deploy.rollback, moves_create |
files:write | Write through the file manager | files_write, files_upload, files_delete, files_move, files_extract, security.file |
system:admin | OS users, SSH, firewall, reboot, anything that runs a command as root, and WordPress logins | user.* mutations, security.ssh, security.fw, system.reboot, system.set-hostname, cron.add, cron.update, daemon.create; wp.content writes to wp/v2/users and any call on application passwords |
team:admin | Members and roles | team_invite, team_member_update, team_member_delete |
tokens:admin | Revoke per-server MCP tokens | server_mcp_tokens_revoke |
webhooks:admin | Store third-party secrets and outbound integrations | dns_connections_create, git_connections_create, registry_connections_create, notify_connections_create, uptime_channels_create, backup_destinations_create, dev_webhooks_create / _update / _delete / _test, app_webhooks_*, stack_webhooks_* |
mail:read | Read, search and draft messages in box mailboxes | mail_messages_list, mail_message_get, mail_draft_save |
mail:send | Send mail from a box mailbox | mail_message_send |
mail:modify | Flag, move and delete messages | mail_messages_modify |
apps:own | Delete and roll back the Docker apps this token created | app.delete, app.rollback on its own apps only (level deploy is enough) |
secrets:read | Read job output unmasked | jobs_output and the job stream return secret values as the box printed them (see below) |
Secrets in job output. For a token without secrets:read, jobs_output and the job
stream mask JSON fields whose name looks like a credential (db_pass, admin_password,
*_token, *_secret, api_key …) and KEY=VALUE strings with such a key (container
env in docker.inspect, app.env-list, .env dumps) as [REDACTED], on top of the
masking every stored line gets (private keys, URL passwords, Bearer tokens, cloud and git
tokens). Your agent still sees which variables exist; it just does not copy their values into
its context. Give a token secrets:read only when it really needs the values (for example
to configure another system with a generated database password). The Full ability
includes it.
cron.add, cron.update and daemon.create sit behind system:admin because they run
an arbitrary command as root on the box. Creating, changing or deleting WordPress users and
any use of application passwords through wp.content need it too, and so do writes on
WooCommerce customers (wc/v3/customers, they are WordPress users) and running a WordPress
ability that manages users, customers, passwords or roles (other than a read) (403 wp_identity_write_denied otherwise): a WordPress administrator or an application password is a
login outside the panel. Listing users needs no extra scope. A few kinds are escalated by their arguments:
mail.uninstall with data purge, for example, needs data:delete. The authoritative
per-operation list is GET /v1/api/operations (scope on each operation and job kind).
Server, mailbox and IP allowlists
Section titled “Server, mailbox and IP allowlists”serverIds: an allowlist of servers. Operations on any other server answer404 not_found, not 403, so the token cannot even learn that other servers exist. Server ids passed in a body are checked too (for exampledstServerId). Operations that act on servers the request doesn’t name answer403 fleet_wide: agent fleet update, the private network, load balancers, snapshot restore and project-wide operations. They need a token without an allowlist.mailScope: up to 50 mailbox addresses ([email protected]) or whole domains (@example.com) that the mail tools may touch. Other mailboxes answer404.allowedIps: up to 20 client addresses or CIDR blocks, IPv4 or IPv6 (203.0.113.7,198.51.100.0/24,2001:db8::/48), set in the token’s Allowed IPs field. A request from any other address, over MCP or REST, answers403 token_ip_deniedbefore anything runs; the message names the address it saw. The address is the one Cloudflare reports for the connection, so list the public IP of the machine or CI runner, not a private one. Entries are normalised (10.1.2.3/8is stored as10.0.0.0/8); empty ornull= any address. Change or clear it later by editing the token (PATCH /v1/mcp-tokens/{id}withallowedIps, dashboard session only).
Expiry, ownership and audit
Section titled “Expiry, ownership and audit”- Expiry: optional, 1–3650 days. An expired token answers
401 unauthorized. - Ownership: a token acts as the user who minted it, in that workspace, and is capped by that user’s team role and site grants. If the user leaves the workspace, the token stops working. Tokens never carry staff powers.
- Minting requires a recent sign-in (password or 2FA re-check). Tokens cannot mint or edit tokens.
- Chat-app connections (Claude, ChatGPT custom connectors) are tokens too, named
after the app with
(OAuth). You pick the preset and servers on the consent page; the token lives one hour and the app renews it with a rotating refresh token. Revoke or narrow it here like any token. See Chat connectors. - Audit: every non-GET call is logged as
api.<operation id>, with the token id, in Team → Activity (team_activityfor agents). Jobs a token dispatches are logged asjob.dispatchedwith the same token id. Pick AI tokens or one token in the activity source picker (or callteam_activitywithtoken=<token id>/actor=ai) to see everything that token did.
Rate limits
Section titled “Rate limits”Limits are per token per minute, by workspace plan: Free 60 · Plus 120 · Pro 300 ·
Max 600. MCP and REST share one budget. Over the limit you get 429 rate_limited
with Retry-After.
Least-privilege recipes
Section titled “Least-privilege recipes”| Task | Token |
|---|---|
| Explore the fleet, write a report | read, no scopes |
| Let a coding agent deploy and clean up its own test apps | Deploy preset, allowlist the target servers, expiry 30 days |
| Day-2 operations on two servers (restart, renew, deploy updates) | operate, allowlist those two servers, expiry 30 days |
| Create sites, apps and databases on one server | operate (full if you also install PHP versions), pinned to that server |
| Enrol and provision new servers | full + servers:enroll, no allowlist |
| Clean up old resources | full + sites:delete and/or data:delete, short expiry, revoke after |
| Restore a backup | full + backups:restore, no allowlist (restore is fleet-wide) |
| Triage a support mailbox (read and draft replies) | operate + mail:read (the dashboard offers no scopes on read tokens), mailScope = that mailbox |
Scrape fleet metrics into Prometheus (/v1/api/metrics/prometheus) | read, no scopes, allowedIps = the Prometheus server |
| A CI pipeline that deploys from fixed runners | Deploy preset, allowlist the target servers, allowedIps = the runners’ egress addresses |
When an operation fails with scope_required or access_level, an agent should tell
the user exactly what is missing (details.required_scope or details.required_level).
For app.delete and app.rollback the refusal also carries
details.owned_app_scope: "apps:own": the call would pass on an app this same token
created, but the app named was created by someone else.
It should not look for another route that achieves the same effect.
Related
Section titled “Related”- Safe operating rules
- REST API quickstart: the full error table
- Security model