Stop all servers (called on graceful shutdown). Also clears their tools from the registry.
()
| 156 | |
| 157 | /** Stop all servers (called on graceful shutdown). Also clears their tools from the registry. */ |
| 158 | async stopAll(): Promise<void> { |
| 159 | const stops = Array.from(this.clients.values()).map(c => c.stop().catch(() => {})); |
| 160 | await Promise.allSettled(stops); |
| 161 | // Clean up registry entries from all servers |
| 162 | for (const [, names] of this.registeredToolsByServer) { |
| 163 | for (const n of names) this.registry.unregister(n); |
| 164 | } |
| 165 | this.registeredToolsByServer.clear(); |
| 166 | this.clients.clear(); |
| 167 | } |
| 168 | |
| 169 | status(): MCPClientStatus[] { |
| 170 | return Array.from(this.clients.values()).map(c => c.status); |
no test coverage detected