mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 08:43:02 +08:00
fix(LocalRunnerClient): close old MCP client while a new client's name is duplicated with the old one
This commit is contained in:
@@ -1077,6 +1077,12 @@ public class LocalRunnerClient extends RunnerClient {
|
|||||||
* @param mcpClientTransportParams MCP Server 的参数
|
* @param mcpClientTransportParams MCP Server 的参数
|
||||||
*/
|
*/
|
||||||
private void registerMcpClient(String id, McpClientTransportParams mcpClientTransportParams) {
|
private void registerMcpClient(String id, McpClientTransportParams mcpClientTransportParams) {
|
||||||
|
// 如果已存在同名 client,则需要先获取并关闭
|
||||||
|
val old = mcpClients.get(id);
|
||||||
|
if (old != null) {
|
||||||
|
old.close();
|
||||||
|
}
|
||||||
|
|
||||||
val clientTransport = createTransport(mcpClientTransportParams);
|
val clientTransport = createTransport(mcpClientTransportParams);
|
||||||
val timeout = mcpClientTransportParams.timeout;
|
val timeout = mcpClientTransportParams.timeout;
|
||||||
val client = McpClient.sync(clientTransport)
|
val client = McpClient.sync(clientTransport)
|
||||||
|
|||||||
Reference in New Issue
Block a user