MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getAllSocketPaths

Function getAllSocketPaths

src/utils/claudeInChrome/common.ts:492–527  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

490 * and legacy fallback paths
491 */
492export function getAllSocketPaths(): string[] {
493 // Windows uses named pipes, not Unix sockets
494 if (platform() === 'win32') {
495 return [`\\\\.\\pipe\\${getSocketName()}`]
496 }
497
498 const paths: string[] = []
499 const socketDir = getSocketDir()
500
501 // Scan for *.sock files in the socket directory
502 try {
503 // eslint-disable-next-line custom-rules/no-sync-fs -- ClaudeForChromeContext.getSocketPaths (external @ant/claude-for-chrome-mcp) requires a sync () => string[] callback
504 const files = readdirSync(socketDir)
505 for (const file of files) {
506 if (file.endsWith('.sock')) {
507 paths.push(join(socketDir, file))
508 }
509 }
510 } catch {
511 // Directory may not exist yet
512 }
513
514 // Legacy fallback paths
515 const legacyName = `claude-mcp-browser-bridge-${getUsername()}`
516 const legacyTmpdir = join(tmpdir(), legacyName)
517 const legacyTmp = `/tmp/${legacyName}`
518
519 if (!paths.includes(legacyTmpdir)) {
520 paths.push(legacyTmpdir)
521 }
522 if (legacyTmpdir !== legacyTmp && !paths.includes(legacyTmp)) {
523 paths.push(legacyTmp)
524 }
525
526 return paths
527}
528
529function getSocketName(): string {
530 // NOTE: This must match the one used in the Claude in Chrome MCP

Callers

nothing calls this directly

Calls 6

readdirSyncFunction · 0.90
platformFunction · 0.85
getSocketNameFunction · 0.85
getSocketDirFunction · 0.85
getUsernameFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected