Client for one Model Context Protocol server, over stdio or Streamable HTTP.
The client runs the initialize handshake, lists the server's tools (following
nextCursor), and then forwards tools/call requests. It owns the protocol: request ids,
timeouts and the handshake. A SuperPi.MCP.Transport moves the messages:
commandstarts the server as an OS process (SuperPi.MCP.Transport.Stdio).urltalks to a hosted server (SuperPi.MCP.Transport.StreamableHTTP).
Use SuperPi.MCP.Manager to start every configured server and expose its tools to the
agent. This module only speaks the protocol. It declares no client capabilities, so a server
cannot ask for sampling, roots or elicitation; it may still send ping.
Summary
Functions
Waits until the handshake and the tool listing finish. Returns :ok or {:error, reason}.
Calls a tool. Returns {:ok, result} with the server's tools/call result map,
or {:error, reason} for a protocol error, a timeout, or a server that exited.
Returns a specification to start this module under a supervisor.
Starts a client. Options: :name (server name) and either :command, :args, :env (map), :cwd
(stdio) or :url, :headers (map, ${ENV_VAR} is expanded) for Streamable HTTP. :transport
names a SuperPi.MCP.Transport module explicitly.
Tool definitions as the server returned them (name, description, inputSchema).
Functions
Waits until the handshake and the tool listing finish. Returns :ok or {:error, reason}.
Calls a tool. Returns {:ok, result} with the server's tools/call result map,
or {:error, reason} for a protocol error, a timeout, or a server that exited.
Returns a specification to start this module under a supervisor.
See Supervisor.
Starts a client. Options: :name (server name) and either :command, :args, :env (map), :cwd
(stdio) or :url, :headers (map, ${ENV_VAR} is expanded) for Streamable HTTP. :transport
names a SuperPi.MCP.Transport module explicitly.
Returns {:error, {:command_not_found, command}} when the executable does not exist, and
{:error, {:invalid_url, url}} or {:error, {:missing_env, names}} for a bad url entry.
Tool definitions as the server returned them (name, description, inputSchema).