(workspaceId: string)
| 1261 | } |
| 1262 | |
| 1263 | async stopServers(workspaceId: string): Promise<void> { |
| 1264 | const entry = this.workspaceServers.get(workspaceId); |
| 1265 | if (!entry) return; |
| 1266 | |
| 1267 | // Remove from cache immediately so callers can't re-use tools backed by a |
| 1268 | // client that is in the middle of closing. |
| 1269 | this.workspaceServers.delete(workspaceId); |
| 1270 | |
| 1271 | for (const instance of entry.instances.values()) { |
| 1272 | try { |
| 1273 | await instance.close(); |
| 1274 | } catch (error) { |
| 1275 | log.warn("Failed to stop MCP server", { error, name: instance.name }); |
| 1276 | } |
| 1277 | } |
| 1278 | } |
| 1279 | |
| 1280 | /** |
| 1281 | * Test an MCP server. |
no test coverage detected