MCPcopy Index your code
hub / github.com/simstudioai/sim / isLocalhostHostname

Function isLocalhostHostname

apps/sim/lib/mcp/domain-check.ts:117–121  ·  view source on GitHub ↗

* Returns true if the hostname is localhost or a loopback IP literal. * Expects IPv6 brackets to already be stripped.

(hostname: string)

Source from the content-addressed store, hash-verified

115 * Expects IPv6 brackets to already be stripped.
116 */
117function isLocalhostHostname(hostname: string): boolean {
118 const clean = hostname.toLowerCase()
119 if (clean === 'localhost') return true
120 return ipaddr.isValid(clean) && isLoopbackIP(clean)
121}
122
123/**
124 * Validates an MCP server URL against SSRF attacks by resolving DNS and

Callers 1

validateMcpServerSsrfFunction · 0.85

Calls 1

isLoopbackIPFunction · 0.85

Tested by

no test coverage detected