UNPKG

qwen-mcp-manager

Version:

MCP Server for managing other MCP servers in qwen-code

53 lines 2.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.healthCheckMcp = void 0; exports.healthCheckMcp = { name: 'health_check_mcp', description: '尝试以 --help 或 ping 方式检查 Server 可用性(非阻塞,超时 3s)', inputSchema: {}, // This will be loaded from the JSON schema file handler: async (args, context) => { const { name } = args; const { configManager } = context; try { // 1. 从 settings.json 读取配置 (简化) const config = await configManager.readQwenConfig(); const serverConfig = config.mcpServers?.[name]; if (!serverConfig) { return { content: [ { type: 'text', text: `未找到已安装的 MCP Server: ${name}` } ] }; } // 2. 尝试执行 --help 或 ping 命令 (简化) // In a real implementation, this would involve spawning a child process // and checking its output or exit code. // For now, we just log the action and return a mock result. console.log(`Health checking package ${name}`); // For now, just return a success message // In a real implementation, this would involve actual process execution and error handling return { content: [ { type: 'text', text: `MCP Server ${name} 健康检查: 正常 (模拟结果)` } ] }; } catch (error) { return { content: [ { type: 'text', text: `MCP Server ${name} 健康检查失败: ${error.message}` } ] }; } } }; //# sourceMappingURL=health_check_mcp.js.map