fix(setup): register explicit MCP runtimes and preserve launcher identity

This commit is contained in:
morluto committed 2026-10-26 02:33:31 +08:00
1 parent b8ce3c74cd
commit d69a54d592
19 files changed
+637 -100

No files matched your search

+16 -6
View File
@@ -12,6 +12,7 @@ import { PRODUCT_IDENTITY } from "../identity.js";
import {
invokingPackageRunner,
registrationEntrypointPath,
registrationRuntimePath,
packageRunnerRegistrationCommand,
type PackageRunner,
} from "./ClientRegistrationIdentity.js";
@@ -21,6 +22,7 @@ import {
} from "./SetupRegistrationPrewarm.js";
import {
SUPPORTED_NODE_VERSION_PROSE,
javaScriptRuntime,
supportsNodeVersion,
} from "../domain/runtimeVersion.js";
import {
@@ -91,12 +93,20 @@ export const setupRegistrationCommand = (
if (packageRunner !== undefined)
return packageRunnerRegistrationCommand(packageRunner, platform);
if (entrypointPath === undefined || entrypointPath.length === 0) return [];
return platform === "win32"
? [process.execPath, entrypointPath, "mcp"]
: [
registrationEntrypointPath(entrypointPath, environment, platform),
"mcp",
];
const script = registrationEntrypointPath(
entrypointPath,
environment,
platform,
);
const runtime = registrationRuntimePath(
process.execPath,
javaScriptRuntime(process.versions).id,
environment,
platform,
);
// The script's env-node shebang depends on the client's PATH, which may
// differ from setup's shell. Bind the runtime that is executing setup.
return [runtime, script, "mcp"];
};
/**