MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / getSocketPath

Function getSocketPath

src/daemon/utils.ts:27–47  ·  view source on GitHub ↗
(sessionId: string)

Source from the content-addressed store, hash-verified

25
26// Using these paths due to strict limits on the POSIX socket path length.
27export function getSocketPath(sessionId: string): string {
28 const uid = os.userInfo().uid;
29 const suffix = sessionId ? `-${sessionId}` : '';
30 const appName = APP_NAME + suffix;
31
32 if (IS_WINDOWS) {
33 // Windows uses Named Pipes, not file paths.
34 // This format is required for server.listen()
35 return path.join('\\\\.\\pipe', appName, 'server.sock');
36 }
37
38 // 1. Try XDG_RUNTIME_DIR (Linux standard, sometimes macOS)
39 if (process.env.XDG_RUNTIME_DIR) {
40 return path.join(process.env.XDG_RUNTIME_DIR, appName, 'server.sock');
41 }
42
43 // 2. macOS/Unix Fallback: Use /tmp/
44 // We use /tmp/ because it is much shorter than ~/Library/Application Support/
45 // and keeps us well under the 104-character limit.
46 return path.join('/tmp', `${appName}-${uid}.sock`);
47}
48
49export function getRuntimeHome(sessionId: string): string {
50 const platform = os.platform();

Callers 2

daemon.tsFile · 0.85
sendCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected