Files
skillshare/internal/server/handler_mcp_check.go
T
Willie 3355b4f218 feat(mcp): add subject to check findings and a check endpoint
The dashboard needs to phrase each finding in the reader's language, so a
finding now names what it is about (variable name, command, or host) in a
separate subject field instead of only inside the English message. The
value of a variable is still never included.

GET /api/mcp/check serves the same report as `mcp check --json` so the MCP
page can run the check on demand. It is read-only, writes no oplog entry,
returns 200 when findings include errors, and accepts ?dns=0 to skip host
lookups.
2026-09-30 13:35:57 +08:00

22 lines
612 B
Go

package server
import (
"net/http"
"skillshare/internal/mcp"
)
// handleMCPCheck answers `skillshare mcp check --json` for the dashboard. It is read-only
// and writes no operation log entry. Findings that are errors still return 200; only a
// check that cannot run fails the request. ?dns=0 skips host lookups.
func (s *Server) handleMCPCheck(w http.ResponseWriter, r *http.Request) {
s.mu.RLock()
defer s.mu.RUnlock()
report, err := s.mcpService().Check(mcp.CheckOptions{SkipDNS: r.URL.Query().Get("dns") == "0"})
if err != nil {
writeError(w, 400, err.Error())
return
}
writeJSON(w, report)
}