ZEKTOR.IO Docs

Command Line

Provision, inspect and connect to Zektor.io instances from your terminal with the zektor CLI — access tokens, scripting, and CI usage.

Overview

The zektor CLI does from a terminal what the dashboard does in a browser: create instances, list them, and open a session against one. It talks to the same API, so anything it can do you can also do by hand.

The CLI and its MCP server are in beta. They work, they are supported, and the command surface is settled at 1.0 — flags, output shapes and exit codes will not change without a major version, so scripting against --json is safe. What "beta" buys us is room to add commands and adjust the rougher edges as we learn how people actually use it. Tokens you create now keep working.

Install

npm install -g zektor

Or without installing:

npx zektor whoami

Requires Node 18 or newer. Source: github.com/m-akcan/zektor-cli.

Access tokens

The CLI authenticates with a personal access token, not your password. Create one under Settings → Access tokens.

A token is shown once, at creation. Only a hash is stored, so it cannot be displayed again — if you lose it, revoke it and create another.

When you create one, choose what it may do (read, manage or delete databases, branches, connection roles, billing, minting further tokens), when it expires (from 1 day to 1 year, or never), and optionally the one database it may touch. In Settings, a new token starts with Read databases, Manage databases and Connection roles ticked. Until you tick the rest, it cannot delete databases, create or remove branches, mint other tokens, or see invoices and payment methods. It can still create and scale databases and grow their storage (instances:write), which are billed. Metrics, logs, schema and backups are not available to tokens yet; use the dashboard for those. A token can do everything it was given, so treat it like a password.

  • Revoking takes effect on the next request that uses the token
  • Last used is shown in the tokens list, so an unused token is easy to spot
  • Tokens are not tied to a session — logging out of the dashboard does not invalidate them

Logging in

zektor login

Paste the token when prompted; the input is hidden. It is verified against the API before being saved, so a mistyped token fails immediately rather than on your next command.

The token is written to ~/.config/zektor/config.json with permissions 0600.

In CI

Set ZEKTOR_TOKEN instead of running zektor login:

ZEKTOR_TOKEN=zk_… zektor list

The environment variable always takes precedence over the config file. Use a token created specifically for CI so you can revoke it without disturbing your laptop.

zektor whoami reports which of the two supplied the credential — useful when a stray ZEKTOR_TOKEN is overriding the account you logged in as.

Creating instances

zektor db create --name=my-db --tier=AKPG-5 --region=germany --engine=postgres@17
zektor cache create --name=my-cache --tier=AKVK-1 --region=germany --engine=valkey@8
FlagMeaning
--nameInstance name. Required.
--tierPlan, e.g. AKPG-5. Determines memory, storage and price.
--regionRegion, location or city, e.g. germany, fsn1 or Falkenstein.
--engineEngine and optional version, e.g. postgres@17. Omit to take the default.

--tier, --region and --engine accept the names shown in the dashboard. Pass a value that does not exist and the error lists the valid ones:

$ zektor db create --name=x --tier=nope
error: Unknown database plan "nope". Available: AKPG-5, AKPG-10, AKPG-20, …

A major version is enough for --engine — postgres@17 matches 17.6.

Storage is not a flag. A database starts with what its plan includes; grow it with zektor storage resize.

Provisioning is asynchronous and takes under a minute. create prints the new instance id and returns; watch progress with zektor list.

Inspecting

zektor list
zektor show 42

Both take --json.

Connecting

zektor connect 42

For Valkey and Redis this opens a redis-cli session.

For PostgreSQL it prints the command shape instead of connecting, because there is no password for it to use. Postgres passwords are shown once when a role is created or rotated and are never stored, so nothing — not the CLI, not the dashboard — can retrieve one afterwards. Create or rotate a role first, then connect with the credentials from that response.

redis-cli and psql are not bundled. Install whichever you need.

Deleting

zektor delete 42

Asks you to type the instance name, so you have to look at what you are about to destroy. --yes skips the prompt for scripts; without a terminal to prompt at, the command refuses unless --yes is given.

Scaling

zektor scale 42 --tier=AKPG-10

Moves an instance to another plan. The direction is worked out from the price, the same way the dashboard does it, so an "upgrade" means the same thing in both places.

