* 销毁 MCP 组件
()
| 122 | * 销毁 MCP 组件 |
| 123 | */ |
| 124 | async destroy(): Promise<void> { |
| 125 | if (this.client) { |
| 126 | // 断开所有连接 |
| 127 | for (const session of this.sessions.values()) { |
| 128 | await this.client.disconnect(session.id); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | this.sessions.clear(); |
| 133 | this.resources.clear(); |
| 134 | this.tools.clear(); |
| 135 | |
| 136 | this.log('MCP 组件已销毁'); |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * 连接到多个服务器 |
nothing calls this directly
no test coverage detected