scene-editor-mcp
# scene-editor-mcp
An MCP server that lets AI clients such as Claude Code and Claude Desktop drive a [SceneEditor](https://github.com/VJigouline/SceneEditor) open in the browser: open models from the internet or from disk, list and inspect objects, move, hide and remove them, fit the view, and take screenshots.
SceneEditor runs in a browser tab, so it can't be an MCP server itself. This package is the **bridge**: the client starts it as a stdio MCP server, and the editor, opened with the link the bridge gives, connects to it over a WebSocket on `127.0.0.1`. The design is in CommonDocuments, `scene-editor/mcp-bridge.md`.
## Setting it up
Claude Code:
```powershell
claude mcp add scene-editor -- npx -y github:VJigouline/scene-editor-mcp
```
Claude Desktop, in `claude_desktop_config.json`:
```json
{
"mcpServers": {
"scene-editor": { "command": "npx", "args": ["-y", "github:VJigouline/scene-editor-mcp"] }
}
}
```
Then ask the assistant to open SceneEditor. Its `open_editor` tool opens the editor in your default browser, paired with the bridge. A strip at the bottom of the editor says it is controlled by an AI assistant, with a **Disconnect** button.
## Options
| Option | Default | |
| --- | --- | --- |
| `--port <n>` | 7777, or the next free port up to 7786 | Where the editor connects |
| `--editor-url <url>` | `https://scene.meercad.com/` | The SceneEditor `open_editor` opens, such as `http://localhost:4200/` |
| `--allow-origin <url>` | | Another address SceneEditor is served from; may be repeated |
| `--root <folder>` | The current folder | A folder `load_file` may read; may be repeated |
Pass them after the package name, as in `npx -y github:VJigouline/scene-editor-mcp --root C:\Models`.
## Tools
| Tool | What it does |
| --- | --- |
| `status` | Whether an editor is connected, and the link that opens one |
| `open_editor` | Opens SceneEditor in the browser and waits up to a minute for it to connect |
| `load_model` | Opens a model from a web address, with the files a glTF or OBJ file references |
| `load_file` | Opens a model from disk, with its buffers, materials and textures, or with `include_folder`, its whole folder |
| `list_objects` | The scene tree: names, uuids, types, paths, visibility and bounding boxes |
| `get_object` | An object's transform, bounding box, materials, vertex and triangle counts |
| `set_transform` | Position, rotation in degrees and scale, absolute or relative |
| `set_visible` | Shows or hides an object |
| `remove_object` | Removes an object; SceneEditor has no undo |
| `fit_view` | Fits the camera to an object or to the whole scene |
| `screenshot` | The 3D view as a PNG or JPEG image |
Objects are named by `{ "uuid": … }`, `{ "name": … }` or `{ "path": "Duck/#0" }`. A path step is a name, or `#n` for the nth child when names are missing or repeated.
## Security
- The bridge listens on `127.0.0.1` only.
- It accepts connections only from SceneEditor's own addresses, plus `--editor-url` and `--allow-origin`.
- Each start makes a new pairing token, which goes in the link's fragment (`#mcp=7777:…`), never to a web server. The editor removes it from the address bar.
- After 5 wrong tokens the bridge refuses every new connection until it is restarted.
- `load_file` reads only inside the `--root` folders, following links.
Chrome may ask once whether `scene.meercad.com` may reach devices on your computer; allow it for the bridge to work. Safari hasn't been tested.
## Development
```powershell
npm install
npm test
npm run build
```
`scripts/e2e.mjs` drives a real editor through every tool, as a client would, and saves the screenshots:
```powershell
node scripts/e2e.mjs --editor-url http://localhost:4300/SceneEditor/ --out screenshots
```
It prints the link to open, waits for the editor, and exits non-zero if a step fails. `--open` opens the link itself.
`src/protocol.ts` holds the messages both sides send. SceneEditor imports it as `scene-editor-mcp/protocol`, so a change there needs a matching SceneEditor change.
TDQS
Scored across 11 tools
Most tools have clearly distinct resource+action targets (list_objects vs get_object vs set_transform vs set_visible). The main overlap is load_model vs load_file, which both open a model in the editor and differ only by source (URL vs local path), and a mild overlap between status and open_editor since status also returns the link that opens an editor. Descriptions do disambiguate these in practice.
Nine of eleven tools follow a clean snake_case verb_noun pattern (load_model, list_objects, get_object, set_transform, set_visible, remove_object, fit_view, open_editor). The two outliers, 'screenshot' and 'status', are bare nouns rather than verb_noun, but they are short, conventional, and unambiguous.
Eleven tools is well within the ideal 3-15 range and each one maps to a concrete capability: connection lifecycle, scene loading, inspection, manipulation, and capture. Nothing looks like filler or an accidental duplicate.
The surface covers connection (status/open_editor), ingestion (load_model/load_file), inspection (list_objects/get_object/screenshot/fit_view), and mutation (set_transform/set_visible/remove_object), so core workflows are closed. Gaps remain: no object creation/primitive add, no rename or duplicate, no reparenting, and no material editing despite materials being reported by get_object.