statusfile

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 12 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListStatusFiles

func ListStatusFiles() ([]string, error)

func ListStatusFilesFromConfigDir added in v0.6.0

func ListStatusFilesFromConfigDir(configDir string) ([]string, error)

Types

type CostTracking added in v0.7.0

type CostTracking struct {
	ByTool   map[string]int64 `json:"by_tool"`
	ByServer map[string]int64 `json:"by_server"`
	Total    int64            `json:"total"`
	Enabled  bool             `json:"enabled"`
}

type FileStatusStore

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

func NewFileStatusStore

func NewFileStatusStore(listenAddr string, logger *slog.Logger) (*FileStatusStore, error)

func NewFileStatusStoreFromConfigDir added in v0.6.0

func NewFileStatusStoreFromConfigDir(listenAddr string, logger *slog.Logger, configDir string) (*FileStatusStore, error)

func (*FileStatusStore) GetCostTracking added in v0.7.0

func (s *FileStatusStore) GetCostTracking() *CostTracking

func (*FileStatusStore) GetFilePath

func (s *FileStatusStore) GetFilePath() string

func (*FileStatusStore) RemoveFile

func (s *FileStatusStore) RemoveFile()

func (*FileStatusStore) SetClients added in v1.1.1

func (s *FileStatusStore) SetClients(n int)

SetClients records how many MCP clients are connected.

func (*FileStatusStore) SetDashboard added in v1.1.1

func (s *FileStatusStore) SetDashboard(url string)

SetDashboard records the dashboard URL.

func (*FileStatusStore) SetHTTPFrontend added in v1.1.1

func (s *FileStatusStore) SetHTTPFrontend(h *HTTPFrontendStatus)

SetHTTPFrontend records the exposure of the Streamable HTTP front end.

func (*FileStatusStore) UpdateCostTracking added in v0.7.0

func (s *FileStatusStore) UpdateCostTracking(costTracking *CostTracking)

func (*FileStatusStore) UpdateServers

func (s *FileStatusStore) UpdateServers(servers []ServerStatus)

type HTTPFrontendStatus added in v1.1.1

type HTTPFrontendStatus struct {
	URL            string   `json:"url"`
	Loopback       bool     `json:"loopback"`
	Auth           bool     `json:"auth"`
	AllowedHosts   []string `json:"allowed_hosts,omitempty"`
	AllowedOrigins []string `json:"allowed_origins,omitempty"`
	MaxSessions    int      `json:"max_sessions"`
}

HTTPFrontendStatus is the exposure of a Streamable HTTP front end. It never holds the token itself.

type ServerStatus

type ServerStatus struct {
	Name         string    `json:"name"`
	Status       string    `json:"status"`
	RequestCount int64     `json:"request_count"`
	ErrorCount   int64     `json:"error_count"`
	RestartCount int       `json:"restart_count"`
	Uptime       string    `json:"uptime"`
	ToolCount    int       `json:"tool_count"`
	LastActivity time.Time `json:"last_activity"`
	// Added with the per-server snapshot (see pool.ServerSnapshot).
	Transport    string  `json:"transport,omitempty"`
	State        string  `json:"state,omitempty"`
	Summary      string  `json:"summary,omitempty"`
	LastError    string  `json:"last_error,omitempty"`
	AvgLatencyMs float64 `json:"avg_latency_ms,omitempty"`
	InFlight     int     `json:"in_flight,omitempty"`
	PID          int     `json:"pid,omitempty"`
}

type StatusInfo

type StatusInfo struct {
	PID          int            `json:"pid"`
	StartedAt    time.Time      `json:"started_at"`
	ListenAddr   string         `json:"listen_addr"`
	Servers      []ServerStatus `json:"servers"`
	CostTracking *CostTracking  `json:"cost_tracking,omitempty"`
	// HTTP describes the exposure of a running Streamable HTTP front end
	// (`server run --http`, issue #309), for `doctor security`.
	HTTP *HTTPFrontendStatus `json:"http,omitempty"`
	// Clients is how many MCP clients are connected to this process.
	Clients int `json:"clients"`
	// Dashboard is the URL of this process's dashboard, when it has one.
	Dashboard string `json:"dashboard,omitempty"`
}

func ReadAllStatus added in v1.1.1

func ReadAllStatus() ([]StatusInfo, error)

ReadAllStatus returns the status of every proxy process running for this user, the shared HTTP gateway first, then the most recently started. The file of a process that no longer exists (it crashed, or was killed without a chance to clean up) is skipped and removed.

func ReadCurrentStatus

func ReadCurrentStatus() (*StatusInfo, error)

ReadCurrentStatus returns the status of the running proxy: the shared HTTP gateway when there is one, else the most recently started process. It returns nil when none is running. See ReadAllStatus for all of them.

func ReadCurrentStatusFromConfigDir added in v0.6.0

func ReadCurrentStatusFromConfigDir(configDir string) (*StatusInfo, error)

Jump to

Keyboard shortcuts

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