feat: add health check endpoint to monitor MCP server status (#264)

This commit is contained in:
samanhappy
2025-08-10 16:46:22 +08:00
committed by GitHub
parent 0b4dc453a5
commit 8c58200dcc
3 changed files with 41 additions and 2 deletions

View File

@@ -114,9 +114,11 @@ const cleanInputSchema = (schema: any): any => {
// Store all server information
let serverInfos: ServerInfo[] = [];
// Returns true if all servers are connected
// Returns true if all enabled servers are connected
export const connected = (): boolean => {
return serverInfos.every((serverInfo) => serverInfo.status === 'connected');
return serverInfos
.filter((serverInfo) => serverInfo.enabled !== false)
.every((serverInfo) => serverInfo.status === 'connected');
};
// Global cleanup function to close all connections