localmcp

package
v0.149.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConversationBrokerRunning = errors.New("host mailbox broker already running for this execution")

Functions

func AttachWingIO added in v0.149.0

func AttachWingIO(ctx context.Context, dir, clientName, session string, input io.Reader, output io.Writer, options egg.AttachOptions) (bool, error)

AttachWingIO only presents a stream; the wing resolves identity and sessions.

func BrowserSessionControl

func BrowserSessionControl(version string, ctx context.Context, cfg *config.Config, wc *config.WingConfig, req ws.TunnelRequest, operation string, arguments json.RawMessage, home string, sharedHost bool, launchConfig ...BrowserLaunchConfig) (map[string]any, error)

browserSessionControl is a narrow adapter over the same typed MCP handlers. Authentication/passkey/purpose checks occur before this dispatcher; artifact access is checked independently before selecting a legacy session principal.

func CallLocalWingTool added in v0.149.0

func CallLocalWingTool(ctx context.Context, dir, clientName, name string, arguments json.RawMessage) (map[string]any, error)

CallLocalWingTool also lets CLI helpers use the wing's authority and runtime.

func ConversationBrokerStatus

func ConversationBrokerStatus(cfg *config.Config, session string) (map[string]any, error)

func GrantSet

func GrantSet(grants []string) map[string]bool

func InheritConversationExecution

func InheritConversationExecution(cfg *config.Config, source, target string) error

func LifecycleResult

func LifecycleResult(view egg.SessionView) map[string]any

func ListenLocalWingControl added in v0.149.0

func ListenLocalWingControl(ctx context.Context, version string, sessions *wingsession.Service, ownerUserID string, admission *AdmissionState) (*controlsocket.Server, error)

ListenLocalWingControl is called only by the personal wing, independently of its relay connection. The owner comes from durable local state, never IPC.

func LoadLocalMCPClientsConfig

func LoadLocalMCPClientsConfig(cfg *config.Config) (localMCPClientsConfig, error)

func PrepareConversationResumeMCP

func PrepareConversationResumeMCP(version string, cfg *config.Config, wc *config.WingConfig, start ws.PTYStart, eggCfg *egg.EggConfig, sharedHost bool) ([]string, string, error)

Called only after prepareBrowserResume has verified the source owner, provider identity and current workspace policy.

func ResolveWorkingDirectory

func ResolveWorkingDirectory(cwd string) (string, error)

func RoostNativeMCPTools

func RoostNativeMCPTools(version string, cfg *config.Config, sharedHost bool, sources ...func() (*config.WingConfig, *egg.EggConfig)) []mcppkg.NativeTool

roostNativeMCPTools adapts the local typed control surface to authenticated Streamable HTTP MCP. The request principal is supplied by the roost after bearer-token verification and never accepted from tool arguments.

func RoostNativeMCPToolsWithSessions added in v0.149.0

func RoostNativeMCPToolsWithSessions(version string, cfg *config.Config, sharedHost bool, sessionSource func() *wingsession.Service, sources ...func() (*config.WingConfig, *egg.EggConfig)) []mcppkg.NativeTool

func RunConversationBroker

func RunConversationBroker(version string, ctx context.Context, cfg *config.Config, session string, logs io.Writer) error

func RunConversationWakeController

func RunConversationWakeController(version string, ctx context.Context, cfg *config.Config, policy func() (*config.WingConfig, bool), sessions *wingsession.Service, ownerUserID string)

Started by the existing host wing daemon. No provider process, credentials, grants, permission replies, or new transport listeners are created here.

func ServeConversationMailboxClient

func ServeConversationMailboxClient(ctx context.Context, in io.Reader, out io.Writer, dir, conversation, session string) error

serveConversationMailboxClient is `wt mcp stdio --host-mailbox`. It needs no Wingthing state access: it forwards each MCP request to the host broker and writes back the broker's response with the caller's JSON-RPC ID.

func ServeDirectMCPChannelWithPolicySource

