# ComfyUI Mobile UI – Workflow Endpoints This is a small ComfyUI custom node that adds HTTP endpoints for a standalone client (like the mobile UI in this repo) to: - **List** workflow `.json` files stored on the ComfyUI machine - **Fetch** a workflow JSON - **Fetch an API-compatible prompt JSON** for a workflow (either already API prompt, or converted via an optional converter endpoint) - **Convert posted workflow JSON** into an API prompt JSON ## Endpoints - `GET /mobileui/info` - Returns version + detected workflow directories + endpoint hints. - `GET /mobileui/workflows` - Returns an array of objects: - `name` (string): workflow name / relative path without `.json` - `bytes` (number|null): file size - `mtime` (number|null): modified time (unix seconds) - `GET /mobileui/workflows/{name}` - Returns the raw workflow JSON file. - `{name}` may include subfolders and may optionally include `.json`. - `GET /mobileui/workflows_api/{name}` - Returns an **API prompt JSON**. - Behavior: 1) If the JSON already looks like an API prompt (contains `class_type` entries), it is returned as-is. 2) Otherwise, the node tries to POST the workflow JSON to `POST /workflow/convert`. - This requires the optional converter extension: https://github.com/SethRobinson/comfyui-workflow-to-api-converter-endpoint - `POST /mobileui/convert` - Accepts any workflow JSON payload in the request body and returns an API prompt JSON. - Uses the same conversion rules as `workflows_api`. - `OPTIONS /mobileui/{tail:.*}` - CORS preflight helper. ## Install Copy the folder `comfyui_mobileui_workflow_list_endpoint` into: `ComfyUI/custom_nodes/` Then restart ComfyUI. ## CORS This node can add CORS headers itself if you set: - `MOBILEUI_CORS_ORIGIN=http://localhost:5173` (or `*`) You can also use ComfyUI's built-in CORS flag if you prefer. ## Configuration By default, it scans common locations relative to the ComfyUI root: - `/workflows` - `/user/workflows` - `/examples` - `/examples/workflows` - `/pysssss-workflows` (used by ComfyUI-Custom-Scripts) You can override/add workflow directories with environment variables: - `COMFY_WORKFLOWS_DIR=/path/to/workflows` - `COMFY_WORKFLOWS_DIRS=/path/one,/path/two` ## Notes - Includes basic path traversal protection. - Only serves files ending in `.json`. - Conversion requires `POST /workflow/convert` to exist.