fix(mcp): filter list_incidents by the token's visible servers

This commit is contained in:
2026-09-17 09:23:14 +00:00
parent 7c2c5d95e3
commit 753ba09e6e
+7
View File
@@ -187,6 +187,12 @@ func init() {
}
}
// Metric incidents name a server, so a server-scoped token sees only
// the ones on servers it can see, matching the REST endpoint.
visible, restricted, err := services.VisibleServerIDs(c.InstanceID, c.TokenScope)
if err != nil {
return nil, fmt.Errorf("could not resolve visible servers: %w", err)
}
out := []incidentSummary{}
for _, mid := range monitorIDs {
if len(out) >= int(limit) {
@@ -196,6 +202,7 @@ func init() {
if err != nil {
return nil, fmt.Errorf("could not list incidents: %w", err)
}
incidents = services.FilterByVisibleServer(incidents, func(i models.Incident) string { return i.ServerID }, visible, restricted)
name := mid
if monitorNames != nil {
if n, ok := monitorNames[mid]; ok {