docs/tui-research.md
Location: cmd/mcpproxy/main.go
Pattern:
rootCmd.AddCommand()GetXCommand() functions that return *cobra.Commandserve, upstream, activity, tools, auth, code, secrets, doctor, search-servers, trust-certTUI Integration Point:
cmd/mcpproxy/tui_cmd.go with a GetTUICommand() functionrootCmd.AddCommand(GetTUICommand())Location: internal/cliclient/client.go
Key Methods:
GetServers(ctx) - GET /api/v1/servers -> []map[string]interface{}ServerAction(ctx, name, action) - POST /api/v1/servers/{name}/{action}GetServerLogs(ctx, name, tail) - GET /api/v1/servers/{name}/logsListActivities(ctx, filter) - GET /api/v1/activityGetActivitySummary(ctx, period, groupBy) - GET /api/v1/activity/summaryTriggerOAuthLogin(ctx, name) - POST /api/v1/servers/{name}/loginTriggerOAuthLogout(ctx, name) - POST /api/v1/servers/{name}/logoutPing(ctx) - GET /api/v1/statusGetDiagnostics(ctx) - GET /api/v1/diagnosticsGetInfo(ctx) - GET /api/v1/infoConnection: Supports Unix sockets, named pipes, and TCP.
internal/contracts/types.go)type Server struct {
Name, Status, LastError, OAuthStatus string
Enabled, Quarantined, Connected bool
ToolCount int
TokenExpiresAt *time.Time
Health *HealthStatus
}
type HealthStatus struct {
Level string // "healthy" | "degraded" | "unhealthy"
AdminState string // "enabled" | "disabled" | "quarantined"
Summary string // e.g. "Connected (5 tools)"
Detail string
Action string // "login" | "restart" | "enable" | "approve" | ""
}
internal/runtime/events.go)EventTypeServersChanged - Server state changeEventTypeConfigReloaded - Config file reloadedEventTypeOAuthTokenRefreshed - Token refresh successEventTypeOAuthRefreshFailed - Token refresh failureEventTypeActivityToolCallStarted/Completed - ActivitysocketPath := socket.DetectSocketPath(dataDir)
isAvailable := socket.IsSocketAvailable(socketPath)
cfg, _ := config.LoadFromFile("")
cfg, _ := config.Load()