Documentation
¶
Overview ¶
Package client finds and connects to a sailwright-gateway from inside a container.
Discovery order:
- SAILWRIGHT_GATEWAY_URL, either http(s)://host:port/mcp or unix:///path/to/gateway.sock
- the agent socket in SAILWRIGHT_GATEWAY_DIR (default /run/sailwright-gateway), if it accepts connections (Linux containers with the agent dir bind-mounted)
- http://host.docker.internal:7391/mcp (Docker Desktop on macOS and Windows)
The token comes from SAILWRIGHT_GATEWAY_TOKEN or <dir>/token.
Index ¶
Constants ¶
const ( EnvURL = "SAILWRIGHT_GATEWAY_URL" EnvToken = "SAILWRIGHT_GATEWAY_TOKEN" EnvDir = "SAILWRIGHT_GATEWAY_DIR" DefaultDir = "/run/sailwright-gateway" DefaultTCPURL = "http://host.docker.internal:7391/mcp" )
Environment variables and defaults used for discovery.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(ctx context.Context, endpoint Endpoint, impl *mcp.Implementation) (*mcp.ClientSession, error)
Connect opens an MCP client session to the gateway.
Types ¶
type Bridge ¶
Bridge serves the gateway's tools over another MCP transport (usually stdio), so any agent harness that can start a command can use the gateway. Tool calls are forwarded unchanged; the gateway enforces its policy as usual.
type Endpoint ¶
type Endpoint struct {
// URL is the HTTP endpoint; for socket endpoints it is a placeholder host.
URL string
// Socket is the Unix socket path, if the gateway is reached over a socket.
Socket string
Token string
// Source explains how the endpoint was found.
Source string
}
Endpoint is a resolved gateway address plus token.
func Discover ¶
Discover resolves the gateway endpoint from the environment and the mounted agent dir.
func (Endpoint) HTTPClient ¶
HTTPClient returns an HTTP client that reaches the endpoint and sends the token.