INNER CODE UNIT · JavaScript

isLoopbackHost

aeonfun/opendia · opendia-mcp/server.js:50

function isLoopbackHost(host) {
  return host === '127.0.0.1' || host === '::1' || host === 'localhost';
}

// Once the MCP surface is reachable beyond this machine — widened bind or an
// ngrok tunnel — loopback stops being the boundary and callers must present a
// token. Locally it stays off so existing setups keep working untouched.
const explicitToken = argValue('--token');
const requiresToken = enableTunnel || !isLoopbackHost(HTTP_HOST);
const AUTH_TOKEN = requiresToken
  ? (explicitToken ?? crypto.randomBytes(24).toString('hex'))
  : null;

// Kept in step with opendia-mcp/package.json by the release checklist.
// package.json can't be required: the published package ships only server.js.
const SERVER_VERSION = '1.1.1';

// Default ports

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…