Ragex. MCP. Client
(Ragex v0.14.1)
View Source
Client for communicating with a running Ragex MCP server via Unix socket.
Allows mix tasks and other callers to delegate work to an already-running Ragex instance instead of starting a new BEAM VM (which would try to allocate GPU memory for Bumblebee a second time).
Usage
if Ragex.MCP.Client.server_running?() do
{:ok, conn} = Ragex.MCP.Client.connect()
{:ok, result} = Ragex.MCP.Client.call_tool(conn, "analyze_directory", %{"path" => "."})
Ragex.MCP.Client.disconnect(conn)
end
Summary
Functions
Calls an MCP tool on the remote server.
Opens a connection to the Ragex MCP socket server.
Closes the connection to the server.
Sends a ping to the server. Returns {:ok, response} or {:error, reason}.
Returns true if a Ragex MCP server is reachable on the Unix socket.
Types
@type t() :: %Ragex.MCP.Client{ request_id: non_neg_integer(), socket: :gen_tcp.socket() }
Functions
Calls an MCP tool on the remote server.
Returns {:ok, result} where result is the decoded JSON response,
or {:error, reason}.
Opens a connection to the Ragex MCP socket server.
Returns {:ok, conn} or {:error, reason}.
@spec disconnect(t()) :: :ok
Closes the connection to the server.
Sends a ping to the server. Returns {:ok, response} or {:error, reason}.
@spec server_running?() :: boolean()
Returns true if a Ragex MCP server is reachable on the Unix socket.
Sends a ping request and checks for a valid response.