# CLI reference

> Every command and flag of the Minekube CLI (minekube, or mk): init, check, dev, server, daemon, client, share, registry, relay, claim, instances, trust, login, logout, whoami, network, publish, unpublish, revisions, 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 network, or both. |
| [`check`](#mk-check) | Run the project's Bun check script. |
| [`dev`](#mk-dev) | Build a game (src/game.ts) and a network bundle (network/velocity.ts), install them on the dev server and the dev proxy, and reinstall on every change. |
| [`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. |
| [`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. |
| [`registry`](#mk-registry) | Run the registry locally in workerd on http://localhost:4776; 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 registry, 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_REGISTRY_TOKEN, a token of the registry's issuer; at the local registry 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_REGISTRY_TOKEN, a token of the registry's issuer; at the local registry 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_REGISTRY_TOKEN, a token of the registry's issuer; at the local registry 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 registry. |
| [`whoami`](#mk-whoami) | Show the Minecraft account mk is logged in as. |
| [`network`](#mk-network) | Networks your Minecraft account owns. |
| [`publish`](#mk-publish) | Build the project as mk dev does and roll it out to a network's instances: each instance the selector picks gets the bundles for its platform from the registry and swaps them in, players connected. As the owner of the network (mk login), or an admin. |
| [`unpublish`](#mk-unpublish) | End what mk publish assigned to a selector: the instances it picked stop those bundles, players connected, and keep what other selectors give them. The revision stays, to assign again with mk publish --revision. As the owner of the network (mk login), or an admin. |
| [`revisions`](#mk-revisions) | What runs where in a network, and its revisions, to roll back to with mk publish --revision. As the owner of the network (mk login), or an admin. |

## `mk init`

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

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

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

| Flag | Does |
| --- | --- |
| `--game` | A game for the Paper server, in src/. The default when neither part is named. |
| `--network` | A network bundle for the Velocity proxy, in network/: a lobby with /lobby and kick fallback. |

## `mk check`

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

Run the project's Bun check script.

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

## `mk dev`

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

Build a game (src/game.ts) and a network bundle (network/velocity.ts), install them on the dev server and the dev proxy, and reinstall on every change.

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

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

## `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.

| 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 registry runs in workerd (`mk registry`). |
| `--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 Minekube's relay, without an open port. It runs in online mode then, as anyone can reach it. Without it the server is private again. |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |
| `--relay <string>` | The relay's iroh URL for --join. Defaults to https://relay.&lt;domain&gt;/ for the registry registry.&lt;domain&gt;. |

## `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. |
| `--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. |
| `--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. |

## `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. |

## `mk registry`

```sh
minekube registry [flags]
```

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

## `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 registry, whose relay tokens mk makes.

| Flag | Does |
| --- | --- |
| `--listen <string>` | Where Java players connect. |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. Start the local one with `mk registry`. |
| `--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_REGISTRY_TOKEN, a token of the registry's issuer; at the local registry 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. |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

## `mk instances`

```sh
minekube instances [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_REGISTRY_TOKEN, a token of the registry's issuer; at the local registry 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). |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

## `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_REGISTRY_TOKEN, a token of the registry's issuer; at the local registry 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 registry 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 selectors, as in mk publish -l. |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

### `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. |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

### `mk trust remove`

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

Stop trusting a token issuer for a subject. Servers already in the network stay.

| 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. |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

## `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. |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

## `mk logout`

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

End this machine's session at the registry.

| Flag | Does |
| --- | --- |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

## `mk whoami`

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

Show the Minecraft account mk is logged in as.

| Flag | Does |
| --- | --- |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

## `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 |
| --- | --- |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

### `mk network list`

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

The networks your account owns.

| Flag | Does |
| --- | --- |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

### `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 selectors, as in mk publish -l. |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

## `mk publish`

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

Build the project as mk dev does and roll it out to a network's instances: each instance the selector picks gets the bundles for its platform from the registry and swaps them in, players connected. As the owner of the network (mk login), or an admin.

| Argument | Is |
| --- | --- |
| `<directory>` | The project, as for mk dev. Optional. |

| 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` | The instances that run it, as a label selector like kubectl's -l: channel=canary. Every instance of the network without one. |
| `--revision <string>` | Assign an earlier revision instead of building the project: rolls back (mk revisions lists them). |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

## `mk unpublish`

```sh
minekube unpublish [flags]
```

End what mk publish assigned to a selector: the instances it picked stop those bundles, players connected, and keep what other selectors give them. The revision stays, to assign again with mk publish --revision. As the owner of the network (mk login), or an 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` | The instances that run it, as a label selector like kubectl's -l: channel=canary. Every instance of the network without one. |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

## `mk revisions`

```sh
minekube revisions [flags]
```

What runs where in a network, and its revisions, to roll back to with mk publish --revision. As the owner of the network (mk login), or an 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. |
| `--registry <string>` | The registry's URL; or MINEKUBE_REGISTRY. |

## 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 registry (`mk registry`), the default `--registry` |
| 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_REGISTRY` | The registry's URL, instead of `--registry`. Default `http://localhost:4776`, the local registry. |
| `MINEKUBE_REGISTRY_TOKEN` | A token of the registry's issuer, to act as its admin instead of as your account (`mk login`). Unneeded at the local registry, 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`. |
