diff --git a/src/bin/check-latest-version.ts b/src/bin/check-latest-version.ts index eb45674df..6e713187a 100644 --- a/src/bin/check-latest-version.ts +++ b/src/bin/check-latest-version.ts @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import {execSync} from 'node:child_process'; import fs from 'node:fs/promises'; import path from 'node:path'; import process from 'node:process'; @@ -12,8 +13,17 @@ const cachePath = process.argv[2]; if (cachePath) { try { + let registry; + try { + registry = execSync('npm config get registry', { + encoding: 'utf8', + }).trim().replace(/\/$/, ''); + } catch { + // npm not on PATH, fall back to default + } + registry ||= 'https://registry.npmjs.org'; const response = await fetch( - 'https://registry.npmjs.org/chrome-devtools-mcp/latest', + `${registry}/chrome-devtools-mcp/latest`, ); const data = response.ok ? await response.json() : null;