@@ -501,15 +501,13 @@ func (s *Server) setupRoutes() {
501501 r .Get ("/tools/export" , s .handleExportToolDescriptions )
502502
503503 // Security scanner scan/approval routes (Spec 039)
504- if s .securityController != nil {
505- r .Post ("/scan" , s .handleStartScan )
506- r .Get ("/scan/status" , s .handleGetScanStatus )
507- r .Get ("/scan/report" , s .handleGetScanReport )
508- r .Post ("/scan/cancel" , s .handleCancelScan )
509- r .Post ("/security/approve" , s .handleSecurityApprove )
510- r .Post ("/security/reject" , s .handleSecurityReject )
511- r .Get ("/integrity" , s .handleCheckIntegrity )
512- }
504+ r .Post ("/scan" , s .handleStartScan )
505+ r .Get ("/scan/status" , s .handleGetScanStatus )
506+ r .Get ("/scan/report" , s .handleGetScanReport )
507+ r .Post ("/scan/cancel" , s .handleCancelScan )
508+ r .Post ("/security/approve" , s .handleSecurityApprove )
509+ r .Post ("/security/reject" , s .handleSecurityReject )
510+ r .Get ("/integrity" , s .handleCheckIntegrity )
513511 })
514512
515513 // Search
@@ -587,16 +585,14 @@ func (s *Server) setupRoutes() {
587585 r .Delete ("/connect/{client}" , s .handleDisconnectClient )
588586
589587 // Security scanner management routes (Spec 039)
590- if s .securityController != nil {
591- r .Route ("/security" , func (r chi.Router ) {
592- r .Get ("/scanners" , s .handleListScanners )
593- r .Post ("/scanners/install" , s .handleInstallScanner )
594- r .Delete ("/scanners/{id}" , s .handleRemoveScanner )
595- r .Put ("/scanners/{id}/config" , s .handleConfigureScanner )
596- r .Get ("/scanners/{id}/status" , s .handleGetScannerStatus )
597- r .Get ("/overview" , s .handleSecurityOverview )
598- })
599- }
588+ r .Route ("/security" , func (r chi.Router ) {
589+ r .Get ("/scanners" , s .handleListScanners )
590+ r .Post ("/scanners/install" , s .handleInstallScanner )
591+ r .Delete ("/scanners/{id}" , s .handleRemoveScanner )
592+ r .Put ("/scanners/{id}/config" , s .handleConfigureScanner )
593+ r .Get ("/scanners/{id}/status" , s .handleGetScannerStatus )
594+ r .Get ("/overview" , s .handleSecurityOverview )
595+ })
600596 })
601597
602598 // SSE events (protected by API key) - support both GET and HEAD
@@ -941,6 +937,27 @@ func (s *Server) handleGetServers(w http.ResponseWriter, r *http.Request) {
941937 // Enrich with quarantine stats
942938 s .enrichServersWithQuarantineStats (serverValues )
943939
940+ // Enrich with security scan summary (Spec 039)
941+ if s .securityController != nil {
942+ for i := range serverValues {
943+ if summary := s .securityController .GetScanSummary (r .Context (), serverValues [i ].Name ); summary != nil {
944+ serverValues [i ].SecurityScan = & contracts.SecurityScanSummary {
945+ LastScanAt : summary .LastScanAt ,
946+ RiskScore : summary .RiskScore ,
947+ Status : summary .Status ,
948+ }
949+ if summary .FindingCounts != nil {
950+ serverValues [i ].SecurityScan .FindingCounts = & contracts.FindingCounts {
951+ Dangerous : summary .FindingCounts .Dangerous ,
952+ Warning : summary .FindingCounts .Warning ,
953+ Info : summary .FindingCounts .Info ,
954+ Total : summary .FindingCounts .Total ,
955+ }
956+ }
957+ }
958+ }
959+ }
960+
944961 // Dereference stats pointer
945962 var statsValue contracts.ServerStats
946963 if stats != nil {
0 commit comments