Skip to main content
Glama
README.md
# Atelier

A painting studio that an AI agent drives over [MCP](https://modelcontextprotocol.io), with a live browser UI that replays every stroke as if it were drawn by hand with a pen.

![Moonlit Lake, painted entirely through the MCP tools](examples/moonlit-lake.png)

*"Moonlit Lake": painted end to end by an agent through Atelier's MCP tools.*

## What it is

The server renders everything with Skia (`@napi-rs/canvas`). Every change is sent to the browser as a composite patch plus an animation descriptor (stroke polyline, shape outline, fill origin...). The UI reveals the patch progressively along that path with a pen cursor, so you watch the painting being built stroke by stroke, and the final frame is pixel-identical to the server render.

- **Brush engine**: dab, ribbon, bristle, smudge, filter and pixel brushes; 17 tips, grain textures, wet edges, glow, pressure curves, jitter, and 41 presets (pencil, ink, calligraphy, watercolor, gouache, oil, charcoal, airbrush, foliage, fur, neon, smudge, dodge/burn, eraser...). Custom brushes can be saved with `define_brush`.
- **Filters**: 29 filters (blur, motion/zoom blur, curves, levels, gradient map, glow/bloom, drop shadow, outline, warp, kuwahara, chromatic aberration...).
- **Shapes and text**: vector shapes from primitives or SVG path strings, with fill/stroke or a hand-drawn brush outline; text with fonts and text-on-path.
- **Fill and selections**: flood fill; gradients and patterns; selections (rect, ellipse, polygon, lasso, path, magic wand, color range, layer alpha) with feather/grow/shrink/border/smooth/invert.
- **Layers**: 17 blend modes, opacity, clipping, alpha lock, masks, transforms, merge, duplicate, canvas resize, image import.
- **History**: copy-on-write undo/redo (one tool call, or one whole script, is one step), autosaved projects and a timelapse log.
- **Inspection for the agent**: `snapshot` (with grid, marks, grayscale or flip), `sample_colors`, `analyze` (palette and value histogram), and `ui_screenshot` of the live UI via headless Chrome.
- **Scripting**: `batch` many tool calls at once, or `run_script` in a sandbox with helpers (`rand`, `gauss`, `noise`, `fbm`, `hsl`, `mix`, ...) for procedural work.

## Tools

`new_canvas`, `canvas_settings`, `get_state`, `open_ui`, `stroke`, `shape`, `text`, `fill`, `import_image`, `select`, `filter`, `add_layer`, `update_layer`, `delete_layer`, `duplicate_layer`, `merge_layers`, `clear_layer`, `transform_layer`, `layer_mask`, `list_brushes`, `define_brush`, `snapshot`, `ui_screenshot`, `sample_colors`, `analyze`, `undo`, `redo`, `history`, `note`, `export_image`, `save_project`, `load_project`, `list_projects`, `batch`, `run_script`.

The server also ships MCP instructions that explain the workflow to the agent; `list_brushes` documents every brush parameter.

## Install

Requires Node.js 20+ and, for `ui_screenshot` / auto-opening the UI, Google Chrome (or Chromium).

```sh
git clone https://github.com/Baklawaa/atelier.git
cd atelier
npm install
```

## Use with an MCP client

Point your client at `src/server.js` over stdio. Examples:

**maki** (`~/.config/maki/mcp.toml`)

```toml
[mcp.atelier]
command = ["node", "/path/to/atelier/src/server.js"]
timeout = 120000
```

**Claude Desktop / Claude Code / other JSON configs**

```json
{
  "mcpServers": {
    "atelier": { "command": "node", "args": ["/path/to/atelier/src/server.js"] }
  }
}
```

Painting tools can take a while on large canvases, so give the client a generous tool timeout.

When the agent calls `new_canvas` or `open_ui`, the studio opens at `http://127.0.0.1:7878`. The page shows the canvas, layers, history and the agent's notes, and animates strokes in real time. Add `?speed=instant` to skip the animation or `?panels=0` to show only the canvas.

### Configuration

| Variable | Default | Purpose |
| --- | --- | --- |
| `ATELIER_PORT` | `7878` | UI/HTTP port (tries the next one if busy) |
| `ATELIER_HOST` | `127.0.0.1` | Bind address |
| `ATELIER_HOME` | `~/.atelier` | Projects, snapshots, saved brushes |
| `ATELIER_AUTO_OPEN` | `1` | Set to `0` to stop the UI from opening automatically |
| `ATELIER_CHROME` | auto-detected | Path to a Chrome/Chromium binary |

HTTP endpoints: `/api/export.png`, `/api/state`, `/api/timelapse`.

Run only the UI server (no MCP) for manual testing:

```sh
node src/server.js --standalone
```

## Tests

```sh
npm test               # smoke test over MCP
node test/features.js  # layers, selections, masks, filters, batch, projects
node test/live.js      # real-speed UI run + pixel comparison with the server render
node test/demo.js      # paints the Moonlit Lake demo into ~/.atelier
```

## Layout

```
src/server.js     MCP entry (stdio) / --standalone UI server
src/studio.js     transactions, undo, broadcast, autosave, HTTP + WebSocket
src/tools.js      MCP tool definitions and schemas
src/inspect.js    snapshot, color sampling, analysis, UI screenshots
src/engine/       brushes, filters, shapes/text/fill/selection ops, compositor
ui/               browser viewer and stroke animator
test/             end-to-end tests and the demo painting
```

## License

MIT

TDQS

B3.1/5.0

Scored across 35 tools

Disambiguation4/5

Most tools target a distinct object+action (stroke/shape/text/fill, and a clean layer family). The genuinely confusable pairs are batch vs. run_script (both scripted multi-operation execution) and snapshot vs. ui_screenshot (canvas render vs. browser chrome), but their descriptions make the distinction explicit. filter vs. fill and analyze vs. sample_colors are close in flavor yet clearly separated by purpose.

Naming Consistency3/5

Layer and project tools follow a predictable verb_noun pattern (add_layer, duplicate_layer, merge_layers, list_projects, load_project), but painting primitives use bare single words (stroke, shape, text, fill, select, filter) and a few names invert the pattern (open_ui vs. ui_screenshot, snapshot, batch). The families are internally consistent and readable, so it's mixed conventions rather than chaos.

Tool Count3/5

35 tools is heavy for an agent to scan, but the domain is a full raster/vector painting app with scripting, so almost every tool maps to a real capability. Nothing looks like filler (note, history, undo/redo, ui_screenshot all serve the agent's verification loop), yet the sheer surface imposes a real selection burden.

Completeness4/5

Coverage is unusually thorough: canvas lifecycle, full layer stack with masks and blend modes, selections, brushes, filters, text/shapes, import/export, undo/redo history, save/load, plus visual verification (snapshot, ui_screenshot, analyze, sample_colors). The main gap is project management — projects can be listed and loaded but not renamed or deleted — a minor dead end agents can work around.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues