Documentation
¶
Overview ¶
Package client provides shared MCP client creation and initialization logic used by both the CLI and TUI.
It wraps the mcp-go SDK client constructors and handles transport selection, auto-detection (streamable-http with SSE fallback), and the MCP initialize handshake using the ToolHive version reported by versions.GetVersionInfo.
Index ¶
Constants ¶
const TransportAuto = "auto"
TransportAuto is the sentinel value that triggers auto-detection of the transport type (try streamable-http first, then fall back to SSE).
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(ctx context.Context, serverURL, transport, clientName string) (*mcpclient.Client, error)
Connect creates an MCP SDK client for the given serverURL and transport, starts the underlying transport, and performs the MCP initialize handshake.
The clientName is included in the ClientInfo sent during initialization (e.g. "toolhive-cli" or "toolhive-tui").
transport must be one of:
- TransportAuto -- try streamable-http, fall back to SSE
- "sse"
- "streamable-http"
The returned client is fully connected and ready for use. The caller is responsible for calling Close when done.
Types ¶
This section is empty.