Help us shape the future of Go! Take the 2026 Go Developer Survey

connect

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 5 Imported by: 0

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

View Source
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 Endpoint

func Endpoint(server string) string

Endpoint returns the URL of the MCP endpoint of the ratd at server, HOST:PORT.

func HTTPClient

func HTTPClient(side *mtls.Side) (*http.Client, error)

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

func Transport(side *mtls.Side, server string) (*mcp.StreamableClientTransport, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL