@fre4x/comfyui 1.1.7 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +70 -33
  2. package/dist/index.js +1706 -1015
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -10,10 +10,14 @@ An MCP server to interact with ComfyUI remotely. Probe server state, inspect nod
10
10
  - `comfyui_save_workflow`: Save a workflow into local `./workflows` with optional edits.
11
11
  - `comfyui_workflow_run`: Run a stored workflow with optional overrides.
12
12
  - `comfyui_wait_for_workflow`: Wait for workflow completion with a timeout.
13
+ - `comfyui_interrupt_workflow`: Interrupt the running job and optionally clear the pending queue.
14
+ - `comfyui_upload_image`: Upload a workspace image into ComfyUI `input` for LoadImage.
15
+ - `comfyui_list_models`: List installed checkpoints, LoRAs, VAEs, UNets, and related files.
13
16
 
14
17
  `comfyui_discover_workflows` filters out non-workflow JSON files and distinguishes
15
18
  between API workflows and Web UI graphs whose conversion was validated against the
16
- live node schema.
19
+ live node schema. Each discovered workflow also includes copy-ready override keys
20
+ when the graph can be normalized.
17
21
 
18
22
  **Do not assume `structuredContent` is what the model actually sees.** Many MCP clients
19
23
  surface `content.text` to the model first and treat `structuredContent` as secondary
@@ -26,6 +30,10 @@ IDs, and recovery hints.
26
30
  ### Environment Variables
27
31
 
28
32
  - `COMFYUI_SERVER_URL`: The URL of your ComfyUI server (default: `http://localhost:8188`).
33
+ - `COMFY_API_KEY`: Optional API key for Comfy Cloud or an authenticated proxy.
34
+ - `COMFY_API_HEADER`: Header name for that key (default: `X-API-Key`; use `Authorization` for Bearer proxies).
35
+ - `COMFYUI_DEFAULT_WORKFLOW`: Optional path, filename, or discover id used when `workflow_ref` is omitted.
36
+ - `COMFYUI_UPLOAD_ROOT`: Extra directory allowed by `comfyui_upload_image` (workspace cwd is always allowed).
29
37
  - `MOCK`: Set to `true` to use mock data instead of a real server.
30
38
 
31
39
  ### Claude Desktop Configuration
@@ -61,71 +69,74 @@ raw graph JSON. Standard Web UI workflow JSON is also accepted and normalized
61
69
  automatically.
62
70
 
63
71
  If you want a single call that submits and waits, pass `await: true` with a
64
- `timeout` value in seconds to `comfyui_workflow_run`. For lower-level control,
65
- use `comfyui_wait_for_workflow` with `prompt_id` and `timeout`.
72
+ short `timeout` (default **25** seconds) to `comfyui_workflow_run`. Host MCP
73
+ clients often cut longer blocking waits — if you get a timeout, call
74
+ `comfyui_wait_for_workflow` again with the same `prompt_id`. For lower-level
75
+ control, set `await: false` then poll wait. Use `comfyui_interrupt_workflow`
76
+ to stop a running job; `clear_queue` defaults to `false`.
66
77
 
67
- `comfyui_workflow_run` accepts either a stored workflow reference
68
- (`workflow_id` / `workflow_file_path`) or an inline `workflow` JSON object.
78
+ `comfyui_workflow_run` accepts a stored workflow reference
79
+ (`workflow_ref`, or the deprecated `workflow_id` / `workflow_file_path` aliases).
80
+ Do not paste full workflow JSON into tool arguments. If
81
+ `COMFYUI_DEFAULT_WORKFLOW` is set, the stored reference may be omitted.
69
82
 
70
83
  ## Stored Workflow Reuse
71
84
 
72
85
  The stored-workflow tools let you avoid re-sending large API JSON blobs and give
73
86
  agents a stable local edit loop.
74
87
 
75
- 1. Save a workflow with `comfyui_save_workflow` into local `./workflows`
88
+ 1. Discover or point at an existing workflow with `workflow_ref`
76
89
  2. Inspect editable paths with `comfyui_get_workflow`
77
- 3. Persist edits with `comfyui_save_workflow` overrides
90
+ 3. Persist edits with `comfyui_save_workflow` + small `overrides`
78
91
  4. Reuse it with `comfyui_workflow_run`
79
92
 
80
- `comfyui_workflow_run` and `comfyui_save_workflow` both accept dot-notation
81
- overrides in canonical `node.inputs.field` form, plus shorter aliases like
82
- `node.seed`, `node.text`, `node.positive_prompt`, and, for Web UI workflows,
83
- `node.widgets[index]`.
93
+ Prefer unique global override keys when the graph has only one of that role:
84
94
 
