frontdoor

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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)
	// 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 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

func NewBare(res *core.Resolution, sink core.AuditSink, meta *Meta) *Server

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) Handler

func (s *Server) Handler() http.Handler

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

func (s *Server) ServeConn(ctx context.Context, t mcp.Transport) error

ServeConn serves the governed surface over an arbitrary transport — stdio in production, in-process pipes in tests.

func (*Server) ServeStdio

func (s *Server) ServeStdio(ctx context.Context) error

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.

Jump to

Keyboard shortcuts

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