Documentation
¶
Overview ¶
Package bridge is the runner image's bridge role: a stdio MCP server the gateway launches like any declared server, which forwards each message to one remote MCP server over streamable HTTP, or over the older HTTP+SSE transport where that is all the server speaks.
It exists because the pinned gateway would dial a remote server from its own process, and the gateway has no network leg. The bridge runs in its own container on the gateway's relay network, so the remote host is reached through that host's digest-pinned relay and nothing else, under the run's docker filter and the policy's runtime.
Its credential is never in its environment and never in the gateway's secrets file: it is read from a file in a run-owned folder, mounted read-only, at every request, so a token the runner renews mid-run is used at once. A 401 or 403 ends that one call with a sentence naming the server; the session goes on.
Stdlib only: the package is embedded in the runner image's build context.
Index ¶
Constants ¶
const ( // MaxMessage bounds one JSON-RPC message in either direction: a line // from the gateway, a response body, or one SSE event's data. MaxMessage = 16 << 20 // MaxToken bounds the bearer file; a token is far shorter. MaxToken = 16 << 10 )
Variables ¶
This section is empty.
Functions ¶
func DefaultClient ¶
DefaultClient is the bridge's HTTP client: no proxy from the environment (the relay is reached by the host's own name), TLS 1.2 or later, bounded connection set-up, and no redirect followed, since a redirect could carry the call, and its bearer, to an address no one declared.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge is a running bridge.
type Config ¶
type Config struct {
// URL is the remote server's https address.
URL string
// TokenFile, when set, holds the bearer value, read at every request.
// An empty file sends no Authorization header (an optional secret the
// run goes without). Unset, the server is declared auth: none.
TokenFile string
// OAuth says the token is a connection's OAuth access token (auth:
// oauth), not a secret the person set: a 401 then names the connection
// and says a new run is given a fresh token.
OAuth bool
// Client is the HTTP client; nil builds one that takes no proxy from
// the environment and follows no redirect.
Client *http.Client
// Lost is called when the HTTP+SSE transport's event stream ends: the
// only way the server's answers come back is gone, and the gateway must
// see a dead server. Nil logs and exits the process.
Lost func(error)
// Log receives diagnostics (the container's stderr, which the gateway
// relays into its log). Never a token, never a message body.
Log io.Writer
}
Config is one bridge.