Documentation
¶
Overview ¶
Package admin provides the Admin MCP server for Vision management. It exposes MCP tools for server lifecycle management on port 6275.
Index ¶
- Constants
- Variables
- func NewValidationError(msg string) error
- type AddResponse
- type Config
- type GuidanceEntry
- type GuidanceResponse
- type InitResponse
- type InputSchema
- type ListResponse
- type ListServerEntry
- type MetricsResponse
- type Property
- type RemoveResponse
- type RestartResponse
- type SearchResponse
- type SearchResultEntry
- type Server
- func (s *Server) IsRunning() bool
- func (s *Server) Port() int
- func (s *Server) SetServerMetricsAccessor(a ServerMetricsAccessor)
- func (s *Server) SetSessionLifecycleAccessor(a SessionLifecycleAccessor)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(ctx context.Context) error
- type ServerMetricsAccessor
- type SessionLifecycleAccessor
- type SessionLifecycleRow
- type SessionLifecycleSnapshot
- type SlotDetail
- type SlotGroupEntry
- type SlotGroupStatus
- type SlotSessionAccessor
- type SlotStatusResponse
- type StatusResponse
- type StatusServers
- type Tool
- type ToolCallResult
- type ToolContent
- type ValidationError
Constants ¶
const DefaultPort = 6275
DefaultPort is the default port for the Admin MCP server.
Variables ¶
var ( Version = "dev" BuildInfo = "" )
Version and BuildInfo are populated by the cmd/vision entry point at process startup (usually via ldflags). Empty string is acceptable and will surface as "dev" in the /version response for local builds.
Functions ¶
func NewValidationError ¶
NewValidationError creates a new validation error.
Types ¶
type AddResponse ¶
type AddResponse struct {
Success bool `json:"success"`
Name string `json:"name"`
Status string `json:"status,omitempty"`
Port *int `json:"port,omitempty"`
Error *string `json:"error,omitempty"`
}
AddResponse is the response for vision_add.
type Config ¶
type Config struct {
Registry *server.Registry
Catalog *catalog.Catalog
Instructions *config.Instructions
DaemonConfig *config.Config // Mutable reference for persisting changes
ConfigPath string // Path to servers.yaml for config persistence
Port int
Logger *slog.Logger
SlotSessionAccessor SlotSessionAccessor // Optional: provides live session counts
ServerMetricsAccessor ServerMetricsAccessor // Optional: provides per-server session metrics
SessionLifecycleAccessor SessionLifecycleAccessor // Optional managed-HTTP lifecycle projection
Metrics *metrics.DaemonMetrics
}
Config configures the Admin MCP server.
type GuidanceEntry ¶
type GuidanceEntry struct {
Name string `json:"name"`
NamespacedName string `json:"namespaced_name,omitempty"`
Priority string `json:"priority,omitempty"`
Guidance string `json:"guidance,omitempty"`
PreferFor []string `json:"prefer_for,omitempty"`
AvoidFor []string `json:"avoid_for,omitempty"`
Examples []string `json:"examples,omitempty"`
}
GuidanceEntry represents guidance for a single server or tool.
type GuidanceResponse ¶
type GuidanceResponse struct {
Success bool `json:"success"`
GlobalGuidance string `json:"global_guidance,omitempty"`
Servers []GuidanceEntry `json:"servers,omitempty"`
Tools []GuidanceEntry `json:"tools,omitempty"`
Context string `json:"context,omitempty"`
Error *string `json:"error,omitempty"`
}
GuidanceResponse is the response for vision_guidance.
type InitResponse ¶
type InitResponse struct {
Success bool `json:"success"`
Path string `json:"path"`
Servers []string `json:"servers"`
ReconciledServers []string `json:"reconciled_servers,omitempty"`
BackedUp bool `json:"backed_up,omitempty"`
BackupPath string `json:"backup_path,omitempty"`
Error *string `json:"error,omitempty"`
}
InitResponse is the response for vision_init.
type InputSchema ¶
type InputSchema struct {
Type string `json:"type"`
Properties map[string]Property `json:"properties,omitempty"`
Required []string `json:"required,omitempty"`
}
InputSchema defines the JSON schema for tool inputs.
type ListResponse ¶
type ListResponse struct {
Servers []ListServerEntry `json:"servers"`
SlotGroups []SlotGroupEntry `json:"slot_groups"`
}
ListResponse is the response for vision_list.
type ListServerEntry ¶
type ListServerEntry struct {
Name string `json:"name"`
CodemodeNamespace string `json:"codemode_namespace"`
Status string `json:"status"`
Port *int `json:"port"`
PID *int `json:"pid"`
Uptime *string `json:"uptime"`
Error *string `json:"error"`
SessionMetrics *metrics.ServerMetricsSnapshot `json:"session_metrics,omitempty"`
SessionLifecycle *SessionLifecycleSnapshot `json:"session_lifecycle,omitempty"`
}
ListServerEntry represents a server in the vision_list response.
type MetricsResponse ¶
type MetricsResponse struct {
SessionsActive int64 `json:"sessions_active"`
ToolCallsTotal int64 `json:"tool_calls_total"`
ErrorsTotal int64 `json:"errors_total"`
SubprocessesActive int64 `json:"subprocesses_active"`
}
MetricsResponse is the response for vision_metrics.
type Property ¶
type Property struct {
Type string `json:"type"`
Description string `json:"description"`
Default any `json:"default,omitempty"`
}
Property defines a single property in the input schema.
type RemoveResponse ¶
type RemoveResponse struct {
Success bool `json:"success"`
Name string `json:"name"`
Error *string `json:"error,omitempty"`
}
RemoveResponse is the response for vision_remove.
type RestartResponse ¶
type RestartResponse struct {
Success bool `json:"success"`
Name string `json:"name"`
Status string `json:"status,omitempty"`
Port *int `json:"port,omitempty"`
Error *string `json:"error,omitempty"`
}
RestartResponse is the response for vision_restart.
type SearchResponse ¶
type SearchResponse struct {
Success bool `json:"success"`
Results []SearchResultEntry `json:"results"`
Error *string `json:"error,omitempty"`
}
SearchResponse is the response for vision_search.
type SearchResultEntry ¶
type SearchResultEntry struct {
Name string `json:"name"`
CodemodeNamespace string `json:"codemode_namespace"`
Description string `json:"description"`
Capabilities []string `json:"capabilities"`
Installed bool `json:"installed"`
}
SearchResultEntry represents a server in search results.
type Server ¶
type Server struct {
Metrics *metrics.DaemonMetrics
// contains filtered or unexported fields
}
Server is the Admin MCP server that provides management tools.
func (*Server) SetServerMetricsAccessor ¶ added in v1.2.5
func (s *Server) SetServerMetricsAccessor(a ServerMetricsAccessor)
SetServerMetricsAccessor wires the per-server metrics accessor after construction.
func (*Server) SetSessionLifecycleAccessor ¶ added in v1.3.3
func (s *Server) SetSessionLifecycleAccessor(a SessionLifecycleAccessor)
type ServerMetricsAccessor ¶ added in v1.2.5
type ServerMetricsAccessor interface {
ServerMetricsSnapshot(serverName string) *metrics.ServerMetricsSnapshot
}
ServerMetricsAccessor provides per-server session metrics. The daemon wires a concrete implementation; when nil, metrics are omitted.
type SessionLifecycleAccessor ¶ added in v1.3.3
type SessionLifecycleAccessor interface {
SessionLifecycleSnapshot(serverName string) *SessionLifecycleSnapshot
}
type SessionLifecycleRow ¶ added in v1.3.3
type SessionLifecycleRow struct {
SafeID string `json:"safe_id"`
State string `json:"state"`
AgeSeconds int64 `json:"age_seconds"`
ApplicationIdleSeconds int64 `json:"application_idle_seconds"`
InFlight int `json:"in_flight"`
SSEConnections int `json:"sse_connections"`
LifecycleReason string `json:"lifecycle_reason"`
}
SessionLifecycleRow is a secret-safe immutable projection of one managed native-HTTP session. SafeID is a bounded hash, never the MCP session ID.
type SessionLifecycleSnapshot ¶ added in v1.3.3
type SessionLifecycleSnapshot struct {
BackendState string `json:"backend_state"`
CapacityUsed int `json:"capacity_used"`
CapacityMax int `json:"capacity_max"`
Sessions []SessionLifecycleRow `json:"sessions"`
Closed []SessionLifecycleRow `json:"closed"`
Omitted int `json:"omitted"`
ClosedOmitted int `json:"closed_omitted"`
}
SessionLifecycleSnapshot is bounded by the lease manager: at most 100 active rows are projected and at most 1,000 closed rows are retained.
type SlotDetail ¶
type SlotDetail struct {
Name string `json:"name"`
Port int `json:"port"`
ActiveSessions int `json:"active_sessions"`
MaxSessions int `json:"max_sessions"`
}
SlotDetail describes one slot within a group.
type SlotGroupEntry ¶
type SlotGroupEntry struct {
Name string `json:"name"`
GroupPort int `json:"group_port"`
Slots []string `json:"slots"`
}
SlotGroupEntry describes one slot group in the vision_list response.
type SlotGroupStatus ¶
type SlotGroupStatus struct {
GroupName string `json:"group_name"`
SlotCount int `json:"slot_count"`
Slots []SlotDetail `json:"slots"`
}
SlotGroupStatus describes one slot group with per-slot session detail.
type SlotSessionAccessor ¶
SlotSessionAccessor provides active session counts for slot servers. The daemon wires a concrete implementation; when nil, active_sessions is 0.
type SlotStatusResponse ¶
type SlotStatusResponse struct {
Groups []SlotGroupStatus `json:"groups"`
}
SlotStatusResponse is the response for vision_slot_status.
type StatusResponse ¶
type StatusResponse struct {
Healthy bool `json:"healthy"`
Uptime string `json:"uptime"`
Servers StatusServers `json:"servers"`
MemoryMB float64 `json:"memory_mb"`
Warnings []string `json:"warnings,omitempty"`
}
StatusResponse is the response for vision_status.
type StatusServers ¶
type StatusServers struct {
Running int `json:"running"`
Stopped int `json:"stopped"`
Error int `json:"error"`
}
StatusServers is the server counts in StatusResponse.
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema InputSchema `json:"inputSchema"`
}
Tool represents an MCP tool definition.
type ToolCallResult ¶
type ToolCallResult struct {
Content []ToolContent `json:"content"`
IsError bool `json:"isError,omitempty"`
}
ToolCallResult is the response to tools/call.
type ToolContent ¶
ToolContent is a single piece of content in a tool result.
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
ValidationError is returned for invalid tool arguments.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string