Like delete, it asks you to type the instance name; --yes skips that. A downgrade says so explicitly first. Storage never shrinks, so a downgrade keeps its size, and the GB above the smaller plan's included storage are billed at €0.15/GB per month; scale says what that costs before it moves.

Storage

PostgreSQL only. A cache is sized by its plan, so use scale for one.

zektor storage show 42
zektor storage resize 42 --size=50
zektor storage autoscale 42 --on --limit=100
Command
storage showSize, usage, what is above the plan and automatic growth
storage resize --size=<gb>Grow the storage: larger than now, at most 1000GB
storage autoscale --on|--offTurn automatic growth on or off, with --limit for its maximum

Storage only grows, online and with no restart, and can't be made smaller afterwards. resize refuses a number that isn't larger than now. The GB above what the plan includes are billed at €0.15/GB per month, prorated by the hour, and resize prints what the new size costs before it starts.

Turning automatic growth on needs a --limit above the current size, and a payment method or account credit. A limit cannot be cleared once set: the API reads an omitted value as "leave unchanged", so there is no value meaning "none" — set a different number instead.

MCP server

zektor mcp runs the CLI as an MCP server over stdio, so an editor or coding agent can list, create and scale instances for you. It uses the token from zektor login, so there is nothing extra to configure.

{
  "mcpServers": {
    "zektor": { "command": "npx", "args": ["-y", "zektor", "mcp"] }
  }
}

For Claude Code: claude mcp add zektor -- npx -y zektor mcp.

What it exposes

Reading is unrestricted: the account, instances, plans, regions, and storage settings. Writing covers creating instances, scaling, growing storage and automatic growth.

Deleting is off by default. delete_instance is not registered at all unless ZEKTOR_MCP_ALLOW_DESTRUCTIVE=1 is set, so a model working against your account cannot destroy an instance no matter what it is asked to do. Scaling, growing storage and deleting also require passing the instance's exact name as a separate argument — the same idea as the CLI's typed-name prompt, which has no equivalent when the caller is not a person at a keyboard.

Branching

Branching is available here and nowhere else on the command line — there is no zektor branch, because forking a database is something an agent does far more often than a person does.

ToolWhat it does
create_branchCopy-on-write clone of a PostgreSQL database. Defaults to a 7-day expiry
list_branchesThe cluster's default database and every branch of it
set_branch_expiryExtend the deadline, or remove it
delete_branchThrow one away. The source is untouched
promote_branchMake a branch the cluster's default

delete_branch works without ZEKTOR_MCP_ALLOW_DESTRUCTIVE. That is deliberate: fork, experiment, discard is the entire point, and a branch is the one thing an agent should be able to destroy. It refuses anything that is not a branch, and still requires the branch's exact name as confirm_name.

This is the safe way to let a coding agent near your data. Give it a branch rather than the database, and the worst outcome is a wasted euro.

Credentials in the model's context

Two tools hand a model a live password, which then lives in its context:

  • get_connection on a cache, because that is how an agent wires an application to a new instance
  • create_ephemeral_role on PostgreSQL, which mints a role that stops working by itself after a TTL you set — 60 seconds to 24 hours, one hour by default

PostgreSQL's own stored passwords remain unreadable, as above; the ephemeral role is a fresh credential with a deadline, not a copy of yours. It is the only way an agent can connect to a PostgreSQL instance, on a branch as much as anywhere else — a branch has its own default role, but the roles you added to the source are not carried into it.

Scripting

stdout carries data and nothing else — progress, warnings and errors go to stderr, so pipes stay clean:

zektor list --json | jq -r '.[] | select(.status=="active") | .name'

Failures exit non-zero, so zektor … && next-command stops rather than continuing past an error.

Configuration

VariablePurpose
ZEKTOR_TOKENAccess token. Overrides the config file.
ZEKTOR_API_URLAPI base URL. Rarely needed.
XDG_CONFIG_HOMEHonoured when set; config lives under $XDG_CONFIG_HOME/zektor/.
ZEKTOR_MCP_ALLOW_DESTRUCTIVESet to 1 to let the MCP server delete instances. Unset, the tool does not exist.

On this page