easel
# easel
Turn an idea from a chat into an image, through your own ComfyUI.
easel is an MCP server plus an agent skill. The agent imagines the scene, writes the
prompt and judges the result. easel gives it the three things it cannot do alone:
the prompt rules of the image model, a render through your workflow, and the image
back to look at.
Status: early. Renders against a real ComfyUI (a Runpod pod) work, and the Anima guide
was corrected from those renders. Only a handful of prompts have been tried, and the
skill has not yet been exercised end to end by an agent.
## How it fits together
| Part | Where | What it holds |
|---|---|---|
| Skill | `skills/generate-image/` | The working loop: when to ask, the scene sheet, rendering, comparing, revising. Names no model. |
| Skill | `skills/setup-environment/` | Getting a ComfyUI ready: build and publish the model config, create or start a cloud pod, connect, prove it with a test render, put it away. |
| Model package | `models/<name>/` | `guide.md` (how to prompt this model), `model.yaml` (slots, sizes, params), and the workflow. |
| Server | `src/easel/` | Loads the package, fills the workflow's slots, talks to ComfyUI over HTTP, stores generations. |
| Tag tools | [mcp-danbooru-characters](https://github.com/tcpassos/mcp-danbooru-characters) | A separate MCP server the plugin registers next to easel: checking and finding Danbooru tags, and looking up characters (filtered to appearance and ordinary clothing). A package names the vocabulary it uses (`vocabulary: danbooru`); a prose-only model names none. |
Supporting another image model means adding a folder under `models/`. No server code
changes.
## Tools
| Tool | Purpose |
|---|---|
| `get_guide` | Start here: the model's prompt guide, sizes and params |
| `render` | Render one image; returns the file path, the seed and a preview |
| `get_generation` | Collect a slow render, or reopen an earlier generation with its prompt and scene |
| `check_environment` | Verify the package loads, ComfyUI answers and the workflow's nodes are installed; also reports what a machine needs to run the model |
| `connect` | Point easel at another ComfyUI, effective immediately and remembered across restarts |
| `list_library` | List the files ComfyUI can load for one library kind (models, LoRAs) |
| `list_generations` | List earlier renders, newest first, to find one by id |
| `install_file` | Download a `.safetensors` file by link (huggingface.co, civitai.com) into ComfyUI's folder for a library kind. A model file must have the default model's weight layout, or it is refused. Only when easel shares ComfyUI's disk (`EASEL_COMFYUI_MODELS_DIR`) |
| `use_file` | Make an installed file (such as another version of the image model) the one every later render uses; with no name, back to the package default. Stored in the data directory |
## Setup
Requires Python 3.12+, [uv](https://docs.astral.sh/uv/) and a running ComfyUI.
```bash
uv sync --extra dev
uv run pytest
```
Use it from Claude Code as a plugin, loading this folder:
```bash
claude --plugin-dir .
```
Or register only the MCP server in any MCP client:
```json
{ "command": "uv", "args": ["run", "--project", "/path/to/easel", "python", "-m", "easel.server"] }
```
## Configuration
All through environment variables.
| Variable | Default | Meaning |
|---|---|---|
| `EASEL_COMFYUI_URL` | `http://127.0.0.1:8188` | Where ComfyUI answers by default. The `connect` tool overrides it at runtime |
| `EASEL_COMFYUI_AUTH` | empty | Value of the `Authorization` header, e.g. `Bearer <token>`. For a ComfyUI exposed on the internet |
| `EASEL_MODEL` | `anima` | Which folder under `models/` is active |
| `EASEL_MODELS_DIR` | `<repo>/models` | Where model packages live |
| `EASEL_DATA_DIR` | `<repo>/data` | Where images and generation records are written |
| `EASEL_RENDER_WAIT` | `100` | Seconds one tool call waits before returning a "running" generation |
| `EASEL_TRANSPORT` | `stdio` | `stdio`, or `http` to serve streamable HTTP for a client on another machine |
| `EASEL_HTTP_HOST` | `127.0.0.1` | Address the HTTP server binds to. Anything but loopback requires a token |
| `EASEL_HTTP_PORT` | `8765` | Port of the HTTP server; the endpoint is `/mcp` |
| `EASEL_HTTP_TOKEN` | empty | Bearer token every HTTP request must carry, at least 24 characters |
| `EASEL_PUBLIC_URL` | empty | Address the HTTP server is reached at from outside. When set, results carry a signed `image_url` |
| `EASEL_COMFYUI_MODELS_DIR` | empty | ComfyUI's `models` folder, when easel runs on the same disk (e.g. `/workspace/models`). Turns on `install_file`; unset, it answers that it is not available |
| `EASEL_INSTALL_MAX_MB` | `8192` | Largest file `install_file` downloads |
| `HF_TOKEN`, `CIVITAI_TOKEN` | empty | Tokens `install_file` sends to huggingface.co and civitai.com (gated or login-only files). Read from the environment only, never taken from chat |
### Remote ComfyUI
A ComfyUI reachable from the internet (a cloud pod behind a proxy URL) lets anyone
with the address queue workflows and run custom-node code on that machine. Put it
behind a proxy that checks a credential, and give easel the same credential in
`EASEL_COMFYUI_AUTH`. Keep it in your environment, not in chat or in a committed file.
easel sends the credential only over HTTPS, or over plain HTTP to this machine.
easel waits for renders by polling with short requests, so proxies that cut long
connections (such as a 100-second limit) do not interrupt it.
### Serving over HTTP
By default the MCP client starts easel and talks to it over stdio. To run easel on
another machine, such as a cloud pod next to ComfyUI, serve it over streamable HTTP:
```bash
export EASEL_TRANSPORT=http EASEL_HTTP_HOST=0.0.0.0 EASEL_HTTP_PORT=8765
export EASEL_HTTP_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
export EASEL_COMFYUI_URL=http://127.0.0.1:8188 EASEL_DATA_DIR=/workspace/easel-data
uv run --project /path/to/easel python -m easel.server
```
The client connects to `http://<host>:8765/mcp` and sends `Authorization: Bearer <token>`.
Anyone who reaches the endpoint can queue renders, so easel refuses to bind to a
non-loopback address without a token. With easel on the same machine as ComfyUI,
ComfyUI's own port need not be exposed at all. The alternative to a token is binding to
`127.0.0.1` and reaching the server through an SSH tunnel.
Behind a plain-HTTP port the token travels in clear; put the endpoint behind HTTPS
(the Runpod proxy URL is HTTPS) or a tunnel.
With `EASEL_PUBLIC_URL` set (for example `https://<pod-id>-8765.proxy.runpod.net`),
`render`, `get_generation` and `list_generations` also return an `image_url` that serves
the full image from `/images/<file>`. A browser cannot send the bearer header, so each
URL carries its own signature, `?sig=`, an HMAC of the file name under a key derived
from the token. It reveals nothing about the token, and changing the token revokes
every URL handed out before. A URL does not expire on its own.
The server keeps one ComfyUI address, one model and one data directory for everyone
connected: `connect` from one client changes it for all. Serve one user per process.
## A model package
```
models/anima/
model.yaml slots, params, sizes, whether the model takes a negative prompt
guide.md how to write a prompt for this model
generate.json your workflow, exported from ComfyUI with "Export (API)"
comfyforge.json the model files (and custom nodes) a machine must install to run it
```
A slot says where a value enters the workflow, in one of three forms:
```yaml
slots:
positive: "67.value" # node id and input
negative: { class_type: Text, input: value, title: NEGATIVE } # anchor by node type
seed: ["3.seed", "9.noise_seed"] # the same value in several nodes
```
A package is validated when it loads: a missing required slot, a slot that matches no
node, or an empty guide stops the server with a message naming the problem.
To use your own workflow, replace `generate.json`, point the slots at the nodes that
hold each literal value, and run `check_environment`.
## Tags: the mcp-danbooru server
easel renders; it does not know any tag. For a tag-trained model such as Anima, the
plugin also registers [mcp-danbooru-characters](https://github.com/tcpassos/mcp-danbooru-characters)
(`.mcp.json`, server `danbooru`), which serves `check_tags`, `search_tags`,
`suggest_tags`, the character lookups and related tags. Its character descriptions are
filtered to appearance and ordinary clothing. The model guide and the generate-image
skill name those tools; without that server the agent writes the tags it is sure of
and says the rest in plain language.
## License
MIT. See [LICENSE](LICENSE).
TDQS
Scored across 9 tools
Each tool has a distinct role: prompting guidance, rendering, generation retrieval/listing, environment setup/checking, and library file management. Related pairs like connect/check_environment and list_generations/get_generation are clearly differentiated by their descriptions.
Most names follow a clear verb_noun pattern such as get_guide, list_generations, check_environment, install_file, and use_file. The bare verbs connect and render are minor deviations but remain natural and readable in context.
Nine tools is well-scoped for an image-generation server that must cover prompting, rendering, history, environment setup, and model/LoRA file management. Each tool earns its place without obvious redundancy.
The surface covers the core lifecycle: guide, connection, readiness check, render, retrieve/list generations, and list/install/use library files. Minor gaps remain, such as deleting generations or uninstalling library files, but core workflows are fully supported.