MCPcopy Index your code
hub / github.com/github/copilot-sdk / for_tcp

Method for_tcp

python/copilot/client.py:310–336  ·  view source on GitHub ↗

Spawn a runtime child process listening on a TCP socket. Args: port: TCP port to listen on. ``0`` (the default) auto-allocates a free port. If the chosen port is already in use, startup fails. connection_token: Optional shared secret t

(
        *,
        port: int = 0,
        connection_token: str | None = None,
        path: str | None = None,
        args: Sequence[str] = (),
    )

Source from the content-addressed store, hash-verified

308
309 @staticmethod
310 def for_tcp(
311 *,
312 port: int = 0,
313 connection_token: str | None = None,
314 path: str | None = None,
315 args: Sequence[str] = (),
316 ) -> TcpRuntimeConnection:
317 """Spawn a runtime child process listening on a TCP socket.
318
319 Args:
320 port: TCP port to listen on. ``0`` (the default) auto-allocates
321 a free port. If the chosen port is already in use, startup
322 fails.
323 connection_token: Optional shared secret the SDK sends to the
324 spawned runtime to authenticate the TCP connection. When
325 ``None``, a UUID is generated automatically so the loopback
326 listener is safe by default.
327 path: Path to the runtime executable. When ``None``, uses the
328 bundled binary.
329 args: Extra command-line arguments passed to the runtime process.
330 """
331 return TcpRuntimeConnection(
332 path=path,
333 args=tuple(args),
334 port=port,
335 connection_token=connection_token,
336 )
337
338 @staticmethod
339 def for_uri(url: str, *, connection_token: str | None = None) -> UriRuntimeConnection:

Calls 1