MCPcopy
hub / github.com/claude-code-best/claude-code / openBrowser

Function openBrowser

src/utils/browser.ts:39–68  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

37}
38
39export async function openBrowser(url: string): Promise<boolean> {
40 try {
41 // Parse and validate the URL
42 validateUrl(url)
43
44 const browserEnv = process.env.BROWSER
45 const platform = process.platform
46
47 if (platform === 'win32') {
48 if (browserEnv) {
49 // browsers require shell, else they will treat this as a file:/// handle
50 const { code } = await execFileNoThrow(browserEnv, [`"${url}"`])
51 return code === 0
52 }
53 const { code } = await execFileNoThrow(
54 'rundll32',
55 ['url,OpenURL', url],
56 {},
57 )
58 return code === 0
59 } else {
60 const command =
61 browserEnv || (platform === 'darwin' ? 'open' : 'xdg-open')
62 const { code } = await execFileNoThrow(command, [url])
63 return code === 0
64 }
65 } catch (_) {
66 return false
67 }
68}

Callers 15

runLoginFunction · 0.85
FeedbackFunction · 0.85
DesktopHandoffFunction · 0.85
FullscreenLayoutFunction · 0.85
ElicitationURLDialogFunction · 0.85
MCPRemoteServerMenuFunction · 0.85
UltraplanSessionDetailFunction · 0.85
handleSelectFunction · 0.85
BrowseMarketplaceFunction · 0.85
ManagePluginsFunction · 0.85
DiscoverPluginsFunction · 0.85
WebFunction · 0.85

Calls 2

validateUrlFunction · 0.85
execFileNoThrowFunction · 0.70

Tested by

no test coverage detected