MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / ephemeralPort

Function ephemeralPort

src/mcp/auth.ts:309–315  ·  view source on GitHub ↗

Pick an ephemeral loopback port for the callback server.

()

Source from the content-addressed store, hash-verified

307
308/** Pick an ephemeral loopback port for the callback server. */
309function ephemeralPort(): number {
310 // Bind to port 0 and read back the assigned port, then close immediately.
311 const probe = http.createServer().listen(0, "127.0.0.1")
312 const addr = probe.address()
313 probe.close()
314 return typeof addr === "object" && addr ? addr.port : 8765
315}
316
317/** Build an OAuthClientProvider from an McpOAuthConfig. Returns the provider
318 * plus a callback-port hint (for the interactive flow). */

Callers 1

buildAuthProviderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected