comfyui-mcp 0.50.93 → 0.50.94
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.
- package/dist/boot.js +392 -0
- package/dist/boot.js.map +1 -0
- package/dist/experimental/run.js +1 -1
- package/dist/experimental/run.js.map +1 -1
- package/dist/index.js +25 -388
- package/dist/index.js.map +1 -1
- package/dist/tools/introspect.js +1 -1
- package/dist/utils/broken-install.js +115 -0
- package/dist/utils/broken-install.js.map +1 -0
- package/dist/utils/origin.js +16 -5
- package/dist/utils/origin.js.map +1 -1
- package/package.json +1 -1
package/dist/boot.js
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
3
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { ListPromptsRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
6
|
+
import { collectToolCatalog, registerFullTools } from "./tools/index.js";
|
|
7
|
+
import { registerCompactTools } from "./tools/compact.js";
|
|
8
|
+
import { tryInstallRetiredNameRedirect } from "./tools/retired-redirect.js";
|
|
9
|
+
import { logger } from "./utils/logger.js";
|
|
10
|
+
import { JobWatcher } from "./services/job-watcher.js";
|
|
11
|
+
import { parseCliArgs, validateConnectUrl, exportExplicitToolMode } from "./transport/cli.js";
|
|
12
|
+
import { startHttpServer } from "./transport/http.js";
|
|
13
|
+
import { isLocalMode } from "./config.js";
|
|
14
|
+
import { ensurePanelInstalled } from "./services/panel-installer.js";
|
|
15
|
+
import { checkAndSelfUpdate } from "./services/self-update.js";
|
|
16
|
+
/**
|
|
17
|
+
* Fire-and-forget: ensure the ComfyUI sidebar panel is installed (install-if-
|
|
18
|
+
* missing) on MCP load. LOCAL-only, hard-timed-out, and never throws — it must
|
|
19
|
+
* never block or crash startup. Opt out with COMFYUI_MCP_PANEL_AUTOINSTALL=0.
|
|
20
|
+
* The explicit `install_comfyui(action:'panel', panel_action:'update')` tool refreshes nightly on demand.
|
|
21
|
+
*/
|
|
22
|
+
function ensurePanelOnLoad() {
|
|
23
|
+
if (!isLocalMode())
|
|
24
|
+
return;
|
|
25
|
+
void ensurePanelInstalled()
|
|
26
|
+
.then((res) => {
|
|
27
|
+
switch (res.action) {
|
|
28
|
+
case "installed":
|
|
29
|
+
logger.info("Panel auto-install: installed the sidebar panel (nightly). RESTART ComfyUI to load it.", res);
|
|
30
|
+
break;
|
|
31
|
+
// #806 — "already present" is the whole claim. The line used to be paired
|
|
32
|
+
// with `action: "up-to-date"`, and users read the pair as "you are on the
|
|
33
|
+
// newest panel"; nothing on this path compares versions.
|
|
34
|
+
case "present":
|
|
35
|
+
logger.info("Panel auto-install: panel already present — NOT a version check. " +
|
|
36
|
+
"Run install_comfyui(action:'panel', panel_action:'status') to compare it against what this build needs.", res);
|
|
37
|
+
break;
|
|
38
|
+
case "skipped-dev":
|
|
39
|
+
logger.info("Panel auto-install: skipped — dev install (symlink), managed manually.", res);
|
|
40
|
+
break;
|
|
41
|
+
case "skipped":
|
|
42
|
+
logger.debug("Panel auto-install: disabled via COMFYUI_MCP_PANEL_AUTOINSTALL.", res);
|
|
43
|
+
break;
|
|
44
|
+
case "shadowed":
|
|
45
|
+
logger.warn("Panel auto-install: a SHADOW copy in custom_nodes may be served instead of the real panel (#641). " +
|
|
46
|
+
"Move the backup dir OUT of custom_nodes and hard-refresh the ComfyUI tab.", res);
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
logger.debug("Panel auto-install: unavailable.", res);
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
.catch(() => { });
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Fire-and-forget: on MCP load, check the npm registry and (for global/local
|
|
56
|
+
* installs) auto-update the package on disk, then surface a "reconnect to load
|
|
57
|
+
* vX" note — the running process can't hot-swap its own code. NEVER updates a
|
|
58
|
+
* dev (npm link) install, hard-timed-out, and never throws. Opt out with
|
|
59
|
+
* COMFYUI_MCP_AUTOUPDATE=0. Mirrors the panel auto-install ensure pattern.
|
|
60
|
+
*/
|
|
61
|
+
function selfUpdateOnLoad() {
|
|
62
|
+
void checkAndSelfUpdate()
|
|
63
|
+
.then((res) => {
|
|
64
|
+
switch (res.action) {
|
|
65
|
+
case "updated":
|
|
66
|
+
logger.info(`Self-update: updated comfyui-mcp ${res.from} → ${res.to} (${res.mode}). ${res.note ?? ""}`, res);
|
|
67
|
+
break;
|
|
68
|
+
case "notify":
|
|
69
|
+
logger.info(`Self-update: ${res.note ?? `v${res.to} available.`}`, res);
|
|
70
|
+
break;
|
|
71
|
+
case "up-to-date":
|
|
72
|
+
logger.debug("Self-update: already on the latest version.", res);
|
|
73
|
+
break;
|
|
74
|
+
case "skipped-dev":
|
|
75
|
+
logger.info("Self-update: skipped — dev install (npm link / checkout).", res);
|
|
76
|
+
break;
|
|
77
|
+
case "skipped-disabled":
|
|
78
|
+
logger.debug("Self-update: disabled via COMFYUI_MCP_AUTOUPDATE.", res);
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
logger.debug("Self-update: unavailable.", res);
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
.catch(() => { });
|
|
85
|
+
}
|
|
86
|
+
async function createConfiguredServer(toolMode = "compact") {
|
|
87
|
+
const server = new McpServer({
|
|
88
|
+
name: "comfyui-mcp",
|
|
89
|
+
version: "0.1.0",
|
|
90
|
+
}, {
|
|
91
|
+
// We declare `resources` and `prompts` (with noop list handlers below)
|
|
92
|
+
// so federating clients like LiteLLM's MCP gateway, which probe every
|
|
93
|
+
// standard list endpoint on initialize fan-out, get a fast empty list
|
|
94
|
+
// instead of a per-server timeout from "Method not found". We don't
|
|
95
|
+
// expose resources or prompts today; advertising them is spec-correct
|
|
96
|
+
// when paired with a list handler that returns the empty set.
|
|
97
|
+
// Reported by @ductiletoaster in #29.
|
|
98
|
+
capabilities: {
|
|
99
|
+
tools: {},
|
|
100
|
+
resources: {},
|
|
101
|
+
prompts: {},
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
if (toolMode === "compact") {
|
|
105
|
+
// Compact tool mode (DEFAULT since #667): capture the whole tool surface
|
|
106
|
+
// into a catalog and expose only the list_tools/describe_tool/call_tool
|
|
107
|
+
// meta-tools, keeping the client's context cost near-zero until a tool is
|
|
108
|
+
// actually needed. Built for small/local LLMs (Hermes Agent, Ollama —
|
|
109
|
+
// issue #97), and the DEFAULT from #667 until 0.50.0, when it became the
|
|
110
|
+
// OPT-IN: the reason it was default was that the direct surface cost
|
|
111
|
+
// ~200KB (~50k tokens) per tools/list at 154 tools, and consolidation took
|
|
112
|
+
// that to 37. Reach for `--compact` when the client's context is the
|
|
113
|
+
// binding constraint — a small local model, or a harness that re-injects
|
|
114
|
+
// tools/list on every read.
|
|
115
|
+
const catalog = await collectToolCatalog();
|
|
116
|
+
registerCompactTools(server, catalog);
|
|
117
|
+
logger.info(`Compact tool mode: ${catalog.tools.size} tools available via list_tools/describe_tool/call_tool`);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
// Full direct surface (opt-in via --full) PLUS the compact facade
|
|
121
|
+
// (list_tools/describe_tool/call_tool) as a stable reconnect escape hatch —
|
|
122
|
+
// see registerFullTools and issue #616. One atomic registration pass,
|
|
123
|
+
// completed before the transport connects below. Opt out of the facade
|
|
124
|
+
// with COMFYUI_MCP_NO_FACADE=1.
|
|
125
|
+
await registerFullTools(server);
|
|
126
|
+
}
|
|
127
|
+
// Serve the retirement ledger on the DIRECT tools/call path too, not only through
|
|
128
|
+
// the call_tool facade — see src/tools/retired-redirect.ts. Installed here, after
|
|
129
|
+
// BOTH branches, because both need it and for different reasons:
|
|
130
|
+
//
|
|
131
|
+
// - full mode is the one the 0.50.0 flip (#726) makes the default, where 121
|
|
132
|
+
// retired names would otherwise answer with a bare "Tool X not found";
|
|
133
|
+
// - compact mode advertises only the 3 meta-tools, so a client calling a retired
|
|
134
|
+
// name DIRECTLY is exactly the stale-snapshot client the facade exists for (#616)
|
|
135
|
+
// — it holds a cached binding for a name this surface no longer lists, and the
|
|
136
|
+
// ledger is the only thing that can tell it where the capability went.
|
|
137
|
+
//
|
|
138
|
+
// Additive: a registered name, and any name the ledger does not know, dispatches
|
|
139
|
+
// through the SDK unchanged. Deliberately BEFORE server.connect() (the callers
|
|
140
|
+
// below connect the returned server), so no request can arrive mid-swap.
|
|
141
|
+
//
|
|
142
|
+
// The result is REPORTED rather than discarded. If it is false the server still
|
|
143
|
+
// boots (see tryInstallRetiredNameRedirect for why bricking startup is the worse
|
|
144
|
+
// failure), but "boots normally while silently answering 121 retired names with a
|
|
145
|
+
// bare 404" is exactly the shape of failure this whole change exists to remove — so
|
|
146
|
+
// it is stated on the same startup line an operator already reads to confirm the
|
|
147
|
+
// surface came up, not left as one error line among registration noise.
|
|
148
|
+
//
|
|
149
|
+
// Residual risk, stated plainly rather than papered over: nothing here can make the
|
|
150
|
+
// degraded state visible to the CALLER, because the wrapper is the only thing that
|
|
151
|
+
// could have changed what the caller sees. What actually holds the guarantee is the
|
|
152
|
+
// `~1.29.0` cap on `@modelcontextprotocol/sdk` in package.json — this is normally run
|
|
153
|
+
// as `npx comfyui-mcp`, which resolves fresh, so an open range would have let a user
|
|
154
|
+
// silently pick up internals nothing ever ran against.
|
|
155
|
+
const redirects = await tryInstallRetiredNameRedirect(server);
|
|
156
|
+
logger.info(`Tool mode: ${toolMode}. Retired-name redirects on direct tools/call: ` +
|
|
157
|
+
(redirects
|
|
158
|
+
? "active"
|
|
159
|
+
: "INACTIVE — a call to a name removed in an earlier release will 404 without naming its replacement"));
|
|
160
|
+
server.server.setRequestHandler(ListResourcesRequestSchema, async () => ({
|
|
161
|
+
resources: [],
|
|
162
|
+
}));
|
|
163
|
+
server.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => ({ resourceTemplates: [] }));
|
|
164
|
+
server.server.setRequestHandler(ListPromptsRequestSchema, async () => ({
|
|
165
|
+
prompts: [],
|
|
166
|
+
}));
|
|
167
|
+
return server;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Open a cloudflared quick tunnel to the local HTTP MCP port and print a clear,
|
|
171
|
+
* ready-to-paste Claude Desktop Custom Connector block (public https://…/mcp
|
|
172
|
+
* URL + token + headless X-API-Key usage). Resilient: a missing cloudflared
|
|
173
|
+
* binary (or any tunnel error) surfaces install guidance and leaves the local
|
|
174
|
+
* server running instead of crashing.
|
|
175
|
+
*/
|
|
176
|
+
async function openTunnelAndAnnounce(host, port, token) {
|
|
177
|
+
const { startQuickTunnel } = await import("./services/tunnel.js");
|
|
178
|
+
logger.info("[tunnel] starting cloudflared quick tunnel…");
|
|
179
|
+
let publicUrl;
|
|
180
|
+
try {
|
|
181
|
+
const tunnel = await startQuickTunnel(port);
|
|
182
|
+
publicUrl = tunnel.url;
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
186
|
+
logger.error(`[tunnel] could not start cloudflared: ${message}\n` +
|
|
187
|
+
` Install it, then re-run with --tunnel:\n` +
|
|
188
|
+
` npm install -g cloudflared # or: brew install cloudflared / winget install cloudflare.cloudflared\n` +
|
|
189
|
+
` The local server is still running at http://${host}:${port}/mcp (token auth active).`);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const mcpUrl = `${publicUrl}/mcp`;
|
|
193
|
+
const snippet = JSON.stringify({
|
|
194
|
+
mcpServers: {
|
|
195
|
+
comfyui: {
|
|
196
|
+
url: mcpUrl,
|
|
197
|
+
headers: { "X-API-Key": token },
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
}, null, 2);
|
|
201
|
+
// Single multi-line block to stderr so it survives MCP stdio framing and is
|
|
202
|
+
// easy to copy from the terminal.
|
|
203
|
+
process.stderr.write([
|
|
204
|
+
"",
|
|
205
|
+
"════════════════════════════════════════════════════════════════════",
|
|
206
|
+
" ComfyUI MCP — Remote / Hosted Connector is LIVE",
|
|
207
|
+
"════════════════════════════════════════════════════════════════════",
|
|
208
|
+
` Public MCP URL : ${mcpUrl}`,
|
|
209
|
+
` Auth token : ${token}`,
|
|
210
|
+
"",
|
|
211
|
+
" Claude Desktop → Settings → Connectors → Add custom connector:",
|
|
212
|
+
` • Name : ComfyUI`,
|
|
213
|
+
` • URL : ${mcpUrl}`,
|
|
214
|
+
` • Header: X-API-Key: ${token} (or Authorization: Bearer ${token})`,
|
|
215
|
+
"",
|
|
216
|
+
" Headless / programmatic config snippet:",
|
|
217
|
+
snippet,
|
|
218
|
+
"",
|
|
219
|
+
" Keep this terminal open — the tunnel closes when the process exits.",
|
|
220
|
+
"════════════════════════════════════════════════════════════════════",
|
|
221
|
+
"",
|
|
222
|
+
].join("\n"));
|
|
223
|
+
}
|
|
224
|
+
/** A remote (non-loopback) ComfyUI served over https — the case where the pod's
|
|
225
|
+
* browser panel needs the secure wss:// bridge instead of plain ws://. */
|
|
226
|
+
function isRemoteHttpsPod(u) {
|
|
227
|
+
try {
|
|
228
|
+
const url = new URL(u);
|
|
229
|
+
const h = url.hostname.toLowerCase();
|
|
230
|
+
return (url.protocol === "https:" &&
|
|
231
|
+
!["127.0.0.1", "localhost", "::1", "0.0.0.0", ""].includes(h));
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
async function main() {
|
|
238
|
+
const cli = parseCliArgs(process.argv);
|
|
239
|
+
// `--help` / `-h`: print usage and exit BEFORE anything else. It must precede
|
|
240
|
+
// every other branch — including `setup` and `connect` — because a user who
|
|
241
|
+
// asks for help has by definition not decided what to run yet, and starting a
|
|
242
|
+
// server or writing a harness config in response to a help request is doing
|
|
243
|
+
// something they did not ask for. Exits 0: asking for help is not an error.
|
|
244
|
+
//
|
|
245
|
+
// stdout, not stderr: this is the requested output, and a user piping it to a
|
|
246
|
+
// pager or grep should get it on the stream that carries results.
|
|
247
|
+
if (cli.help) {
|
|
248
|
+
const { renderCliHelp } = await import("./transport/cli.js");
|
|
249
|
+
process.stdout.write(renderCliHelp());
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
// `setup <agent>`: write the comfyui MCP entry into a non-Claude harness's
|
|
253
|
+
// config (Hermes Agent / OpenClaw / Copilot CLI — issue #97), print next
|
|
254
|
+
// steps, and exit. Never starts the MCP server.
|
|
255
|
+
if (cli.setupAgent !== undefined) {
|
|
256
|
+
const { setupAgent, AGENT_NAMES } = await import("./services/agent-setup.js");
|
|
257
|
+
const agent = cli.setupAgent;
|
|
258
|
+
if (!AGENT_NAMES.includes(agent)) {
|
|
259
|
+
process.stderr.write(`\nUsage: comfyui-mcp setup <${AGENT_NAMES.join("|")}> [--compact|--full] [--comfyui-url <url>] [--dry-run]\n` +
|
|
260
|
+
(cli.setupAgent ? `\nUnknown agent "${cli.setupAgent}".\n` : "") +
|
|
261
|
+
`\nWrites the comfyui MCP server entry into the agent's own config file.\n`);
|
|
262
|
+
process.exit(1);
|
|
263
|
+
}
|
|
264
|
+
try {
|
|
265
|
+
const result = await setupAgent({
|
|
266
|
+
agent,
|
|
267
|
+
compact: cli.toolModeExplicit ? cli.toolMode === "compact" : undefined,
|
|
268
|
+
comfyuiUrl: cli.comfyuiUrl,
|
|
269
|
+
dryRun: cli.setupDryRun,
|
|
270
|
+
});
|
|
271
|
+
const lines = [
|
|
272
|
+
"",
|
|
273
|
+
result.wrote
|
|
274
|
+
? `✓ Added the "comfyui" MCP server to ${result.configPath}`
|
|
275
|
+
: `— dry run: would write ${result.configPath} as —`,
|
|
276
|
+
...(result.wrote ? [] : ["", result.content.trimEnd()]),
|
|
277
|
+
"",
|
|
278
|
+
"Next steps:",
|
|
279
|
+
...result.nextSteps.map((s) => ` • ${s}`),
|
|
280
|
+
"",
|
|
281
|
+
];
|
|
282
|
+
process.stdout.write(lines.join("\n"));
|
|
283
|
+
process.exit(0);
|
|
284
|
+
}
|
|
285
|
+
catch (err) {
|
|
286
|
+
process.stderr.write(`\ncomfyui-mcp setup failed: ${err instanceof Error ? err.message : err}\n`);
|
|
287
|
+
process.exit(1);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// Standalone background orchestrator: owns the UI bridge and drives the panel
|
|
291
|
+
// with autonomous Agent SDK sessions. Not an MCP server — it never returns.
|
|
292
|
+
if (cli.panelOrchestrator) {
|
|
293
|
+
// `connect <comfyui-url>`: drive a (possibly REMOTE) ComfyUI from an agent on
|
|
294
|
+
// THIS machine. Export the URL as COMFYUI_URL so the orchestrator and the
|
|
295
|
+
// comfyui MCP it spawns target that server — the same remote-URL mechanism the
|
|
296
|
+
// panel's "Remote ComfyUI URL" setting uses, just from the CLI. For a REMOTE
|
|
297
|
+
// https pod the orchestrator auto-opens a secure wss:// Cloudflare tunnel so
|
|
298
|
+
// the pod's HTTPS panel can reach the bridge (a plain ws:// from https is
|
|
299
|
+
// browser-blocked); --insecure-bridge forces the plain loopback bridge.
|
|
300
|
+
if (cli.insecureBridge)
|
|
301
|
+
process.env.COMFYUI_MCP_INSECURE_BRIDGE = "1";
|
|
302
|
+
// #667: an explicit --full/--compact must reach the orchestrator's spawned
|
|
303
|
+
// MCP children, which read the mode from the ENV — the flag alone never
|
|
304
|
+
// made it downstream, silently running compact when full was requested.
|
|
305
|
+
exportExplicitToolMode(cli);
|
|
306
|
+
if (cli.comfyuiUrl) {
|
|
307
|
+
// Hard-fail on a bad `connect <url>` instead of silently falling back to the
|
|
308
|
+
// local ComfyUI (which would make the banner below lie about what it drives).
|
|
309
|
+
const urlError = validateConnectUrl(cli.comfyuiUrl);
|
|
310
|
+
if (urlError) {
|
|
311
|
+
process.stderr.write(`\nComfyUI MCP — cannot start: ${urlError}\n\n`);
|
|
312
|
+
process.exit(1);
|
|
313
|
+
}
|
|
314
|
+
process.env.COMFYUI_URL = cli.comfyuiUrl;
|
|
315
|
+
// Default panel bridge port is 9180 (one port shared by all providers);
|
|
316
|
+
// COMFYUI_MCP_BRIDGE_PORT overrides.
|
|
317
|
+
const bridgePort = Number(process.env.COMFYUI_MCP_BRIDGE_PORT) || 9180;
|
|
318
|
+
// Remote https pod → secure wss:// tunnel (auto); local/http or
|
|
319
|
+
// --insecure-bridge → plain loopback ws://. Informational only here.
|
|
320
|
+
const secureBridge = !cli.insecureBridge && isRemoteHttpsPod(cli.comfyuiUrl);
|
|
321
|
+
const bridgeLine = secureBridge
|
|
322
|
+
? " Agent bridge : wss:// secure Cloudflare tunnel (auto — nothing to copy)"
|
|
323
|
+
: ` Agent bridge : ws://127.0.0.1:${bridgePort}`;
|
|
324
|
+
process.stderr.write([
|
|
325
|
+
"",
|
|
326
|
+
"════════════════════════════════════════════════════════════════════",
|
|
327
|
+
" ComfyUI MCP — local agent bridge is starting",
|
|
328
|
+
"════════════════════════════════════════════════════════════════════",
|
|
329
|
+
bridgeLine,
|
|
330
|
+
` Driving : ${cli.comfyuiUrl}`,
|
|
331
|
+
secureBridge
|
|
332
|
+
? " Secure : the pod's HTTPS panel connects automatically over an\n encrypted tunnel — no URL to paste, works in any browser."
|
|
333
|
+
: null,
|
|
334
|
+
"",
|
|
335
|
+
" Next steps:",
|
|
336
|
+
` 1. Open that ComfyUI in your browser: ${cli.comfyuiUrl}`,
|
|
337
|
+
" 2. In the Agent panel's Settings → General, turn ON",
|
|
338
|
+
" 'Use external/local orchestrator (advanced)'.",
|
|
339
|
+
" 3. Click Connect in the panel (the Agent panel's Connect dropdown).",
|
|
340
|
+
"",
|
|
341
|
+
" Until you click Connect this window stays quiet — that's expected, not",
|
|
342
|
+
" a hang. The agent runs HERE on your Claude/Codex login; nothing is",
|
|
343
|
+
" installed on the ComfyUI box. Keep this terminal open.",
|
|
344
|
+
"════════════════════════════════════════════════════════════════════",
|
|
345
|
+
"",
|
|
346
|
+
]
|
|
347
|
+
.filter((l) => l !== null)
|
|
348
|
+
.join("\n"));
|
|
349
|
+
}
|
|
350
|
+
const { runPanelOrchestrator } = await import("./orchestrator/index.js");
|
|
351
|
+
await runPanelOrchestrator();
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
await JobWatcher.cleanupOldFiles();
|
|
355
|
+
if (cli.transport === "http") {
|
|
356
|
+
// In tunnel mode, require a token even if none was configured: the endpoint
|
|
357
|
+
// is about to be exposed publicly, so generate a strong one on the fly.
|
|
358
|
+
const token = cli.token ?? (cli.tunnel ? randomBytes(24).toString("hex") : undefined);
|
|
359
|
+
await startHttpServer({
|
|
360
|
+
host: cli.host,
|
|
361
|
+
port: cli.port,
|
|
362
|
+
token,
|
|
363
|
+
allowUnauthenticated: cli.allowUnauthenticated,
|
|
364
|
+
createServer: () => createConfiguredServer(cli.toolMode),
|
|
365
|
+
});
|
|
366
|
+
logger.info(`ComfyUI MCP server running on http://${cli.host}:${cli.port}/mcp`);
|
|
367
|
+
if (token) {
|
|
368
|
+
logger.info(`HTTP MCP auth ENABLED — send 'Authorization: Bearer <token>' or 'X-API-Key: <token>'.`);
|
|
369
|
+
}
|
|
370
|
+
if (cli.tunnel) {
|
|
371
|
+
await openTunnelAndAnnounce(cli.host, cli.port, token);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
const server = await createConfiguredServer(cli.toolMode);
|
|
376
|
+
const transport = new StdioServerTransport();
|
|
377
|
+
await server.connect(transport);
|
|
378
|
+
logger.info("ComfyUI MCP server running on stdio");
|
|
379
|
+
}
|
|
380
|
+
// After the server is up: auto-ensure the sidebar panel (non-blocking).
|
|
381
|
+
ensurePanelOnLoad();
|
|
382
|
+
// ...and self-check the npm registry for a newer published version (non-blocking).
|
|
383
|
+
selfUpdateOnLoad();
|
|
384
|
+
}
|
|
385
|
+
main().catch((err) => {
|
|
386
|
+
// Error instances JSON-serialize to {} — log the message/stack explicitly so
|
|
387
|
+
// a startup failure (e.g. the unauthenticated-non-loopback guard in Docker)
|
|
388
|
+
// is actually debuggable from the console output.
|
|
389
|
+
logger.error(`Fatal error: ${err instanceof Error ? (err.stack ?? err.message) : String(err)}`);
|
|
390
|
+
process.exit(1);
|
|
391
|
+
});
|
|
392
|
+
//# sourceMappingURL=boot.js.map
|
package/dist/boot.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../src/boot.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAiB,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;;;;GAKG;AACH,SAAS,iBAAiB;IACxB,IAAI,CAAC,WAAW,EAAE;QAAE,OAAO;IAC3B,KAAK,oBAAoB,EAAE;SACxB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;QACZ,QAAQ,G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,CAAC;SACzD,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,wCAAwC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC;QAChF,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,IAAI,CACT,uFAAuF,CACxF,CAAC;QACJ,CAAC;QAED,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,MAAM,qBAAqB,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAM,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IACrD,CAAC;IAED,wEAAwE;IACxE,iBAAiB,EAAE,CAAC;IACpB,mFAAmF;IACnF,gBAAgB,EAAE,CAAC;AACrB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,6EAA6E;IAC7E,4EAA4E;IAC5E,kDAAkD;IAClD,MAAM,CAAC,KAAK,CACV,gBAAgB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAClF,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/experimental/run.js
CHANGED
|
@@ -4,7 +4,7 @@ import { maybeStartAgentPoc } from "./agent-poc.js";
|
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
5
|
// Standalone runner for the experimental embedded-agent-panel POC.
|
|
6
6
|
//
|
|
7
|
-
// This is intentionally NOT imported by src/
|
|
7
|
+
// This is intentionally NOT imported by src/boot.ts — the default MCP server
|
|
8
8
|
// (stdio / HTTP) never touches the POC. Run it explicitly, e.g.:
|
|
9
9
|
//
|
|
10
10
|
// COMFYUI_MCP_AGENT_POC=1 ANTHROPIC_API_KEY=... npx tsx src/experimental/run.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/experimental/run.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,8EAA8E;AAC9E,mEAAmE;AACnE,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/experimental/run.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,8EAA8E;AAC9E,mEAAmE;AACnE,EAAE;AACF,6EAA6E;AAC7E,iEAAiE;AACjE,EAAE;AACF,kFAAkF;AAClF,yFAAyF;AACzF,8EAA8E;AAE9E,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,CAAC,IAAI,CACT,8FAA8F,CAC/F,CAAC;QACF,OAAO;IACT,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,wBAAwB,MAAM,CAAC,QAAQ,WAAW,CAAC,CAAC;IAChE,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,2BAA2B,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,QAAQ,GAAG,GAAS,EAAE;QAC1B,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC5C,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,392 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* missing) on MCP load. LOCAL-only, hard-timed-out, and never throws — it must
|
|
19
|
-
* never block or crash startup. Opt out with COMFYUI_MCP_PANEL_AUTOINSTALL=0.
|
|
20
|
-
* The explicit `install_comfyui(action:'panel', panel_action:'update')` tool refreshes nightly on demand.
|
|
21
|
-
*/
|
|
22
|
-
function ensurePanelOnLoad() {
|
|
23
|
-
if (!isLocalMode())
|
|
24
|
-
return;
|
|
25
|
-
void ensurePanelInstalled()
|
|
26
|
-
.then((res) => {
|
|
27
|
-
switch (res.action) {
|
|
28
|
-
case "installed":
|
|
29
|
-
logger.info("Panel auto-install: installed the sidebar panel (nightly). RESTART ComfyUI to load it.", res);
|
|
30
|
-
break;
|
|
31
|
-
// #806 — "already present" is the whole claim. The line used to be paired
|
|
32
|
-
// with `action: "up-to-date"`, and users read the pair as "you are on the
|
|
33
|
-
// newest panel"; nothing on this path compares versions.
|
|
34
|
-
case "present":
|
|
35
|
-
logger.info("Panel auto-install: panel already present — NOT a version check. " +
|
|
36
|
-
"Run install_comfyui(action:'panel', panel_action:'status') to compare it against what this build needs.", res);
|
|
37
|
-
break;
|
|
38
|
-
case "skipped-dev":
|
|
39
|
-
logger.info("Panel auto-install: skipped — dev install (symlink), managed manually.", res);
|
|
40
|
-
break;
|
|
41
|
-
case "skipped":
|
|
42
|
-
logger.debug("Panel auto-install: disabled via COMFYUI_MCP_PANEL_AUTOINSTALL.", res);
|
|
43
|
-
break;
|
|
44
|
-
case "shadowed":
|
|
45
|
-
logger.warn("Panel auto-install: a SHADOW copy in custom_nodes may be served instead of the real panel (#641). " +
|
|
46
|
-
"Move the backup dir OUT of custom_nodes and hard-refresh the ComfyUI tab.", res);
|
|
47
|
-
break;
|
|
48
|
-
default:
|
|
49
|
-
logger.debug("Panel auto-install: unavailable.", res);
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
.catch(() => { });
|
|
2
|
+
// #1318 — THE LAUNCHER EXISTS SO A DAMAGED INSTALL CAN SAY SO.
|
|
3
|
+
//
|
|
4
|
+
// Everything this program does lives in ./boot.js. It is loaded DYNAMICALLY, and
|
|
5
|
+
// that is the whole point: a static import of a missing dependency throws before
|
|
6
|
+
// any of our code runs, so the user gets Node's resolver talking about a path
|
|
7
|
+
// inside node_modules and nothing else. That is what happened in #1318 — a global
|
|
8
|
+
// install whose `@modelcontextprotocol/sdk` was half-extracted produced an
|
|
9
|
+
// ERR_MODULE_NOT_FOUND that never mentioned comfyui-mcp, while the recorded
|
|
10
|
+
// version still read as current.
|
|
11
|
+
//
|
|
12
|
+
// Keeping this file free of package imports is load-bearing. Anything imported
|
|
13
|
+
// here statically is something that can fail before the handler is installed, and
|
|
14
|
+
// the handler is the only reason this file exists.
|
|
15
|
+
import { describeBrokenInstall, isModuleResolutionFailure } from "./utils/broken-install.js";
|
|
16
|
+
try {
|
|
17
|
+
await import("./boot.js");
|
|
53
18
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
void checkAndSelfUpdate()
|
|
63
|
-
.then((res) => {
|
|
64
|
-
switch (res.action) {
|
|
65
|
-
case "updated":
|
|
66
|
-
logger.info(`Self-update: updated comfyui-mcp ${res.from} → ${res.to} (${res.mode}). ${res.note ?? ""}`, res);
|
|
67
|
-
break;
|
|
68
|
-
case "notify":
|
|
69
|
-
logger.info(`Self-update: ${res.note ?? `v${res.to} available.`}`, res);
|
|
70
|
-
break;
|
|
71
|
-
case "up-to-date":
|
|
72
|
-
logger.debug("Self-update: already on the latest version.", res);
|
|
73
|
-
break;
|
|
74
|
-
case "skipped-dev":
|
|
75
|
-
logger.info("Self-update: skipped — dev install (npm link / checkout).", res);
|
|
76
|
-
break;
|
|
77
|
-
case "skipped-disabled":
|
|
78
|
-
logger.debug("Self-update: disabled via COMFYUI_MCP_AUTOUPDATE.", res);
|
|
79
|
-
break;
|
|
80
|
-
default:
|
|
81
|
-
logger.debug("Self-update: unavailable.", res);
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
.catch(() => { });
|
|
85
|
-
}
|
|
86
|
-
async function createConfiguredServer(toolMode = "compact") {
|
|
87
|
-
const server = new McpServer({
|
|
88
|
-
name: "comfyui-mcp",
|
|
89
|
-
version: "0.1.0",
|
|
90
|
-
}, {
|
|
91
|
-
// We declare `resources` and `prompts` (with noop list handlers below)
|
|
92
|
-
// so federating clients like LiteLLM's MCP gateway, which probe every
|
|
93
|
-
// standard list endpoint on initialize fan-out, get a fast empty list
|
|
94
|
-
// instead of a per-server timeout from "Method not found". We don't
|
|
95
|
-
// expose resources or prompts today; advertising them is spec-correct
|
|
96
|
-
// when paired with a list handler that returns the empty set.
|
|
97
|
-
// Reported by @ductiletoaster in #29.
|
|
98
|
-
capabilities: {
|
|
99
|
-
tools: {},
|
|
100
|
-
resources: {},
|
|
101
|
-
prompts: {},
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
if (toolMode === "compact") {
|
|
105
|
-
// Compact tool mode (DEFAULT since #667): capture the whole tool surface
|
|
106
|
-
// into a catalog and expose only the list_tools/describe_tool/call_tool
|
|
107
|
-
// meta-tools, keeping the client's context cost near-zero until a tool is
|
|
108
|
-
// actually needed. Built for small/local LLMs (Hermes Agent, Ollama —
|
|
109
|
-
// issue #97), and the DEFAULT from #667 until 0.50.0, when it became the
|
|
110
|
-
// OPT-IN: the reason it was default was that the direct surface cost
|
|
111
|
-
// ~200KB (~50k tokens) per tools/list at 154 tools, and consolidation took
|
|
112
|
-
// that to 37. Reach for `--compact` when the client's context is the
|
|
113
|
-
// binding constraint — a small local model, or a harness that re-injects
|
|
114
|
-
// tools/list on every read.
|
|
115
|
-
const catalog = await collectToolCatalog();
|
|
116
|
-
registerCompactTools(server, catalog);
|
|
117
|
-
logger.info(`Compact tool mode: ${catalog.tools.size} tools available via list_tools/describe_tool/call_tool`);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
// Full direct surface (opt-in via --full) PLUS the compact facade
|
|
121
|
-
// (list_tools/describe_tool/call_tool) as a stable reconnect escape hatch —
|
|
122
|
-
// see registerFullTools and issue #616. One atomic registration pass,
|
|
123
|
-
// completed before the transport connects below. Opt out of the facade
|
|
124
|
-
// with COMFYUI_MCP_NO_FACADE=1.
|
|
125
|
-
await registerFullTools(server);
|
|
126
|
-
}
|
|
127
|
-
// Serve the retirement ledger on the DIRECT tools/call path too, not only through
|
|
128
|
-
// the call_tool facade — see src/tools/retired-redirect.ts. Installed here, after
|
|
129
|
-
// BOTH branches, because both need it and for different reasons:
|
|
130
|
-
//
|
|
131
|
-
// - full mode is the one the 0.50.0 flip (#726) makes the default, where 121
|
|
132
|
-
// retired names would otherwise answer with a bare "Tool X not found";
|
|
133
|
-
// - compact mode advertises only the 3 meta-tools, so a client calling a retired
|
|
134
|
-
// name DIRECTLY is exactly the stale-snapshot client the facade exists for (#616)
|
|
135
|
-
// — it holds a cached binding for a name this surface no longer lists, and the
|
|
136
|
-
// ledger is the only thing that can tell it where the capability went.
|
|
137
|
-
//
|
|
138
|
-
// Additive: a registered name, and any name the ledger does not know, dispatches
|
|
139
|
-
// through the SDK unchanged. Deliberately BEFORE server.connect() (the callers
|
|
140
|
-
// below connect the returned server), so no request can arrive mid-swap.
|
|
141
|
-
//
|
|
142
|
-
// The result is REPORTED rather than discarded. If it is false the server still
|
|
143
|
-
// boots (see tryInstallRetiredNameRedirect for why bricking startup is the worse
|
|
144
|
-
// failure), but "boots normally while silently answering 121 retired names with a
|
|
145
|
-
// bare 404" is exactly the shape of failure this whole change exists to remove — so
|
|
146
|
-
// it is stated on the same startup line an operator already reads to confirm the
|
|
147
|
-
// surface came up, not left as one error line among registration noise.
|
|
148
|
-
//
|
|
149
|
-
// Residual risk, stated plainly rather than papered over: nothing here can make the
|
|
150
|
-
// degraded state visible to the CALLER, because the wrapper is the only thing that
|
|
151
|
-
// could have changed what the caller sees. What actually holds the guarantee is the
|
|
152
|
-
// `~1.29.0` cap on `@modelcontextprotocol/sdk` in package.json — this is normally run
|
|
153
|
-
// as `npx comfyui-mcp`, which resolves fresh, so an open range would have let a user
|
|
154
|
-
// silently pick up internals nothing ever ran against.
|
|
155
|
-
const redirects = await tryInstallRetiredNameRedirect(server);
|
|
156
|
-
logger.info(`Tool mode: ${toolMode}. Retired-name redirects on direct tools/call: ` +
|
|
157
|
-
(redirects
|
|
158
|
-
? "active"
|
|
159
|
-
: "INACTIVE — a call to a name removed in an earlier release will 404 without naming its replacement"));
|
|
160
|
-
server.server.setRequestHandler(ListResourcesRequestSchema, async () => ({
|
|
161
|
-
resources: [],
|
|
162
|
-
}));
|
|
163
|
-
server.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => ({ resourceTemplates: [] }));
|
|
164
|
-
server.server.setRequestHandler(ListPromptsRequestSchema, async () => ({
|
|
165
|
-
prompts: [],
|
|
166
|
-
}));
|
|
167
|
-
return server;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Open a cloudflared quick tunnel to the local HTTP MCP port and print a clear,
|
|
171
|
-
* ready-to-paste Claude Desktop Custom Connector block (public https://…/mcp
|
|
172
|
-
* URL + token + headless X-API-Key usage). Resilient: a missing cloudflared
|
|
173
|
-
* binary (or any tunnel error) surfaces install guidance and leaves the local
|
|
174
|
-
* server running instead of crashing.
|
|
175
|
-
*/
|
|
176
|
-
async function openTunnelAndAnnounce(host, port, token) {
|
|
177
|
-
const { startQuickTunnel } = await import("./services/tunnel.js");
|
|
178
|
-
logger.info("[tunnel] starting cloudflared quick tunnel…");
|
|
179
|
-
let publicUrl;
|
|
180
|
-
try {
|
|
181
|
-
const tunnel = await startQuickTunnel(port);
|
|
182
|
-
publicUrl = tunnel.url;
|
|
183
|
-
}
|
|
184
|
-
catch (err) {
|
|
185
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
186
|
-
logger.error(`[tunnel] could not start cloudflared: ${message}\n` +
|
|
187
|
-
` Install it, then re-run with --tunnel:\n` +
|
|
188
|
-
` npm install -g cloudflared # or: brew install cloudflared / winget install cloudflare.cloudflared\n` +
|
|
189
|
-
` The local server is still running at http://${host}:${port}/mcp (token auth active).`);
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
const mcpUrl = `${publicUrl}/mcp`;
|
|
193
|
-
const snippet = JSON.stringify({
|
|
194
|
-
mcpServers: {
|
|
195
|
-
comfyui: {
|
|
196
|
-
url: mcpUrl,
|
|
197
|
-
headers: { "X-API-Key": token },
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
}, null, 2);
|
|
201
|
-
// Single multi-line block to stderr so it survives MCP stdio framing and is
|
|
202
|
-
// easy to copy from the terminal.
|
|
203
|
-
process.stderr.write([
|
|
204
|
-
"",
|
|
205
|
-
"════════════════════════════════════════════════════════════════════",
|
|
206
|
-
" ComfyUI MCP — Remote / Hosted Connector is LIVE",
|
|
207
|
-
"════════════════════════════════════════════════════════════════════",
|
|
208
|
-
` Public MCP URL : ${mcpUrl}`,
|
|
209
|
-
` Auth token : ${token}`,
|
|
210
|
-
"",
|
|
211
|
-
" Claude Desktop → Settings → Connectors → Add custom connector:",
|
|
212
|
-
` • Name : ComfyUI`,
|
|
213
|
-
` • URL : ${mcpUrl}`,
|
|
214
|
-
` • Header: X-API-Key: ${token} (or Authorization: Bearer ${token})`,
|
|
215
|
-
"",
|
|
216
|
-
" Headless / programmatic config snippet:",
|
|
217
|
-
snippet,
|
|
218
|
-
"",
|
|
219
|
-
" Keep this terminal open — the tunnel closes when the process exits.",
|
|
220
|
-
"════════════════════════════════════════════════════════════════════",
|
|
221
|
-
"",
|
|
222
|
-
].join("\n"));
|
|
223
|
-
}
|
|
224
|
-
/** A remote (non-loopback) ComfyUI served over https — the case where the pod's
|
|
225
|
-
* browser panel needs the secure wss:// bridge instead of plain ws://. */
|
|
226
|
-
function isRemoteHttpsPod(u) {
|
|
227
|
-
try {
|
|
228
|
-
const url = new URL(u);
|
|
229
|
-
const h = url.hostname.toLowerCase();
|
|
230
|
-
return (url.protocol === "https:" &&
|
|
231
|
-
!["127.0.0.1", "localhost", "::1", "0.0.0.0", ""].includes(h));
|
|
232
|
-
}
|
|
233
|
-
catch {
|
|
234
|
-
return false;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
async function main() {
|
|
238
|
-
const cli = parseCliArgs(process.argv);
|
|
239
|
-
// `--help` / `-h`: print usage and exit BEFORE anything else. It must precede
|
|
240
|
-
// every other branch — including `setup` and `connect` — because a user who
|
|
241
|
-
// asks for help has by definition not decided what to run yet, and starting a
|
|
242
|
-
// server or writing a harness config in response to a help request is doing
|
|
243
|
-
// something they did not ask for. Exits 0: asking for help is not an error.
|
|
244
|
-
//
|
|
245
|
-
// stdout, not stderr: this is the requested output, and a user piping it to a
|
|
246
|
-
// pager or grep should get it on the stream that carries results.
|
|
247
|
-
if (cli.help) {
|
|
248
|
-
const { renderCliHelp } = await import("./transport/cli.js");
|
|
249
|
-
process.stdout.write(renderCliHelp());
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
// `setup <agent>`: write the comfyui MCP entry into a non-Claude harness's
|
|
253
|
-
// config (Hermes Agent / OpenClaw / Copilot CLI — issue #97), print next
|
|
254
|
-
// steps, and exit. Never starts the MCP server.
|
|
255
|
-
if (cli.setupAgent !== undefined) {
|
|
256
|
-
const { setupAgent, AGENT_NAMES } = await import("./services/agent-setup.js");
|
|
257
|
-
const agent = cli.setupAgent;
|
|
258
|
-
if (!AGENT_NAMES.includes(agent)) {
|
|
259
|
-
process.stderr.write(`\nUsage: comfyui-mcp setup <${AGENT_NAMES.join("|")}> [--compact|--full] [--comfyui-url <url>] [--dry-run]\n` +
|
|
260
|
-
(cli.setupAgent ? `\nUnknown agent "${cli.setupAgent}".\n` : "") +
|
|
261
|
-
`\nWrites the comfyui MCP server entry into the agent's own config file.\n`);
|
|
262
|
-
process.exit(1);
|
|
263
|
-
}
|
|
264
|
-
try {
|
|
265
|
-
const result = await setupAgent({
|
|
266
|
-
agent,
|
|
267
|
-
compact: cli.toolModeExplicit ? cli.toolMode === "compact" : undefined,
|
|
268
|
-
comfyuiUrl: cli.comfyuiUrl,
|
|
269
|
-
dryRun: cli.setupDryRun,
|
|
270
|
-
});
|
|
271
|
-
const lines = [
|
|
272
|
-
"",
|
|
273
|
-
result.wrote
|
|
274
|
-
? `✓ Added the "comfyui" MCP server to ${result.configPath}`
|
|
275
|
-
: `— dry run: would write ${result.configPath} as —`,
|
|
276
|
-
...(result.wrote ? [] : ["", result.content.trimEnd()]),
|
|
277
|
-
"",
|
|
278
|
-
"Next steps:",
|
|
279
|
-
...result.nextSteps.map((s) => ` • ${s}`),
|
|
280
|
-
"",
|
|
281
|
-
];
|
|
282
|
-
process.stdout.write(lines.join("\n"));
|
|
283
|
-
process.exit(0);
|
|
284
|
-
}
|
|
285
|
-
catch (err) {
|
|
286
|
-
process.stderr.write(`\ncomfyui-mcp setup failed: ${err instanceof Error ? err.message : err}\n`);
|
|
287
|
-
process.exit(1);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
// Standalone background orchestrator: owns the UI bridge and drives the panel
|
|
291
|
-
// with autonomous Agent SDK sessions. Not an MCP server — it never returns.
|
|
292
|
-
if (cli.panelOrchestrator) {
|
|
293
|
-
// `connect <comfyui-url>`: drive a (possibly REMOTE) ComfyUI from an agent on
|
|
294
|
-
// THIS machine. Export the URL as COMFYUI_URL so the orchestrator and the
|
|
295
|
-
// comfyui MCP it spawns target that server — the same remote-URL mechanism the
|
|
296
|
-
// panel's "Remote ComfyUI URL" setting uses, just from the CLI. For a REMOTE
|
|
297
|
-
// https pod the orchestrator auto-opens a secure wss:// Cloudflare tunnel so
|
|
298
|
-
// the pod's HTTPS panel can reach the bridge (a plain ws:// from https is
|
|
299
|
-
// browser-blocked); --insecure-bridge forces the plain loopback bridge.
|
|
300
|
-
if (cli.insecureBridge)
|
|
301
|
-
process.env.COMFYUI_MCP_INSECURE_BRIDGE = "1";
|
|
302
|
-
// #667: an explicit --full/--compact must reach the orchestrator's spawned
|
|
303
|
-
// MCP children, which read the mode from the ENV — the flag alone never
|
|
304
|
-
// made it downstream, silently running compact when full was requested.
|
|
305
|
-
exportExplicitToolMode(cli);
|
|
306
|
-
if (cli.comfyuiUrl) {
|
|
307
|
-
// Hard-fail on a bad `connect <url>` instead of silently falling back to the
|
|
308
|
-
// local ComfyUI (which would make the banner below lie about what it drives).
|
|
309
|
-
const urlError = validateConnectUrl(cli.comfyuiUrl);
|
|
310
|
-
if (urlError) {
|
|
311
|
-
process.stderr.write(`\nComfyUI MCP — cannot start: ${urlError}\n\n`);
|
|
312
|
-
process.exit(1);
|
|
313
|
-
}
|
|
314
|
-
process.env.COMFYUI_URL = cli.comfyuiUrl;
|
|
315
|
-
// Default panel bridge port is 9180 (one port shared by all providers);
|
|
316
|
-
// COMFYUI_MCP_BRIDGE_PORT overrides.
|
|
317
|
-
const bridgePort = Number(process.env.COMFYUI_MCP_BRIDGE_PORT) || 9180;
|
|
318
|
-
// Remote https pod → secure wss:// tunnel (auto); local/http or
|
|
319
|
-
// --insecure-bridge → plain loopback ws://. Informational only here.
|
|
320
|
-
const secureBridge = !cli.insecureBridge && isRemoteHttpsPod(cli.comfyuiUrl);
|
|
321
|
-
const bridgeLine = secureBridge
|
|
322
|
-
? " Agent bridge : wss:// secure Cloudflare tunnel (auto — nothing to copy)"
|
|
323
|
-
: ` Agent bridge : ws://127.0.0.1:${bridgePort}`;
|
|
324
|
-
process.stderr.write([
|
|
325
|
-
"",
|
|
326
|
-
"════════════════════════════════════════════════════════════════════",
|
|
327
|
-
" ComfyUI MCP — local agent bridge is starting",
|
|
328
|
-
"════════════════════════════════════════════════════════════════════",
|
|
329
|
-
bridgeLine,
|
|
330
|
-
` Driving : ${cli.comfyuiUrl}`,
|
|
331
|
-
secureBridge
|
|
332
|
-
? " Secure : the pod's HTTPS panel connects automatically over an\n encrypted tunnel — no URL to paste, works in any browser."
|
|
333
|
-
: null,
|
|
334
|
-
"",
|
|
335
|
-
" Next steps:",
|
|
336
|
-
` 1. Open that ComfyUI in your browser: ${cli.comfyuiUrl}`,
|
|
337
|
-
" 2. In the Agent panel's Settings → General, turn ON",
|
|
338
|
-
" 'Use external/local orchestrator (advanced)'.",
|
|
339
|
-
" 3. Click Connect in the panel (the Agent panel's Connect dropdown).",
|
|
340
|
-
"",
|
|
341
|
-
" Until you click Connect this window stays quiet — that's expected, not",
|
|
342
|
-
" a hang. The agent runs HERE on your Claude/Codex login; nothing is",
|
|
343
|
-
" installed on the ComfyUI box. Keep this terminal open.",
|
|
344
|
-
"════════════════════════════════════════════════════════════════════",
|
|
345
|
-
"",
|
|
346
|
-
]
|
|
347
|
-
.filter((l) => l !== null)
|
|
348
|
-
.join("\n"));
|
|
349
|
-
}
|
|
350
|
-
const { runPanelOrchestrator } = await import("./orchestrator/index.js");
|
|
351
|
-
await runPanelOrchestrator();
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
await JobWatcher.cleanupOldFiles();
|
|
355
|
-
if (cli.transport === "http") {
|
|
356
|
-
// In tunnel mode, require a token even if none was configured: the endpoint
|
|
357
|
-
// is about to be exposed publicly, so generate a strong one on the fly.
|
|
358
|
-
const token = cli.token ?? (cli.tunnel ? randomBytes(24).toString("hex") : undefined);
|
|
359
|
-
await startHttpServer({
|
|
360
|
-
host: cli.host,
|
|
361
|
-
port: cli.port,
|
|
362
|
-
token,
|
|
363
|
-
allowUnauthenticated: cli.allowUnauthenticated,
|
|
364
|
-
createServer: () => createConfiguredServer(cli.toolMode),
|
|
365
|
-
});
|
|
366
|
-
logger.info(`ComfyUI MCP server running on http://${cli.host}:${cli.port}/mcp`);
|
|
367
|
-
if (token) {
|
|
368
|
-
logger.info(`HTTP MCP auth ENABLED — send 'Authorization: Bearer <token>' or 'X-API-Key: <token>'.`);
|
|
369
|
-
}
|
|
370
|
-
if (cli.tunnel) {
|
|
371
|
-
await openTunnelAndAnnounce(cli.host, cli.port, token);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
const server = await createConfiguredServer(cli.toolMode);
|
|
376
|
-
const transport = new StdioServerTransport();
|
|
377
|
-
await server.connect(transport);
|
|
378
|
-
logger.info("ComfyUI MCP server running on stdio");
|
|
379
|
-
}
|
|
380
|
-
// After the server is up: auto-ensure the sidebar panel (non-blocking).
|
|
381
|
-
ensurePanelOnLoad();
|
|
382
|
-
// ...and self-check the npm registry for a newer published version (non-blocking).
|
|
383
|
-
selfUpdateOnLoad();
|
|
384
|
-
}
|
|
385
|
-
main().catch((err) => {
|
|
386
|
-
// Error instances JSON-serialize to {} — log the message/stack explicitly so
|
|
387
|
-
// a startup failure (e.g. the unauthenticated-non-loopback guard in Docker)
|
|
388
|
-
// is actually debuggable from the console output.
|
|
389
|
-
logger.error(`Fatal error: ${err instanceof Error ? (err.stack ?? err.message) : String(err)}`);
|
|
19
|
+
catch (err) {
|
|
20
|
+
// A REAL error from real code must reach the user unchanged. Only the specific
|
|
21
|
+
// "the file is not on disk" failure is translated; anything else rethrown.
|
|
22
|
+
if (!isModuleResolutionFailure(err))
|
|
23
|
+
throw err;
|
|
24
|
+
process.stderr.write(`\n${describeBrokenInstall(err)}\n`);
|
|
25
|
+
// Exit code unchanged (1): scripts and supervisors already treat that as a
|
|
26
|
+
// failed start, and moving it would be a behaviour change nobody asked for.
|
|
390
27
|
process.exit(1);
|
|
391
|
-
}
|
|
28
|
+
}
|
|
392
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAiB,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,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C,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAClF,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,+DAA+D;AAC/D,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,8EAA8E;AAC9E,kFAAkF;AAClF,2EAA2E;AAC3E,4EAA4E;AAC5E,iCAAiC;AACjC,EAAE;AACF,+EAA+E;AAC/E,kFAAkF;AAClF,mDAAmD;AACnD,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAE7F,IAAI,CAAC;IACH,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;AAC5B,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,+EAA+E;IAC/E,2EAA2E;IAC3E,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC;QAAE,MAAM,GAAG,CAAC;IAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1D,2EAA2E;IAC3E,4EAA4E;IAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/dist/tools/introspect.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* It is NOT the whole ToolSchema: `title`, `icons`, `outputSchema`, `execution` and
|
|
11
11
|
* `_meta` are dropped, so a change to any of those is invisible here. Nor does it
|
|
12
|
-
* see anything behind the CONFIGURED server — createConfiguredServer() (src/
|
|
12
|
+
* see anything behind the CONFIGURED server — createConfiguredServer() (src/boot.ts)
|
|
13
13
|
* chooses full versus compact registration, and this calls registerAllTools()
|
|
14
14
|
* directly. Stated explicitly because "what a client sees" invites the reading that
|
|
15
15
|
* anything a client could notice is covered, and it is not.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// #1318 — a half-extracted install is silent until an unrelated-looking crash.
|
|
2
|
+
//
|
|
3
|
+
// A global Windows install became unusable: `@modelcontextprotocol/sdk`'s
|
|
4
|
+
// `dist/esm/server/` held two empty subdirectories where a healthy install has 42
|
|
5
|
+
// entries. Directories created, files never written — an interrupted extraction.
|
|
6
|
+
// The install's package.json still read 0.50.46, so it presented as up to date
|
|
7
|
+
// while being non-functional.
|
|
8
|
+
//
|
|
9
|
+
// What the user got was Node's resolver talking about a path:
|
|
10
|
+
//
|
|
11
|
+
// Error [ERR_MODULE_NOT_FOUND]: Cannot find module
|
|
12
|
+
// '…\node_modules\@modelcontextprotocol\sdk\dist\esm\server\mcp.js'
|
|
13
|
+
//
|
|
14
|
+
// Nothing in that names comfyui-mcp, says the install is damaged, or hints at the
|
|
15
|
+
// one-line repair. The reporter filed it for exactly this detection gap, and was
|
|
16
|
+
// careful that the CAUSE is unproven — an interrupted `npm install -g` looks
|
|
17
|
+
// identical to a failed self-update. So this diagnoses the STATE, which is
|
|
18
|
+
// observable, and does not assert how it got there.
|
|
19
|
+
/**
|
|
20
|
+
* Is this the failure of a missing/unreadable module, rather than an error the
|
|
21
|
+
* program threw on its own?
|
|
22
|
+
*
|
|
23
|
+
* Deliberately narrow. `ERR_MODULE_NOT_FOUND` and `MODULE_NOT_FOUND` are the two
|
|
24
|
+
* Node reports for "the file the import points at is not there", which is the
|
|
25
|
+
* observable state a half-extracted tree produces. Anything else is a real error
|
|
26
|
+
* from real code and must reach the user unchanged — swallowing it behind a
|
|
27
|
+
* "reinstall" banner would be its own defect, and a far more confusing one.
|
|
28
|
+
*/
|
|
29
|
+
export function isModuleResolutionFailure(err) {
|
|
30
|
+
const code = err?.code;
|
|
31
|
+
return code === "ERR_MODULE_NOT_FOUND" || code === "MODULE_NOT_FOUND";
|
|
32
|
+
}
|
|
33
|
+
/** The specifier Node could not resolve, when its message carries one. */
|
|
34
|
+
export function missingSpecifier(err) {
|
|
35
|
+
const msg = typeof err?.message === "string" ? String(err.message) : "";
|
|
36
|
+
// "Cannot find module '<path>' imported from …" / "Cannot find package '<name>'"
|
|
37
|
+
const quoted = msg.match(/Cannot find (?:module|package) '([^']+)'/);
|
|
38
|
+
if (quoted?.[1])
|
|
39
|
+
return quoted[1];
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Which of the two failures Node reported — an absent PACKAGE or an absent FILE
|
|
44
|
+
* inside one.
|
|
45
|
+
*
|
|
46
|
+
* Worth distinguishing because the repair reads differently and, more to the
|
|
47
|
+
* point, because "a file is missing: zod" is nonsense. Node says "Cannot find
|
|
48
|
+
* package" when nothing resolved the bare specifier at all, and "Cannot find
|
|
49
|
+
* module" when it resolved to a path that is not on disk — which is the
|
|
50
|
+
* half-extracted case in #1318.
|
|
51
|
+
*/
|
|
52
|
+
export function missingKind(err) {
|
|
53
|
+
const msg = typeof err?.message === "string" ? String(err.message) : "";
|
|
54
|
+
if (/Cannot find package '/.test(msg))
|
|
55
|
+
return "package";
|
|
56
|
+
if (/Cannot find module '/.test(msg))
|
|
57
|
+
return "module";
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
/** The package a path inside node_modules belongs to, for naming the culprit. */
|
|
61
|
+
export function owningPackage(specifier) {
|
|
62
|
+
if (!specifier)
|
|
63
|
+
return null;
|
|
64
|
+
const norm = specifier.replace(/\\/g, "/");
|
|
65
|
+
const at = norm.lastIndexOf("node_modules/");
|
|
66
|
+
if (at === -1) {
|
|
67
|
+
// Not inside node_modules, so this is one of OUR OWN files, not a dependency.
|
|
68
|
+
//
|
|
69
|
+
// The first version treated any non-node_modules specifier as a bare package
|
|
70
|
+
// name, which on Windows read the drive letter off an absolute path and
|
|
71
|
+
// announced a missing dependency called "C:". An absolute or relative path is
|
|
72
|
+
// never a package name — only a bare specifier is.
|
|
73
|
+
// Tested against the NORMALIZED string: the raw one still has backslashes on
|
|
74
|
+
// Windows, so a pattern written for `/` silently matched nothing there — which
|
|
75
|
+
// is how `C:\Users\…\boot.js` came out as a dependency named "C:".
|
|
76
|
+
if (/^([a-zA-Z]:)?\//.test(norm) || norm.startsWith("."))
|
|
77
|
+
return null;
|
|
78
|
+
const m = norm.match(/^(@[^/]+\/[^/]+|[^@/][^/]*)/);
|
|
79
|
+
return m?.[1] ?? null;
|
|
80
|
+
}
|
|
81
|
+
const rest = norm.slice(at + "node_modules/".length);
|
|
82
|
+
const m = rest.match(/^(@[^/]+\/[^/]+|[^/]+)/);
|
|
83
|
+
return m?.[1] ?? null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The message a user should get instead of a resolver stack trace.
|
|
87
|
+
*
|
|
88
|
+
* States the OBSERVATION (a module this install needs is not on disk) and the
|
|
89
|
+
* repair, and does NOT claim why — the reporter could not prove self-update
|
|
90
|
+
* caused it, and an interrupted `npm install -g` is indistinguishable. Asserting
|
|
91
|
+
* a cause here would send someone to fix the wrong thing.
|
|
92
|
+
*/
|
|
93
|
+
export function describeBrokenInstall(err) {
|
|
94
|
+
const specifier = missingSpecifier(err);
|
|
95
|
+
const pkg = owningPackage(specifier);
|
|
96
|
+
const isDependency = Boolean(pkg) && pkg !== "comfyui-mcp";
|
|
97
|
+
const what = !specifier
|
|
98
|
+
? `a module it needs could not be loaded`
|
|
99
|
+
: // Nothing resolved the name at all: the package is absent, not damaged.
|
|
100
|
+
// Printing the bare name on the "path" line would read as `is missing: zod`.
|
|
101
|
+
missingKind(err) === "package" && isDependency
|
|
102
|
+
? `its dependency "${pkg}" is not installed`
|
|
103
|
+
: isDependency
|
|
104
|
+
? `a file from its dependency "${pkg}" is missing:\n ${specifier}`
|
|
105
|
+
: `a file it needs is missing:\n ${specifier}`;
|
|
106
|
+
return (`comfyui-mcp could not start: ${what}\n\n` +
|
|
107
|
+
`This install is INCOMPLETE, not misconfigured. Directories present with files missing is what an\n` +
|
|
108
|
+
`interrupted install or update leaves behind, and the recorded version still looks current — which\n` +
|
|
109
|
+
`is why nothing warned you until now.\n\n` +
|
|
110
|
+
`Repair it by reinstalling:\n\n` +
|
|
111
|
+
` npm install -g comfyui-mcp@latest\n\n` +
|
|
112
|
+
`If you run it through npx, clear the cache first (npx clear-npx-cache) so it does not reuse the\n` +
|
|
113
|
+
`same damaged tree. Nothing else needs changing: your settings, panel and workflows are untouched.\n`);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=broken-install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broken-install.js","sourceRoot":"","sources":["../../src/utils/broken-install.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,EAAE;AACF,0EAA0E;AAC1E,kFAAkF;AAClF,iFAAiF;AACjF,+EAA+E;AAC/E,8BAA8B;AAC9B,EAAE;AACF,8DAA8D;AAC9D,EAAE;AACF,qDAAqD;AACrD,sEAAsE;AACtE,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,6EAA6E;AAC7E,2EAA2E;AAC3E,oDAAoD;AAQpD;;;;;;;;;GASG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAY;IACpD,MAAM,IAAI,GAAI,GAAuB,EAAE,IAAI,CAAC;IAC5C,OAAO,IAAI,KAAK,sBAAsB,IAAI,IAAI,KAAK,kBAAkB,CAAC;AACxE,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,MAAM,GAAG,GAAG,OAAQ,GAAuB,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAE,GAAuB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClH,iFAAiF;IACjF,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACrE,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IAClC,OAAO,IAA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AwB,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AACxB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAChD,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,aAAa,CAAC;IAC3D,MAAM,IAAI,GAAG,CAAC,SAAS;QACrB,CAAC,CAAC,uCAAuC;QACzC,CAAC,CAAC,wEAAwE;YACxE,6EAA6E;YAC7E,WAAW,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,YAAY;gBAC9C,CAAC,CAAC,mBAAmB,GAAG,oBAAoB;gBAC5C,CAAC,CAAC,YAAY;oBACZ,CAAC,CAAC,+BAA+B,GAAG,sBAAsB,SAAS,EAAE;oBACrE,CAAC,CAAC,oCAAoC,SAAS,EAAE,CAAC;IACxD,OAAO,CACL,gCAAgC,IAAI,MAAM;QAC1C,oGAAoG;QACpG,qGAAqG;QACrG,0CAA0C;QAC1C,gCAAgC;QAChC,2CAA2C;QAC3C,mGAAmG;QACnG,qGAAqG,CACtG,CAAC;AACJ,CAAC"}
|
package/dist/utils/origin.js
CHANGED
|
@@ -7,11 +7,22 @@
|
|
|
7
7
|
// orchestrator still reported "a DIFFERENT address" and advised pointing
|
|
8
8
|
// COMFYUI_URL at an origin it was already pointed at.
|
|
9
9
|
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
10
|
+
// NOT the workflow-instance fence — this header used to claim it was, and the
|
|
11
|
+
// claim was wrong. `workflowIdentityParts` (orchestrator/session-store.ts) treats
|
|
12
|
+
// the origin as a PRESENCE gate: it requires one to exist and never compares it
|
|
13
|
+
// against a previously bound value. Both of its callers read `.uuid` and nothing
|
|
14
|
+
// in the repo has ever read `identity.origin`, so two spellings of one host
|
|
15
|
+
// cannot make a fence "adopted under one spelling refuse under the other".
|
|
16
|
+
//
|
|
17
|
+
// That sentence is deleted rather than softened because of what believing it
|
|
18
|
+
// costs. The same false lead, in the pre-#1255 wording of the fence refusal
|
|
19
|
+
// itself, already burned one full investigation and a closed-unmerged PR; it
|
|
20
|
+
// then burned a second (#1321) via a stale quote of that message preserved in an
|
|
21
|
+
// issue thread. A comment asserting a caller that does not exist is the same
|
|
22
|
+
// defect as a message describing a check that does not run.
|
|
23
|
+
//
|
|
24
|
+
// If a fence ever does start comparing origins, wire it to `sameOrigin` and say
|
|
25
|
+
// so here — but the wiring must come first, and the sentence second.
|
|
15
26
|
//
|
|
16
27
|
// WHY THIS IS ITS OWN MODULE. Three loopback notions already exist
|
|
17
28
|
// (`isLoopbackServerUrl`, `port-owner`'s LOOPBACK/WILDCARD split,
|
package/dist/utils/origin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../../src/utils/origin.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,6EAA6E;AAC7E,uEAAuE;AACvE,yEAAyE;AACzE,sDAAsD;AACtD,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../../src/utils/origin.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,6EAA6E;AAC7E,uEAAuE;AACvE,yEAAyE;AACzE,sDAAsD;AACtD,EAAE;AACF,8EAA8E;AAC9E,kFAAkF;AAClF,gFAAgF;AAChF,iFAAiF;AACjF,4EAA4E;AAC5E,2EAA2E;AAC3E,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,iFAAiF;AACjF,6EAA6E;AAC7E,4DAA4D;AAC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9E,8EAA8E;IAC9E,4DAA4D;IAC5D,OAAO,GAAG,MAAM,CAAC,QAAQ,KAAK,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACnF,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,UAAU,CAAC,CAAqB,EAAE,CAAqB;IACrE,MAAM,IAAI,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IACjC,2EAA2E;IAC3E,6EAA6E;IAC7E,wBAAwB;IACxB,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,KAAK,CAAC;AAC9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comfyui-mcp",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.94",
|
|
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",
|