# CLI reference

> Every command and flag of the Minekube CLI (minekube, or mk): init, check, types, dev, build, server, daemon, client, share, api, relay, claim, instances, trust, login, logout, whoami, network, deploy, versions, deployments, rollback, undeploy, with ports and environment variables.

{/* Generated by `bun tools/minekube-cli/reference.ts` from the CLI's own commands. Do not edit; change the command and run it. */}

The Minekube CLI is `minekube`, and `mk` for short; use `minekube` if `mk` already means something else in your shell. Install it once from the Minekube distribution, which puts both names on your PATH:

```sh
bun add -g https://github.com/minekube/minekube/releases/latest/download/minekube-cli.tgz
```

It keeps the dev servers, the Java it runs them on, your sessions and its downloads in `~/.minekube`; `MINEKUBE_HOME` moves it. `mk <command> --help` prints what this page shows.

| Command | Does |
| --- | --- |
| [`init`](#mk-init) | Create a standalone Effect project in a new directory: a game, a proxy bundle, or both. |
| [`check`](#mk-check) | Run the project's Bun check script. |
| [`types`](#mk-types) | Generate the project's platform types for the versions its vite.config.ts names (paper.version, velocity.version), with the APIs of other plugins it names (plugins), into types/, without a server: from that build's jars, downloaded from PaperMC once, with the generator the runtimes use. Kept in the Minekube home for every project. mk dev runs it first. |
| [`dev`](#mk-dev) | Generate the project's platform types as mk types does, then build the bundles vite.config.ts names, install each where its platform runs on this machine (Paper bundles on the dev server, Velocity bundles on the dev proxy, client bundles in the daemon's clients), and again on every save of a file they import, as vite dev does. The runtimes swap them in, players connected. |
| [`build`](#mk-build) | Build the bundles vite.config.ts names into dist/, with minekube.json naming each with its platform and SHA-256, as vite build does. mk deploy uploads what it holds. |
| [`server`](#mk-server) | Set up and run the single local Paper dev server (or with --network, the dev network) with the Minekube runtimes and the Effect UI devtools. Started in a project folder, it runs the Paper (and Velocity) version the project's vite.config.ts names; else the one this CLI pins. |
| [`daemon`](#mk-daemon) | Run the Minekube daemon: an HTTP API that starts Minecraft clients, installs their bundles and streams what happens in them. |
| [`client`](#mk-client) | Run a Minecraft client with Fabric and the Minekube client runtime in the daemon (`mk daemon`); it joins the dev server as an offline player and its log and recordings stream here. |
| [`share`](#mk-share) | Share a client's world stream on the relay, so a browser anywhere can watch it. Needs MINEKUBE_PUBLISH_KEY, the key the relay was deployed with. |
| [`api`](#mk-api) | Run the Minekube API locally in workerd on http://localhost:4776 (MINEKUBE_DEV_SLOT moves it); it trusts tokens of this machine's key (&lt;home&gt;/operator.json), which mk makes for its relay and itself. |
| [`relay`](#mk-relay) | Run a Minekube relay locally: Java players connect to it, and it passes them to the instances the registry names over iroh. Against the local API, whose relay tokens mk makes. |
| [`claim`](#mk-claim) | Add a new instance to a network with the code it logs. As the owner of the network (mk login), or an admin: MINEKUBE_API_TOKEN, a token of the API's issuer; at the local API mk is the admin. |
| [`instances`](#mk-instances) | List a network's instances, with their labels, players and whether they are online. As the owner of the network (mk login), or an admin: MINEKUBE_API_TOKEN, a token of the API's issuer; at the local API mk is the admin. |
| [`trust`](#mk-trust) | Which token issuers let servers join a network (OpenID Connect federation). As the owner of the network (mk login), or an admin: MINEKUBE_API_TOKEN, a token of the API's issuer; at the local API mk is the admin. |
| [`login`](#mk-login) | Log in with your Minecraft account: join the Minekube hub, click [Log in] in the chat, and give mk the code it shows (or --code). |
| [`logout`](#mk-logout) | End this machine's session at the API. |
| [`whoami`](#mk-whoami) | Show the Minecraft account mk is logged in as. |
| [`network`](#mk-network) | Networks your Minecraft account owns. |
| [`deploy`](#mk-deploy) | Build the project as mk build does, upload what dist/ holds as a version of the target's network, and deploy it to the target: every server its selector picks gets the bundles of its platform from the API and swaps them in, players connected. As the owner of the network (mk login), or an admin. |
| [`versions`](#mk-versions) | The versions of a project in its targets' networks: the bundles of one build each, named by the hash of their contents. |
| [`deployments`](#mk-deployments) | The deployments of the targets' networks. |
| [`rollback`](#mk-rollback) | Point a target back at an earlier version: the one it ran before, or the one named. Every server its selector picks swaps it in, players connected. Rolling back twice goes forward again. After mk undeploy, which ends the target's history, name the version. |
| [`undeploy`](#mk-undeploy) | End a target's deployment: the servers its selector picks stop its bundles, players connected, and keep what other deployments give them. The version stays, to deploy again, but the deployment's history goes with it: mk rollback then needs the version named. |

## `mk init`

```sh
minekube init [flags] <directory>
```

Create a standalone Effect project in a new directory: a game, a proxy bundle, or both.

| Argument | Is |
| --- | --- |
| `<directory>` |  |

| Flag | Does |
| --- | --- |
| `--game` | A game for the Paper server, in src/. The default when neither part is named. |
| `--proxy` | A proxy bundle for Velocity, in proxy/: a lobby with /lobby and kick fallback. |
| `--paper <string>` | The Paper version the game is built for, such as 1.21.8. Defaults to the newest with a stable build. |
| `--velocity <string>` | The Velocity version the proxy bundle is built for, such as 4.3.1. Defaults to the newest with a stable build. |

## `mk check`

```sh
minekube check [flags] [<directory>]
```

Run the project's Bun check script.

| Argument | Is |
| --- | --- |
| `<directory>` |  Optional. |

## `mk types`

```sh
minekube types [flags] [<root>]
```

Generate the project's platform types for the versions its vite.config.ts names (paper.version, velocity.version), with the APIs of other plugins it names (plugins), into types/, without a server: from that build's jars, downloaded from PaperMC once, with the generator the runtimes use. Kept in the Minekube home for every project. mk dev runs it first.

| Argument | Is |
| --- | --- |
| `<root>` | The project: the directory with its vite.config.ts, as for vite. Optional. |

## `mk dev`

```sh
minekube dev [flags] [<root>]
```

Generate the project's platform types as mk types does, then build the bundles vite.config.ts names, install each where its platform runs on this machine (Paper bundles on the dev server, Velocity bundles on the dev proxy, client bundles in the daemon's clients), and again on every save of a file they import, as vite dev does. The runtimes swap them in, players connected.

| Argument | Is |
| --- | --- |
| `<root>` | The project: the directory with its vite.config.ts, as for vite. Optional. |

| Flag | Does |
| --- | --- |
| `--server <string>` | Server directory to install Paper bundles into. Defaults to the dev server, `server` in the Minekube home (~/.minekube, .dev in a Minekube checkout, or MINEKUBE_HOME; `server-N` in dev slot N, MINEKUBE_DEV_SLOT). |
| `--proxy <string>` | Velocity directory to install Velocity bundles into. Defaults to the dev network's proxy (`mk server --network`), `network/velocity` in the Minekube home (`network-N/velocity` in dev slot N). |

## `mk build`

```sh
minekube build [flags] [<root>]
```

Build the bundles vite.config.ts names into dist/, with minekube.json naming each with its platform and SHA-256, as vite build does. mk deploy uploads what it holds.

| Argument | Is |
| --- | --- |
| `<root>` | The project: the directory with its vite.config.ts, as for vite. Optional. |

## `mk server`

```sh
minekube server [flags]
```

Set up and run the single local Paper dev server (or with --network, the dev network) with the Minekube runtimes and the Effect UI devtools. Started in a project folder, it runs the Paper (and Velocity) version the project's vite.config.ts names; else the one this CLI pins.

| Flag | Does |
| --- | --- |
| `--server <string>` | Server directory. Defaults to `server` in the Minekube home: ~/.minekube (MINEKUBE_HOME), or .dev in a Minekube checkout. |
| `--java <string>` | Java executable. Defaults to the pinned Oracle GraalVM, downloaded once into the Minekube home (in a checkout: java from the PATH); GraalVM JIT-compiles game code. |
| `--accept-eula` | Accept the Minecraft EULA (https://aka.ms/MinecraftEULA) for a new server. |
| `--network` | Run the dev network in the Minekube home's network directory instead (from a Minekube checkout only, for now): players join the relay on port 25577, which passes them over iroh to Velocity with the Minekube plugin, in front of lobby (25580) and arena (25581), Paper servers that only accept players through it (modern forwarding). Everything listens on loopback only; the API runs in workerd (`mk api`). MINEKUBE_DEV_SLOT moves every port. |
| `--join <string>` | Make the dev server public in a network you own (mk login, mk network create): players join &lt;network&gt;.&lt;domain&gt; through the network's relay, without an open port. It runs in online mode then, as anyone can reach it. Defaults to dev.join in the vite.config.ts of the current directory; without either the server is private again. |
| `--api <string>` | The Minekube API's URL for --join; or MINEKUBE_API. Defaults to the API the current directory's vite.config.ts names, else the local one. |
| `--relay <string>` | The relay's iroh URL for --join. Defaults to the first relay the Minekube API knows, else the local one. |

## `mk daemon`

```sh
minekube daemon [flags]
```

Run the Minekube daemon: an HTTP API that starts Minecraft clients, installs their bundles and streams what happens in them.

| Flag | Does |
| --- | --- |
| `--port <integer>` | Port on 127.0.0.1. Defaults to 4775, moved by MINEKUBE_DEV_SLOT. |
| `--java <string>` | Java executable for the clients (Java 25 for Minecraft 26). Defaults to the pinned GraalVM, as for `mk server`. |

## `mk client`

```sh
minekube client [flags]
```

Run a Minecraft client with Fabric and the Minekube client runtime in the daemon (`mk daemon`); it joins the dev server as an offline player and its log and recordings stream here.

| Flag | Does |
| --- | --- |
| `--name <string>` | Offline player name; also the client's directory in `clients` in the Minekube home. |
| `--server <string>` | Server to join on start. Defaults to the dev server, localhost:25569, moved by MINEKUBE_DEV_SLOT. |
| `--show-window` | Show the client's window. Hidden by default; the client plays the same. |
| `--minecraft <string>` | Run this Minecraft version as Mojang ships it instead: no Fabric, no client runtime, no bundles, its window shown. |
| `--daemon <string>` | The Minekube daemon (`mk daemon`) that runs the client. Defaults to http://127.0.0.1:4775, moved by MINEKUBE_DEV_SLOT. |

## `mk share`

```sh
minekube share [flags] <client>
```

Share a client's world stream on the relay, so a browser anywhere can watch it. Needs MINEKUBE_PUBLISH_KEY, the key the relay was deployed with.

| Argument | Is |
| --- | --- |
| `<client>` | The client in the daemon whose world stream to share. |

| Flag | Does |
| --- | --- |
| `--relay <string>` | The relay's URL (`bun run deploy` in infra prints it); or MINEKUBE_RELAY. Required. |
| `--daemon <string>` | The Minekube daemon (`mk daemon`) that runs the client. Defaults to http://127.0.0.1:4775, moved by MINEKUBE_DEV_SLOT. |

## `mk api`

```sh
minekube api [flags]
```

Run the Minekube API locally in workerd on http://localhost:4776 (MINEKUBE_DEV_SLOT moves it); it trusts tokens of this machine's key (&lt;home&gt;/operator.json), which mk makes for its relay and itself.

| Flag | Does |
| --- | --- |
| `--port <integer>` | The port, 4776 by default, moved by MINEKUBE_DEV_SLOT; another for a second API on this machine, which mk then reaches with --api and that port. Each slot's API keeps its own state; one on any other port gets a throwaway state. |

## `mk relay`

```sh
minekube relay [flags]
```

Run a Minekube relay locally: Java players connect to it, and it passes them to the instances the registry names over iroh. Against the local API, whose relay tokens mk makes.

| Flag | Does |
| --- | --- |
| `--listen <string>` | Where Java players connect. Defaults to 127.0.0.1:25565, moved by MINEKUBE_DEV_SLOT. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Start the local one with `mk api`. |
| `--default-network <string>` | Development: players who type a host that names no network (localhost, an IP) join this network. |

## `mk claim`

```sh
minekube claim [flags] <code>
```

Add a new instance to a network with the code it logs. As the owner of the network (mk login), or an admin: MINEKUBE_API_TOKEN, a token of the API's issuer; at the local API mk is the admin.

| Argument | Is |
| --- | --- |
| `<code>` | The code the instance logs while it belongs to no network. |

| Flag | Does |
| --- | --- |
| `--network <string>` | The network's name: players join it at &lt;network&gt;.&lt;domain&gt;, as &lt;network&gt;.g.minekube.net. Required. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

## `mk instances`

```sh
minekube instances <subcommand> [flags]
```

List a network's instances, with their labels, players and whether they are online. As the owner of the network (mk login), or an admin: MINEKUBE_API_TOKEN, a token of the API's issuer; at the local API mk is the admin.

| Flag | Does |
| --- | --- |
| `--network <string>` | The network's name: players join it at &lt;network&gt;.&lt;domain&gt;, as &lt;network&gt;.g.minekube.net. Required. |
| `--selector <string>`, `-l` | A label selector, as kubectl's -l: stage=lobby,region in (eu,us). |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

### `mk instances remove`

```sh
minekube instances remove [flags] <id>
```

Take an instance out of a network: out of the network's key set, so backends stop trusting its tokens once their cached keys expire, its control channel closed, waiting for a network again. Joining again needs a new code, invite or token.

| Argument | Is |
| --- | --- |
| `<id>` | The instance id, or its first characters as mk instances shows them. |

| Flag | Does |
| --- | --- |
| `--network <string>` | The network's name: players join it at &lt;network&gt;.&lt;domain&gt;, as &lt;network&gt;.g.minekube.net. Required. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

## `mk trust`

```sh
minekube trust <subcommand> [flags]
```

Which token issuers let servers join a network (OpenID Connect federation). As the owner of the network (mk login), or an admin: MINEKUBE_API_TOKEN, a token of the API's issuer; at the local API mk is the admin.

### `mk trust add`

```sh
minekube trust add [flags]
```

Let servers join a network with a token their environment gives them (a cluster's service account, a CI job), instead of a claim code.

| Flag | Does |
| --- | --- |
| `--network <string>` | The network's name: players join it at &lt;network&gt;.&lt;domain&gt;, as &lt;network&gt;.g.minekube.net. Required. |
| `--issuer <string>` | The token issuer, exactly as its tokens' iss claim says. Required. |
| `--audience <string>` | The audience the tokens are made for (aud claim). |
| `--subject <string>` | The subject the rule covers (sub claim). Required. |
| `--prefix` | Cover every subject that starts with --subject, like system:serviceaccount:games:. |
| `--jwks <file>` | The issuer's public key set as a file, for an issuer the API cannot reach. Otherwise it reads it through the issuer's OpenID discovery. |
| `--labels <string>` | Labels the registry gives each server this lets in, over its own: game=parkour,mode=solo. For the selectors of targets in vite.config.ts. |
| `--network-issuer` | The issuer is another Minekube network, https://&lt;api&gt;/n/&lt;network&gt;: its token lets in only the server whose key signed it, and the keys come from that API, so leave out --jwks. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

### `mk trust list`

```sh
minekube trust list [flags]
```

List the token issuers a network trusts.

| Flag | Does |
| --- | --- |
| `--network <string>` | The network's name: players join it at &lt;network&gt;.&lt;domain&gt;, as &lt;network&gt;.g.minekube.net. Required. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

### `mk trust remove`

```sh
minekube trust remove [flags]
```

Stop trusting a token issuer for a subject. The servers the rule let in leave the network with it.

| Flag | Does |
| --- | --- |
| `--network <string>` | The network's name: players join it at &lt;network&gt;.&lt;domain&gt;, as &lt;network&gt;.g.minekube.net. Required. |
| `--issuer <string>` | The token issuer, exactly as its tokens' iss claim says. Required. |
| `--subject <string>` | The subject the rule covers (sub claim). Required. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

## `mk login`

```sh
minekube login [flags]
```

Log in with your Minecraft account: join the Minekube hub, click [Log in] in the chat, and give mk the code it shows (or --code).

| Flag | Does |
| --- | --- |
| `--code <string>` | The login code the hub gave you. Without it, mk asks for it. |
| `--device <string>` | A name for this session, e.g. the machine. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

## `mk logout`

```sh
minekube logout [flags]
```

End this machine's session at the API.

| Flag | Does |
| --- | --- |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

## `mk whoami`

```sh
minekube whoami [flags]
```

Show the Minecraft account mk is logged in as.

| Flag | Does |
| --- | --- |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

## `mk network`

```sh
minekube network <subcommand> [flags]
```

Networks your Minecraft account owns.

### `mk network create`

```sh
minekube network create [flags] <name>
```

Make a network your account owns (mk login first). The name must be free.

| Argument | Is |
| --- | --- |
| `<name>` | The network's name: players join it at &lt;name&gt;.&lt;domain&gt;. |

| Flag | Does |
| --- | --- |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

### `mk network list`

```sh
minekube network list [flags]
```

The networks your account owns.

| Flag | Does |
| --- | --- |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

### `mk network invite`

```sh
minekube network invite [flags] <name>
```

Make a one-time invite for a server whose environment issues no token a trust rule covers (a cluster without a public issuer, a plain VPS). The server shows it once to join; from then on its key is its identity. As the owner of the network, or an admin.

| Argument | Is |
| --- | --- |
| `<name>` | The network. |

| Flag | Does |
| --- | --- |
| `--hours <integer>` | How long the invite works, 1 to 168 hours. |
| `--labels <string>` | Labels the registry gives each server this lets in, over its own: game=parkour,mode=solo. For the selectors of targets in vite.config.ts. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the local one (mk api), http://localhost:4776 or as MINEKUBE_DEV_SLOT moves it. |

## `mk deploy`

```sh
minekube deploy [flags] [<target>]
```

Build the project as mk build does, upload what dist/ holds as a version of the target's network, and deploy it to the target: every server its selector picks gets the bundles of its platform from the API and swaps them in, players connected. As the owner of the network (mk login), or an admin.

| Argument | Is |
| --- | --- |
| `<target>` | The target in vite.config.ts; not needed when there is only one. Optional. |

| Flag | Does |
| --- | --- |
| `--root <string>` | The project: the directory with its vite.config.ts. The current one by default. |
| `--message <string>` | Describes the version, up to 100 characters. Defaults to the subject of the project's last git commit. |
| `--tag <string>` | Tags the version, up to 25 characters. Defaults to the project's git commit: 12 characters of its hash, and -dirty with uncommitted changes. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the API vite.config.ts names, else the local one (mk api, in the dev slot MINEKUBE_DEV_SLOT names). |
| `--strict-versions` | Refuse to deploy while a server the target picks runs another version of a bundle's platform than the bundle was built for (paper.version, velocity.version); without it mk only warns. Or strictVersions: true on the target. |

## `mk versions`

```sh
minekube versions <subcommand> [flags]
```

The versions of a project in its targets' networks: the bundles of one build each, named by the hash of their contents.

### `mk versions upload`

```sh
minekube versions upload [flags]
```

Build the project and upload what dist/ holds as a version of the target's network, without deploying it.

| Flag | Does |
| --- | --- |
| `--target <string>`, `-t` | The target in vite.config.ts; not needed when there is only one. |
| `--root <string>` | The project: the directory with its vite.config.ts. The current one by default. |
| `--message <string>` | Describes the version, up to 100 characters. Defaults to the subject of the project's last git commit. |
| `--tag <string>` | Tags the version, up to 25 characters. Defaults to the project's git commit: 12 characters of its hash, and -dirty with uncommitted changes. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the API vite.config.ts names, else the local one (mk api, in the dev slot MINEKUBE_DEV_SLOT names). |

### `mk versions list`

```sh
minekube versions list [flags]
```

The 50 newest versions of the targets' networks, with the selectors that run them. As the owner of the network (mk login), or an admin.

| Flag | Does |
| --- | --- |
| `--target <string>`, `-t` | The target in vite.config.ts; not needed when there is only one. |
| `--root <string>` | The project: the directory with its vite.config.ts. The current one by default. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the API vite.config.ts names, else the local one (mk api, in the dev slot MINEKUBE_DEV_SLOT names). |
| `--full` | Shows each version's whole id rather than its first 12 characters, for a version that shares them with another. |

### `mk versions deploy`

```sh
minekube versions deploy [flags] <version>
```

Deploy a version uploaded before to a target: every server its selector picks swaps it in, players connected.

| Argument | Is |
| --- | --- |
| `<version>` | The version: its id, or the first 12 or more characters of it, as mk versions list shows them. |

| Flag | Does |
| --- | --- |
| `--target <string>`, `-t` | The target in vite.config.ts; not needed when there is only one. |
| `--root <string>` | The project: the directory with its vite.config.ts. The current one by default. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the API vite.config.ts names, else the local one (mk api, in the dev slot MINEKUBE_DEV_SLOT names). |
| `--strict-versions` | Refuse to deploy while a server the target picks runs another version of a bundle's platform than the bundle was built for (paper.version, velocity.version); without it mk only warns. Or strictVersions: true on the target. |

## `mk deployments`

```sh
minekube deployments <subcommand> [flags]
```

The deployments of the targets' networks.

### `mk deployments list`

```sh
minekube deployments list [flags]
```

What runs where in the targets' networks: each selector and the version it points at. A server runs the bundles of every deployment whose selector picks it; for bundles of the same name the newer wins.

| Flag | Does |
| --- | --- |
| `--target <string>`, `-t` | The target in vite.config.ts; not needed when there is only one. |
| `--root <string>` | The project: the directory with its vite.config.ts. The current one by default. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the API vite.config.ts names, else the local one (mk api, in the dev slot MINEKUBE_DEV_SLOT names). |

## `mk rollback`

```sh
minekube rollback [flags] [<version>]
```

Point a target back at an earlier version: the one it ran before, or the one named. Every server its selector picks swaps it in, players connected. Rolling back twice goes forward again. After mk undeploy, which ends the target's history, name the version.

| Argument | Is |
| --- | --- |
| `<version>` | The version to go back to, by its id or the first 12 or more characters of it; the one the target ran before by default. Optional. |

| Flag | Does |
| --- | --- |
| `--target <string>`, `-t` | The target in vite.config.ts; not needed when there is only one. |
| `--root <string>` | The project: the directory with its vite.config.ts. The current one by default. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the API vite.config.ts names, else the local one (mk api, in the dev slot MINEKUBE_DEV_SLOT names). |
| `--strict-versions` | Refuse to deploy while a server the target picks runs another version of a bundle's platform than the bundle was built for (paper.version, velocity.version); without it mk only warns. Or strictVersions: true on the target. |

## `mk undeploy`

```sh
minekube undeploy [flags] [<target>]
```

End a target's deployment: the servers its selector picks stop its bundles, players connected, and keep what other deployments give them. The version stays, to deploy again, but the deployment's history goes with it: mk rollback then needs the version named.

| Argument | Is |
| --- | --- |
| `<target>` | The target in vite.config.ts; not needed when there is only one. Optional. |

| Flag | Does |
| --- | --- |
| `--root <string>` | The project: the directory with its vite.config.ts. The current one by default. |
| `--api <string>` | The Minekube API's URL; or MINEKUBE_API. Defaults to the API vite.config.ts names, else the local one (mk api, in the dev slot MINEKUBE_DEV_SLOT names). |

## Global flags

| Flag | Does |
| --- | --- |
| `--help`, `-h` | Show help information |
| `--version`, `-v` | Show version information |
| `--wizard` | Start wizard mode for a command |
| `--completions <bash\|zsh\|fish\|powershell\|sh\|pwsh>` | Print shell completion script (choices: bash, zsh, fish, powershell, sh, pwsh) |
| `--log-level <all\|trace\|debug\|info\|warn\|warning\|error\|fatal\|none>` | Sets the minimum log level (choices: all, trace, debug, info, warn, warning, error, fatal, none) |

## Ports

| Port | What |
| --- | --- |
| 25569 | The dev server (`mk server`), RCON on 25575 |
| 4774 | The Effect UI devtools and their MCP server at `/mcp` |
| 4775 | The Minekube daemon (`mk daemon`) |
| 4776 | The local Minekube API (`mk api`, `--port` for another): the API every command and project uses unless `--api`, `MINEKUBE_API` or `api` in vite.config.ts names another |
| 25565 | The local relay (`mk relay`), where its players join |
| 3340 | The iroh relay server inside the local relay, which connectors reach it through |
| 25577 | The dev network's relay, where players join (`mk server --network`) |
| 25578 | The dev network's Velocity |
| 25580, 25581 | The dev network's `lobby` and `arena`, RCON on 25590 and 25591 |

## Environment variables

| Variable | What |
| --- | --- |
| `MINEKUBE_HOME` | Where the CLI keeps the dev servers, Java, its sessions and downloads. Default `~/.minekube`. |
| `MINEKUBE_DEV_SLOT` | Which dev setup on this machine this is, 0 to 99: slot N moves every port above by N×100 (the dev server, the dev network, the devtools, the daemon, the local API and relay), for a second setup next to the first. Its directories in the Minekube home end in `-N` (`server-N`, `network-N`, `clients-N`), and its API keeps its own state. Default 0. |
| `MINEKUBE_API` | The Minekube API's URL, instead of `--api`; it goes before `api` in vite.config.ts. Default `http://localhost:4776`, the local API. |
| `MINEKUBE_API_TOKEN` | A token of the API's issuer, to act as its admin instead of as your account (`mk login`). Unneeded at the local API, where `mk` is the admin. |
| `MINEKUBE_DIST` | Where a release of the CLI downloads its runtimes and SDK packages, instead of the release it came from. |
| `MINEKUBE_RELAY` | The relay's URL for `mk share`, instead of `--relay`. |
| `MINEKUBE_PUBLISH_KEY` | The key the relay was deployed with, for `mk share`. |
