Update src/services/worker-service.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -6,15 +6,30 @@
|
|||||||
* See src/services/worker/README.md for architecture details.
|
* See src/services/worker/README.md for architecture details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Windows terminal window fix: Set process.type to trick MCP SDK into enabling windowsHide
|
/**
|
||||||
// The SDK checks `process.type === 'renderer'` (Electron detection) before setting windowsHide.
|
* Windows terminal window fix for MCP SDK (vX.Y.Z):
|
||||||
// By setting process.type, the SDK's isElectron() check becomes truthy on Windows, hiding
|
* The MCP SDK checks `process.type === 'renderer'` (Electron detection) before setting windowsHide.
|
||||||
// terminal windows when spawning uvx/python processes for Chroma MCP server.
|
* By setting process.type, the SDK's isElectron() check becomes truthy on Windows, hiding
|
||||||
// The type is sometimes not present resulting in the check being false. Setting it like this fixes it
|
* terminal windows when spawning uvx/python processes for Chroma MCP server.
|
||||||
|
* The type is sometimes not present resulting in the check being false. Setting it like this fixes it.
|
||||||
|
*
|
||||||
|
* TODO: Remove this workaround once MCP SDK exposes a config for windowsHide or fixes detection.
|
||||||
|
* See: https://github.com/modelcontextprotocol/sdk/issues/XXX
|
||||||
|
*/
|
||||||
|
function applyWindowsHideWorkaroundIfNeeded() {
|
||||||
if (process.platform === 'win32' && !process.type) {
|
if (process.platform === 'win32' && !process.type) {
|
||||||
|
// Optionally, check MCP SDK version here if available
|
||||||
|
// Log a warning so this is visible in logs
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.warn(
|
||||||
|
'[worker-service] Applying MCP SDK windowsHide workaround: setting process.type = "renderer". ' +
|
||||||
|
'This is a fragile hack. Remove when MCP SDK is fixed. See code comments for details.'
|
||||||
|
);
|
||||||
(process as any).type = 'renderer';
|
(process as any).type = 'renderer';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
applyWindowsHideWorkaroundIfNeeded();
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import http from 'http';
|
import http from 'http';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|||||||
Reference in New Issue
Block a user