web

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Addr       string
	Config     *config.Config
	ConfigPath string
	Supervisor *process.Supervisor
	Bus        *events.Bus
	ToolCache  *config.ToolCache
	Token      string // if set, require token auth for all requests
}

Options configures the web server.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the HTTP server for the web UI.

func New

func New(opts Options) (*Server, error)

New creates a new web Server.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts the HTTP server.

func (*Server) Shutdown

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

Shutdown gracefully shuts down the HTTP server.

func (*Server) WatchConfig added in v0.1.24

func (s *Server) WatchConfig(ctx context.Context)

WatchConfig watches the config file for external changes and updates the in-memory config. Connected SSE clients are notified so the UI can refresh. It watches the parent directory (not the file) to handle atomic renames.

type StatusTracker

type StatusTracker struct {
	// contains filtered or unexported fields
}

StatusTracker subscribes to the event bus and maintains last-known ServerStatus per server. This mirrors what the TUI does with its serverStatuses map — without it, status is lost when a handle is removed.

func NewStatusTracker

func NewStatusTracker(bus *events.Bus) *StatusTracker

NewStatusTracker creates a tracker and subscribes it to the bus.

func (*StatusTracker) All

func (st *StatusTracker) All() map[string]events.ServerStatus

All returns a snapshot of all last-known statuses.

func (*StatusTracker) Close

func (st *StatusTracker) Close()

Close unsubscribes from the event bus.

func (*StatusTracker) Get

func (st *StatusTracker) Get(serverID string) (events.ServerStatus, bool)

Get returns the last-known status for a server.

func (*StatusTracker) Tools

func (st *StatusTracker) Tools(serverID string) ([]events.McpTool, bool)

Tools returns the last-known tools for a server.

Jump to

Keyboard shortcuts

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