85
95
  ```json
86
96
  {
87
- "workflow_id": "pony-portrait-v1",
97
+ "workflow_ref": "pony-portrait-v1",
88
98
  "overrides": {
89
- "2.seed": 67890,
90
- "6.positive_prompt": "cinematic dragon portrait"
99
+ "positive_prompt": "cinematic dragon portrait",
100
+ "seed": 67890
91
101
  },
92
102
  "await": true,
93
103
  "timeout": 90
94
104
  }
95
105
  ```
96
106
 
97
- If your client serializes nested arguments first, `overrides` may also be sent
98
- as a JSON string:
107
+ Node-scoped aliases still work: `2.seed`, `6.positive_prompt`,
108
+ `node.inputs.field`, and Web UI `node.widgets[index]`. If a global key is
109
+ ambiguous, the error lists the valid node-scoped paths.
99
110
 
100
- ```json
101
- {
102
- "workflow_id": "pony-portrait-v1",
103
- "overrides": "{\"2.seed\":67890,\"6.positive_prompt\":\"cinematic dragon portrait\"}"
104
- }
105
- ```
111
+ `overrides` must be a small JSON **object** (never a stringified blob, never a
112
+ full graph).
106
113
 
107
114
  To inspect editable inputs and semantic hints for agent editing:
108
115
 
109
116
  ```json
110
117
  {
111
- "workflow_id": "pony-portrait-v1",
118
+ "workflow_ref": "pony-portrait-v1",
112
119
  "include_prompt": false
113
120
  }
114
121
  ```
115
122
 
123
+ Pass `verbose: true` when you need every editable input rather than the
124
+ high-signal subset.
125
+
116
126
  `comfyui_get_workflow` and `comfyui_save_workflow` both return:
117
127
 
118
- - `high_signal_inputs`: the most useful prompt/model/sampler controls first
128
+ - `editable_inputs`: high-signal controls by default (full list with `verbose: true`)
129
+ - values are truncated to `value_preview` unless `verbose: true`
119
130
  - `input_groups`: grouped counts for prompts, models, sampling, output, etc.
120
131
  - combo-backed inputs include `options_count`, `options_preview`, and `options_truncated`
121
- - `override_examples`: copy-ready payloads using the preferred override aliases
132
+ - `preferred_override_paths` / truncated `override_examples` for copy-ready keys
122
133
 
123
- These appear in both `content.text` and `structuredContent` so agents can steer
124
- complex workflows without having to scan every literal widget first.
134
+ `comfyui_discover_workflows` returns `override_keys` only (no prompt values).
125
135
 
126
- When `comfyui_wait_for_workflow` times out, the error now includes a queue
127
- snapshot in both `content.text` and `structuredContent` to show whether the
128
- prompt is still pending or has disappeared from the server queue.
136
+ `comfyui_wait_for_workflow` returns at most `max_images` native images
137
+ (default **2**, preferring `output` over `temp`). All outputs remain listed in
138
+ `image_refs` with `source_type`/`subfolder` for `comfyui_upload_image`.
139
+ Structured content omits the raw history prompt graph.
129
140
 
130
141
  `comfyui_workflow_run` also performs a preflight pass against the live
131
142
  `/object_info` schema before submission so invalid combo-backed values such as
@@ -136,12 +147,38 @@ To save a new or edited workflow locally:
136
147
 
137
148
  ```json
138
149
  {
139
- "workflow_file_path": "pony-portrait-v1.json",
150
+ "workflow_ref": "pony-portrait-v1.json",
140
151
  "overrides": {
141
- "6.text": "studio lighting, ultra detailed",
142
- "7.filename_prefix": "pony-portrait-agent"
152
+ "positive_prompt": "studio lighting, ultra detailed",
153
+ "filename_prefix": "pony-portrait-agent"
143
154
  },
144
155
  "output_file_name": "pony-portrait-agent.json",
145
156
  "overwrite": true
146
157
  }
147
158
  ```
159
+
160
+ ## Image upload
161
+
162
+ Image bytes never pass through the model. Provide exactly one reference:
163
+
164
+ 1. Previous run: `prompt_id` + `filename` from `image_refs` / wait text. The server copies ComfyUI output into `input`.
165
+ 2. Workspace file: `file_path`.
166
+
167
+ ```json
168
+ {
169
+ "prompt_id": "77777777-7777-7777-7777-777777777777",
170
+ "filename": "ComfyUI_00001_.png"
171
+ }
172
+ ```
173
+
174
+ ```json
175
+ {
176
+ "file_path": "/path/in/workspace/source.png",
177
+ "filename": "source.png"
178
+ }
179
+ ```
180
+
181
+ The tool returns the LoadImage filename to use in `overrides`. `file_path`
182
+ uploads stay inside the workspace (and optional `COMFYUI_UPLOAD_ROOT`).
183
+ `prompt_id` sources are read from the previous run's workspace copy or
184
+ ComfyUI `/view`.