# ADR 0019: MCP Over The Cloud Gateway ## Status Accepted (supersedes the transport of [ADR-0017](adr-0017-mcp-remote-lua-execution.md)) ## Date 2026-06-15 ## Context The MCP tools (`probe-computers`, `exec-lua`, `write-file`) shipped in `tools/mcp-bridge` ([ADR-0017](adr-0017-mcp-remote-lua-execution.md)) over a dedicated CC-link WebSocket and the `mcp-computer` / `mcp-computer-server` Lua programs. Meanwhile `tools/trapos-server` introduced a second, richer host↔computer connection: a single persistent gateway WebSocket per computer (`servers/cloud` + `apis/libcloud`), a hello handshake with a shared secret, a coded error model, and a bidirectional request/reply (`GatewayRegistry.request` → `server_request` → `computer_response`). Running both stacks meant two sockets, two protocols, and a second autostart daemon per computer. The cloud gateway already had everything MCP needs. ## Decision Move the MCP features onto the cloud gateway and retire the dedicated MCP transport. - **Host (`tools/trapos-server`):** a second Fastify listener (`src/modules/mcp`) bound to `127.0.0.1` (default `MCP_PORT=4445`) speaks the same custom JSON-RPC 2.0 as the old bridge. Each tool call is a `GatewayRegistry.request(networkId, traposId, type, payload)` reusing the existing gateway socket. Computers are addressed by **`traposId`** (`":