# IPC in AI Tooling: Why GitLab Chose stdio Transport over Local HTTP for MCP

> Source: <https://dev.to/aryan_rajput_81602becc3f6/ipc-in-ai-tooling-why-gitlab-chose-stdio-transport-over-local-http-for-mcp-546j>
> Published: 2026-11-16 12:43:31+00:00

Bind a local HTTP server to `127.0.0.1` for an AI coding agent on a multi-tenant developer workstation or shared build host, and you immediately inherit port-collision races, DNS-rebinding vectors, ambient localhost SSRF exposure, and orphaned daemon processes that outlive the parent IDE session.

When architecting local Model Context Protocol (MCP) bridges—such as `glab mcp serve` and the GitLab Language Server (`gitlab-lsp --stdio`)—the transport layer dictates both the security boundary and the process lifecycle contract. Local HTTP requires opening a TCP listener on the loopback interface, negotiating ephemeral ports, managing CORS preflights, and implementing custom bearer-token handshakes just to verify that a local socket caller is actually the spawning IDE rather than an unprivileged local process probing `localhost` ports. By contrast, anonymous UNIX pipes over `stdin`/` stdout` (`stdio` transport) enforce kernel-level file-descriptor inheritance: only the parent process that calls `fork()`/` execve()` holds the write end of the child's `stdin` pipe and the read end of its `stdout` pipe. There is zero network surface area, zero TLS/port provisioning overhead, and deterministic backpressure governed directly by the kernel pipe buffer.

However, relying on `stdio` lifecycle semantics across heterogeneous execution environments exposes subtle kernel-level signal edge cases. While working on [MR !4793 (`test(cli): ignore SIGHUP during scenario cleanup on gVisor runners`)](https://gitlab.com/gitlab-org/editor-extensions/gitlab-lsp/-/merge_requests/4793) for `gitlab-lsp`, I investigated why CLI end-to-end tests communicating over `stdio` passed on standard Linux VMs but failed deterministically during teardown on sandboxed gVisor CI runners. When the parent closed `stdin` (signaling EOF to the MCP/LSP child process) and the cleanup routine killed its own process group to reap child workers, gVisor's user-space sentry kernel (`google/gvisor` commit `553528ee10349d5235f364c4e2cc500f0d4c488a`) delivered `SIGHUP` across the foreground process group differently than a native Linux kernel on session-leader exit.

Fixing this required surgical signal handling directly inside the `stdin` EOF teardown path in [MR !4793](https://gitlab.com/gitlab-org/editor-extensions/gitlab-lsp/-/merge_requests/4793): registering a scoped `SIGHUP` listener at the exact transition where `stdin` closes and the process terminates its own process group, without globally masking `SIGHUP` during active execution (which would disarm the CI runner's own timeout watchdog).

GitLab's MCP architecture pairs zero-trust local `stdio` process isolation in `glab` and `gitlab-lsp` with gVisor-sandboxed CI verification and OAuth 2.0 Dynamic Client Registration to the remote `/api/v4/mcp` server—giving enterprises end-to-end cryptographic identity without exposing a single unauthenticated local TCP port.

**Architectural Takeaway:** Prefer `stdio` pipes over loopback HTTP for local AI agent IPC to get kernel-enforced descriptor isolation and automatic EOF lifecycle coupling—and explicitly test POSIX signal propagation (`SIGHUP`/` SIGTERM`) under sandboxed kernels like gVisor.
