Ragex. MCP. SocketPath
(Ragex v0.32.0)
View Source
Resolves the Unix domain socket path used by the MCP socket server and its clients (bin/ragex-mcp, bin/ragex-bridge, Ragex.MCP.Client, editor plugins).
Running ragex "in the wild" means several independent instances may be
active on the same machine at once -- one per project, or one per dllb
backend port. A single hardcoded /tmp/ragex_mcp.sock causes one instance
to steal the socket file out from under another, or causes a client to
bridge into the wrong server entirely.
To avoid that, the path is namespaced using this precedence:
RAGEX_MCP_SOCK-- explicit override, used verbatim. Mirrors dllb's ownDLLB_SOCKescape hatch.DLLB_PORT-- if set, this instance is tied to a specificdllbserver port, so the socket is namespaced by that port:ragex_mcp_<port>.sock.- Otherwise, namespaced by the identity of the project being served:
RAGEX_PROJECT, thenRAGEX_AUTO_ANALYZE, then the current working directory, sanitized intoragex_mcp_<sanitized_path>.sock.
Bash callers (bin/ragex-mcp) must implement the exact same precedence so that a launcher script and the BEAM VM it starts always agree on the socket path.
Summary
Functions
Resolves the socket path as a charlist, ready for :gen_tcp :local addresses.
Resolves the socket path as a binary string.