comfyui-mcp 0.26.3 → 0.26.5

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.
@@ -25,6 +25,13 @@ class QueueMonitorImpl {
25
25
  url = null;
26
26
  stopped = false;
27
27
  reconnectTimer = null;
28
+ // Generation start/end transition hooks (for the Ollama VRAM pause). Fired on
29
+ // the idle→running edge and the running→idle edge, best-effort (a throwing
30
+ // handler must never break the monitor). `busy` is our own edge-tracking flag,
31
+ // distinct from runningPromptId (which flips null between backlogged prompts).
32
+ busy = false;
33
+ onRunStart = null;
34
+ onRunEnd = null;
28
35
  state = {
29
36
  connected: false,
30
37
  runningPromptId: null,
@@ -42,6 +49,45 @@ class QueueMonitorImpl {
42
49
  this.stopped = false;
43
50
  this.connect();
44
51
  }
52
+ /** Register generation-transition handlers (idempotent overwrite). Called by
53
+ * the orchestrator to unload/warm the local Ollama model around renders. */
54
+ setTransitionHandlers(h) {
55
+ this.onRunStart = h.onRunStart ?? null;
56
+ this.onRunEnd = h.onRunEnd ?? null;
57
+ }
58
+ emitStart() {
59
+ if (this.busy)
60
+ return;
61
+ this.busy = true;
62
+ try {
63
+ this.onRunStart?.();
64
+ }
65
+ catch (err) {
66
+ logger.debug(`[queue-monitor] onRunStart threw: ${err instanceof Error ? err.message : String(err)}`);
67
+ }
68
+ }
69
+ emitEndIfIdle() {
70
+ // Only truly idle when nothing is running AND the queue is drained — between
71
+ // backlogged prompts runningPromptId briefly clears but queueRemaining stays
72
+ // positive, and we must NOT warm the model just to unload it again.
73
+ if (!this.busy)
74
+ return;
75
+ if (this.state.runningPromptId !== null)
76
+ return;
77
+ if (this.state.queueRemaining > 0)
78
+ return;
79
+ this.busy = false;
80
+ try {
81
+ this.onRunEnd?.();
82
+ }
83
+ catch (err) {
84
+ logger.debug(`[queue-monitor] onRunEnd threw: ${err instanceof Error ? err.message : String(err)}`);
85
+ }
86
+ }
87
+ /** Is a generation currently in flight (edge-tracked)? */
88
+ isBusy() {
89
+ return this.busy;
90
+ }
45
91
  stop() {
46
92
  this.stopped = true;
47
93
  if (this.reconnectTimer)
@@ -131,8 +177,13 @@ class QueueMonitorImpl {
131
177
  const status = data.status;
132
178
  const execInfo = status?.exec_info;
133
179
  const qr = execInfo?.queue_remaining;
134
- if (typeof qr === "number")
180
+ if (typeof qr === "number") {
135
181
  this.state.queueRemaining = qr;
182
+ // A status frame arriving with an empty queue after a run is the
183
+ // authoritative "fully idle" signal — flush a pending end transition.
184
+ if (qr === 0)
185
+ this.emitEndIfIdle();
186
+ }
136
187
  break;
137
188
  }
138
189
  case "execution_start": {
@@ -141,6 +192,7 @@ class QueueMonitorImpl {
141
192
  this.state.progressValue = null;
142
193
  this.state.progressMax = null;
143
194
  this.touchActivity();
195
+ this.emitStart();
144
196
  break;
145
197
  }
146
198
  case "executing": {
@@ -148,6 +200,7 @@ class QueueMonitorImpl {
148
200
  if (node === null || node === undefined) {
149
201
  // ComfyUI sends node:null at the end of a prompt's execution.
150
202
  this.clearRunning();
203
+ this.emitEndIfIdle();
151
204
  }
152
205
  else {
153
206
  const n = String(node);
@@ -176,6 +229,7 @@ class QueueMonitorImpl {
176
229
  case "execution_error":
177
230
  case "execution_interrupted": {
178
231
  this.clearRunning();
232
+ this.emitEndIfIdle();
179
233
  break;
180
234
  }
181
235
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"queue-monitor.js","sourceRoot":"","sources":["../../src/services/queue-monitor.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,gFAAgF;AAChF,kFAAkF;AAClF,iFAAiF;AACjF,iFAAiF;AACjF,uEAAuE;AACvE,EAAE;AACF,2EAA2E;AAC3E,+EAA+E;AAC/E,gFAAgF;AAChF,gFAAgF;AAChF,2EAA2E;AAC3E,+EAA+E;AAC/E,4BAA4B;AAC5B,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,4BAA4B;AAE5B,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,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,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YACzD,CAAC,CAAC,IAAI,CAAC;QACX,OAAO;YACL,OAAO;YACP,OAAO,EAAE,UAAU,GAAG,CAAC;YACvB,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe;YAC3C,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;YACnC,UAAU;YACV,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACnC,QAAQ;SACT,CAAC;IACJ,CAAC;CACF;AAED,6DAA6D;AAC7D,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comfyui-mcp",
3
- "version": "0.26.3",
3
+ "version": "0.26.5",
4
4
  "mcpName": "io.github.artokun/comfyui-mcp",
5
5
  "description": "Local-first, agent-native control plane for ComfyUI — MCP server + autonomous sidebar agent that drives your live graph in natural language on ANY LLM: Claude/ChatGPT/Gemini on your subscription (no API key), free local models via Ollama (fully offline), or any hosted model via an OpenAI-compatible endpoint (DeepSeek, GLM, MiMo, OpenRouter). Generate images, video & audio, author and run workflows, manage models and custom nodes; a compact tool-router mode keeps even 4B models effective, and a built-in LLM Arena benchmarks them on real ComfyUI tasks. Also a Claude Code plugin with skills, slash commands, and installer packs. Local, LAN, VPS, or Comfy Cloud.",
6
6
  "homepage": "https://comfyui-mcp.artokun.io/docs",
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: local-llm-free
3
+ description: Run the ComfyUI agent locally for FREE — no subscription, no API key, fully offline — using our gemma4 models fine-tuned on the comfyui-mcp tool suite via Ollama. Use when the user asks about running locally, running for free, offline use, avoiding API costs, Ollama setup, or which local model to pick.
4
+ ---
5
+
6
+ # Run the agent locally for free (Ollama + our fine-tuned models)
7
+
8
+ The answer to "can I run this for free / offline / without an API key" is
9
+ **yes**: the panel's Ollama backend drives the full live-canvas agent on a
10
+ local model — and we ship models **fine-tuned specifically for comfyui-mcp**.
11
+
12
+ ## Why these models (say this when recommending them)
13
+
14
+ `artokun/gemma4-comfyui-mcp` is Google's Gemma 4 QLoRA-fine-tuned on **1,055
15
+ server-verified tool-use trajectories** generated against a live ComfyUI —
16
+ covering the **full 178-tool surface** (113 MCP tools + 65 panel live-canvas
17
+ tools). The model has *seen this exact tool suite in training*, so tool
18
+ selection and argument formatting are dramatically more reliable than a stock
19
+ model meeting the catalog cold. Free to use, weights + adapters + training
20
+ data are open (HF: `artokun/gemma4-comfyui-mcp`,
21
+ dataset `artokun/comfyui-mcp-trajectories`).
22
+
23
+ ## Setup (2 steps)
24
+
25
+ 1. **Install Ollama** if missing: https://ollama.com/download
26
+ (macOS/Windows installers, or `curl -fsSL https://ollama.com/install.sh | sh` on Linux).
27
+ 2. **Pull the rung that fits the user's GPU:**
28
+
29
+ ```bash
30
+ ollama pull artokun/gemma4-comfyui-mcp:e4b # DEFAULT — ~3.5 GB VRAM (q4)
31
+ ollama pull artokun/gemma4-comfyui-mcp:e2b # smallest — ~2 GB VRAM
32
+ ollama pull artokun/gemma4-comfyui-mcp:12b # strongest — ~8 GB VRAM
33
+ ```
34
+
35
+ Then in the ComfyUI sidebar panel: backend picker → **Ollama (local)** →
36
+ Connect. `:e4b` is the built-in default — zero further config once pulled.
37
+ (Override via the panel's model picker or `COMFYUI_MCP_OLLAMA_MODEL`.)
38
+
39
+ ## Sizing guidance
40
+
41
+ | GPU VRAM free | Recommend |
42
+ | --- | --- |
43
+ | ~2-3 GB | `:e2b` — note it reasons verbosely; it needs generous token budgets |
44
+ | ~4-7 GB | `:e4b` (the default sweet spot) |
45
+ | 8 GB+ | `:12b` |
46
+
47
+ ## Expectations to set
48
+
49
+ - Local models keep **tool calling** but have limited/no **vision** — the
50
+ agent generates and edits workflows fine but can't visually critique its
51
+ own outputs. Thinking is present but modest; harder multi-stage graph
52
+ builds may need a nudge.
53
+ - First request after connect is slow (cold model load, 30s+). That's normal.
54
+ - For non-panel MCP harnesses (Hermes, OpenClaw, any Ollama-speaking client),
55
+ pair these models with **compact tool mode** (`--compact`) — full docs:
56
+ https://comfyui-mcp.artokun.io/docs/local-llms