# Develop on the dev server

> Run one local Paper dev server with the Minekube plugin on the Paper version your project names, install your game on every save with mk dev, get Paper's types for that version, and read what the runtime reports.

You develop every Minekube game on one Paper server on your own machine. It runs the Minekube plugin and the devtools, and it stays up while you change your game. You never restart it for a game change.

## Start the dev server

Start it in its own terminal and keep it running:

```sh
mk server --accept-eula
```

| What | Where |
| --- | --- |
| Paper, a flat creative world in offline mode | `localhost:25569`, RCON on 25575 |
| The Effect UI devtools and their MCP server | `http://127.0.0.1:4774`, MCP at `/mcp` |
| The server's files | `server` in the Minekube home (`~/.minekube`, or `MINEKUBE_HOME`) |

`--accept-eula` accepts the [Minecraft EULA](https://aka.ms/MinecraftEULA) when the server is created. Pass it only if you agree.

The CLI runs the server on a pinned Oracle GraalVM, which it downloads once into the Minekube home. GraalVM JIT-compiles your game's code. `--java` picks another Java, and `--server` another server directory.

## Install your game on every save

In your project, in a second terminal:

```sh
mk dev .
```

`mk dev` does three things:

1. It generates the Paper types of the version `vite.config.ts` names into `types/paper`, as `mk types` does. Your editor, `bun run check` and your tests read them.
2. It builds each bundle `vite.config.ts` names with Vite and writes a Paper bundle to `plugins/Minekube/games/<name>.js` on the dev server. The name is the bundle's name in `vite.config.ts`, which `mk init` takes from the project folder.
3. It watches every file a bundle imports and installs again on every save.

The runtime sees the new file and [swaps the game](https://minekube.com/games/local-development/live-swap) while players stay connected. A project with a `velocity` bundle also gets it installed on the [dev network](https://minekube.com/games/local-development/dev-network). `mk dev` is `vite dev`; see [Vite plugin and configuration](https://minekube.com/games/versions-and-deployments/vite-plugin).

Use one dev server for all your games. Each project installs under its own id, and each game runs in its own context.

## Where Paper's types come from

Nothing of Paper's API ships with Minekube. Your project names its Paper version in `vite.config.ts` (`paper: { version: "26.3" }`), and `mk types` downloads that build from PaperMC and generates its types, without a server: every class from Paper's jars with its real names, overloads and nullability, and Schemas for Java values such as `java.util.UUID`. `mk dev .` runs it first. Never edit `types/paper`; it is replaced on the next generation. See [Platform version](https://minekube.com/games/concepts/platform-version).

Start `mk server` in the project folder, and it runs the version the project names, so the server has what the types promise. Its runtime also writes the types of the server it runs on into `plugins/Minekube/types`, the same ones, byte for byte. `mk dev` says when the dev server last started with another version.

## Read what the runtime says

The runtime reports in the `mk server` terminal and in `logs/latest.log` in the server directory. To also see its messages in chat, prefixed `[games]`, make yourself an operator: type `op <your name>` in the `mk server` terminal.

The [runtime messages reference](https://minekube.com/games/reference/runtime-messages) lists every message and what to do about it. The [devtools](https://minekube.com/games/testing/devtools) show the game's own messages, Commands and Models.

## Play with friends

The dev server listens on your machine only. To let friends join it without an open port, put it in a network you own:

```sh
mk server --join my-network
```

[Let servers in](https://minekube.com/guide/networks/let-servers-in#your-dev-server) explains what this changes.

## Related

- [Live swap](https://minekube.com/games/local-development/live-swap): what happens on a save, and what survives it.
- [CLI reference](https://minekube.com/games/reference/cli#mk-server): every flag of `mk server` and `mk dev`.
