Skip to content

Commit 6526967

Browse files
committed
fix(backend): filter disabled servers from regular users, allow global_admin to see all
1 parent 8e83df5 commit 6526967

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

services/backend/src/routes/mcp/servers/get.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default async function getServer(server: FastifyInstance) {
100100
let hasAccess = false;
101101

102102
if (userRole === 'global_admin') {
103-
// Global admin can access all servers
103+
// Global admin can access all servers (including disabled)
104104
hasAccess = true;
105105
} else if (server.visibility === 'global') {
106106
// All authenticated users can access global servers
@@ -110,6 +110,11 @@ export default async function getServer(server: FastifyInstance) {
110110
hasAccess = teamIds.includes(server.owner_team_id);
111111
}
112112

113+
// Regular users (non-admin) cannot access disabled servers
114+
if (hasAccess && userRole !== 'global_admin' && server.status === 'disabled') {
115+
hasAccess = false;
116+
}
117+
113118
if (!hasAccess) {
114119
request.log.info({
115120
operation: 'get_mcp_server',

services/backend/src/services/mcpCatalogService.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,14 @@ export class McpCatalogService {
276276
)
277277
)
278278
);
279+
280+
// Regular users only see active servers (not disabled/deprecated/maintenance)
281+
// unless they explicitly filter by a specific status
282+
if (!filters?.status) {
283+
whereConditions.push(eq(this.mcpServers.status, 'active'));
284+
}
279285
}
280-
286+
281287
// Apply additional filters
282288
if (filters) {
283289
if (filters.category_id) {

0 commit comments

Comments
 (0)