# @moku-labs/editor

> Devtools for a running game: flow, state, render.

## Overview

`@moku-labs/editor` is the devtools for a running `@moku-labs/game`. One tools page shows the
flow, the state, the render and the files of the live game, and lets you change them. It is a dev
dependency: nothing of it ships in a release build.

- **One registry, every surface.** The overlay, the tools page, MCP and a test read the same
  sources and commands.
- **Doors, not hooks.** The editor touches the game only through `@moku-labs/game/inspect` and
  `@moku-labs/game/control`. No private hooks, no engine fork.
- **Edits keep the game state.** A save reloads the game page and restores the bookmark taken just
  before it.

## Install

```sh
bun add -d @moku-labs/editor @moku-labs/game typescript
```

## Quick start

In a moku-game folder, the one with `index.ts` and `config.ts`, run the editor:

```sh
bunx moku-editor --root .
```

It prints the two pages:

```text
Game   http://127.0.0.1:3000/
Tools  http://127.0.0.1:3000/__editor/
Root   /home/dev/timber
```

The engine writes the dev page with the editor's agent on it, so the game needs no HTML file and
no dev entry.

| Flag | Default | What it does |
| --- | --- | --- |
| `--root`, `-r` | `.` | The game folder. |
| `--port`, `-p` | `3000` | Port on `127.0.0.1`. `0` picks a free port. |
| `--no-hmr` | hot reload on | Serves the game without hot reload. |
| `--packed` | loose files | Serves the packed assets of `moku-game pack`. |

> **Note**
>
> The server binds `127.0.0.1` only and checks Host, Origin and a per-start token. It reads and
> writes files only inside the project root.

## Use with Claude Code

`moku-editor mcp` is a stdio MCP server. Register it from the game folder, and Claude can read the
game, run commands and take screenshots:

```sh
claude mcp add moku-editor -- bunx moku-editor mcp
```

## Start with Claude

Describe what you want. The conductor picks the packages.

```text
Build a blog with tags and an RSS feed on @moku-labs/web
```

```text
Add a D1-backed comments API with @moku-labs/worker
```

```text
Make a couch quiz game: TV shows questions, phones answer
```

```text
Ship this app to macOS and iOS
```


Source: https://moku-labs.com/docs/editor/ · @moku-labs/editor@0.10.19
