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 {
Search func(ctx context.Context, query string) ([]core.ToolInfo, error)
List func(ctx context.Context, 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 an approval request for unapproved tools — the agent's
// formal ask; a human still approves. Returns the newly queued names.
Request func(ctx context.Context, names []string, 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)
// Report returns the live gateway status for toolhost__status.
Report func() any
// Audit tails the audit log — the evidence trail of calls, denials, and
// governance actions — so agents can introspect without file access.
Audit func(ctx context.Context, limit int, kind string) ([]core.Event, error)
}
Meta wires the gateway's own control-plane tools — registered under the reserved toolhost__ 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 toolhost__* 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. DNS rebinding protection stays on either way (SDK default: non-localhost Host headers on localhost addresses get 403).
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.