Documentation
¶
Overview ¶
Package frontdoor is the driving adapter: the HTTP+MCP surface agents connect to. It registers exactly what core.Resolve produced — no lookup, no filter at request time; invisible was made uncallable at assembly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Meta ¶
type Meta struct {
// Discover is the agent's catalog view — search and list folded into
// one revelation verb: query matches name/description, scope narrows
// ("all" default, "enabled", "approved").
Discover func(ctx context.Context, query, scope string) ([]core.ToolInfo, error)
Enable func(ctx context.Context, names []string) ([]string, error)
Disable func(ctx context.Context, names []string) ([]string, error)
// Request files petitions — unapproved tool names, or whole proposed
// servers the human may materialize. Returns the newly queued names.
// A request never widens anything by itself; a human answers it.
Request func(ctx context.Context, names []string, servers []core.ServerSpec, reason string) ([]string, error)
// Status reports one qualified name's governance state — used to give
// precise refusal reasons ("approved but disabled" vs "not approved").
Status func(name string) (core.ToolInfo, bool)
// BackendState reports a namespace's liveness for refusal precision:
// "up", "down" (configured but unreachable — reconnecting), "disabled"
// (parked by a human), or "" when the namespace isn't configured.
BackendState func(ns string) string
// Report returns the live gateway status — served at GET /status for
// the CLI and harnesses, never exposed as a tool.
Report func() any
// CallErr reports a backend Call failure with the session that served
// it — the gateway uses it to retire dead sessions Wait() can't see.
CallErr func(up core.Upstream, err error)
}
Meta wires the gateway's own control-plane tools — registered under the reserved gateway__ namespace and always present regardless of the governed surface. They let the agent discover and control tools at runtime; approval still gates enablement (enforced in the implementation, not here).
type Options ¶
type Options struct {
Stateless bool
}
Options controls front-door serving. Stateless is the primary mode (SEP-2567 sessionless): no Mcp-Session-Id, each request gets a temporary session. Modern clients can receive pushed tools/list_changed through subscriptions/listen; older clients served sessionlessly cannot. The gateway__* meta-tools are the pull-based path. Stateful is the compat opt-in for older clients that must hold a session for pushed list changes. Origin and DNS rebinding checks cover every route either way (localOnly).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the governed /mcp endpoint plus an unauthenticated /healthz.
func New ¶
func New(res *core.Resolution, token string, sink core.AuditSink, meta *Meta, opts *Options) (*Server, error)
New builds the front door over a Resolution. Each resolved tool becomes a go-sdk registration whose handler closes over its upstream — dispatch is wiring, not a lookup.
func NewBare ¶
NewBare builds the governed surface with no HTTP wiring — for the stdio front door, where the pipe's owner IS the authority (no bearer needed).
func (*Server) Reload ¶
func (s *Server) Reload(res *core.Resolution)
Reload swaps the served tool set in place: tools removed or re-pointed at a reconnected upstream are unregistered, new ones added. The SDK emits notifications/tools/list_changed to subscribed modern clients and legacy stateful sessions, so they can see the new surface without reconnecting.
func (*Server) ServeConn ¶
ServeConn serves the governed surface over an arbitrary transport — stdio in production, in-process pipes in tests.
func (*Server) ServeStdio ¶
ServeStdio speaks MCP over stdin/stdout — the same governed surface as a stdio server, for clients that only spawn subprocesses. Blocks until the pipe closes or ctx ends. Reloads still land: AddTool/RemoveTools emit tools/list_changed down the pipe like any notification.