MCPcopy Create free account
hub / github.com/backnotprop/plannotator / getServerPort

Function getServerPort

packages/server/remote.ts:51–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49 * Get the server port to use
50 */
51export function getServerPort(): number {
52 // Explicit port from environment takes precedence
53 const envPort = process.env.PLANNOTATOR_PORT;
54 if (envPort) {
55 const parsed = parseInt(envPort, 10);
56 if (!isNaN(parsed) && parsed >= 0 && parsed < 65536) {
57 return parsed;
58 }
59 console.error(
60 `[Plannotator] Warning: Invalid PLANNOTATOR_PORT "${envPort}", using default`
61 );
62 }
63
64 // Remote sessions use fixed port for port forwarding; local uses random
65 return isRemoteSession() ? DEFAULT_REMOTE_PORT : 0;
66}
67
68/**
69 * Bind local sessions to loopback, but keep remote sessions reachable via the

Callers 5

startPlannotatorServerFunction · 0.90
remote.test.tsFile · 0.90
startGoalSetupServerFunction · 0.90
startReviewServerFunction · 0.90
startAnnotateServerFunction · 0.90

Calls 1

isRemoteSessionFunction · 0.70

Tested by

no test coverage detected