Documentation
¶
Overview ¶
Package connect is how a client reaches ratd: the defaults of rat that ratd and its clients share (the path ratd serves, the port it listens on unless told otherwise), and what a client in Go needs beyond package mtls: the endpoint of a ratd, the HTTP client presenting its certificate, and the transport of an MCP client of the Go SDK built on it (Transport).
The addresses of ratd are HOST:PORT rather than URLs: the scheme is always https and the path always Path, less to get wrong. It holds no command line: the flags of rat and rat-tool are theirs (internal/flags), and a program importing this package gets no dependency for them.
Index ¶
Constants ¶
const ( // Path is the only path ratd serves: the convention of the MCP specification and of the SDK. Path = "/mcp" // DefaultPort is the port ratd listens on unless told otherwise: 7281 reads "RAT!" on a phone // keypad. DefaultPort = "7281" )
Variables ¶
This section is empty.
Functions ¶
func HTTPClient ¶
HTTPClient returns an HTTP client presenting the certificate of side, a client directory of a bundle, and checking ratd as package mtls does. Its transport is its own, cloned from the default one: setting the configuration on http.DefaultTransport would change a global of the process, and a bare http.Transport loses the defaults (proxy from the environment, dial and handshake timeouts). It has no timeout: callers bound each request.
func Transport ¶
Transport returns the transport of an MCP client of the Go SDK reaching the ratd at server (HOST:PORT), presenting the certificate of side, a client side of a bundle (mtls.Load or mtls.Parse): the only addition ratd asks of a standard MCP client.
side, err := mtls.Load("clients/alice")
transport, err := connect.Transport(side, "host:7281")
session, err := mcp.NewClient(implementation, nil).Connect(ctx, transport, nil)
Types ¶
This section is empty.