func ServeDirectMCPChannelWithPolicySource(version string, cfg *config.Config, home string, sharedHost bool, admission *AdmissionState, identity webrtcpkg.PeerIdentity, dc *pionwebrtc.DataChannel, policySource func() (*config.WingConfig, []config.AllowKey), eggSources ...func() *egg.EggConfig)

func ServeLocalWingClient added in v0.149.0

func ServeLocalWingClient(ctx context.Context, version, dir, clientName, conversation string, unsandboxed bool, in io.Reader, out io.Writer) error

ServeLocalWingClient owns only the MCP transport. All authority and execution belong to the independently running wing selected by its state directory.

func ServeRememberedWingClient added in v0.149.0

func ServeRememberedWingClient(ctx context.Context, version, dir, clientName string, unsandboxed bool, timeout time.Duration, in io.Reader, out io.Writer) error

ServeRememberedWingClient is a thin stdio adapter. SSH keys and the connection pool remain in the independently running local wing.

func ValidateBoundConversation

func ValidateBoundConversation(s *Server) error

func ValidateDirectMCPGrantConfig

func ValidateDirectMCPGrantConfig(wingCfg *config.WingConfig) error

Types

type AdmissionState

type AdmissionState struct {
	Sessions *wingsession.Service
	// contains filtered or unexported fields
}

mcpAdmissionState keeps process-local spawn admission shared across reconnecting remote MCP clients. The filesystem-backed max-sessions check is also serialized by this lock, so two data channels cannot race through the final available slot. This remains a guardrail rather than a durable quota across wing restarts.

func NewMCPAdmissionState

func NewMCPAdmissionState() *AdmissionState

type BrowserLaunchConfig

type BrowserLaunchConfig struct {
	Sessions             *wingsession.Service
	PublicKey, AuthToken string
	EggConfig            *egg.EggConfig
	Tools                []*config.ToolConfig
}

type ConnectMCPServer

type ConnectMCPServer struct {
	Version string
	In      io.Reader
	Out     io.Writer
	Actor   string
	Tunnel  connectMCPTunnel
	Timeout time.Duration

	Controls map[string]*webrtcpkg.ControlClient
	// contains filtered or unexported fields
}

func (*ConnectMCPServer) Close

func (s *ConnectMCPServer) Close()

func (*ConnectMCPServer) Serve

func (s *ConnectMCPServer) Serve(ctx context.Context) error

type LocalMCPTool

type LocalMCPTool = control.Tool

func LocalMCPTools

func LocalMCPTools() []LocalMCPTool

type Server

type Server struct {
	Sessions *wingsession.Service

	Version          string
	Cfg              *config.Config
	In               io.Reader
	Out              io.Writer
	Logs             io.Writer
	Principal        string
	Unsandboxed      bool
	Grants           map[string]bool
	MaxSessions      int
	MaxSpawnsPerHour int

	Actor             string
	MCPClient         string // local clients.yaml identity, independent of the audit actor
	BoundConversation string
	Surface           control.Surface
	// contains filtered or unexported fields
}

func (*Server) AgentWaitAny

func (s *Server) AgentWaitAny(ctx context.Context, arguments json.RawMessage) (map[string]any, error)

AgentWaitAny exposes the shared wing operation to authenticated adapters.

func (*Server) Serve

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

func (*Server) ToolConversationList

func (s *Server) ToolConversationList(arguments json.RawMessage) (map[string]any, error)

func (*Server) ToolConversationRead

func (s *Server) ToolConversationRead(ctx context.Context, arguments json.RawMessage) (map[string]any, error)

func (*Server) ToolConversationWake

func (s *Server) ToolConversationWake(arguments json.RawMessage) (map[string]any, error)

func (*Server) ToolSessionFork

func (s *Server) ToolSessionFork(ctx context.Context, arguments json.RawMessage) (map[string]any, error)

func (*Server) ToolTerminalList

func (s *Server) ToolTerminalList(ctx context.Context, arguments json.RawMessage) (map[string]any, error)

func (*Server) ToolTerminalRename

func (s *Server) ToolTerminalRename(ctx context.Context, arguments json.RawMessage) (map[string]any, error)

Jump to

Keyboard shortcuts

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