-
Notifications
You must be signed in to change notification settings - Fork 1.3k
使用spring-ai-starter-mcp-client sse方式连接mcp server,重启mcp server后,以前的client不会自动重连。 #2740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
应该只能重新创建一个mcpclient对象 或者重新实现一个client可以重连的 |
I also encountered this problem. Every time I restarted mcp-server, I needed to restart the client to recover. If I only restarted mcp-server, a 404 error would appear. I didn't see any reconnection configuration in the official documentation. org.springframework.web.reactive.function.client.WebClientResponseException$NotFound: 404 Not Found from POST http://localhost:9080/mcp/message |
这都不用等服务器重启,我连着高德的MCP,等个几分钟就断开了,然后他就不连了.... 怎么办??? |
目前可以不用autoconfigure,自己在代码中实现 mcpClient 的初始化,用mcpClient.ping() 来判断是否正常,不正常重新实例化一个新的mcpClient。 |
大佬,请问有示例代码么?我尝试这个方案还是有问题,重新实例化时,mcp server会报错: session is null |
@zhouwenjun-hub 去看看autoconfigure包是怎么写的你就会了。 |
stare |
麻烦您能不能贴一下关键代码,我也遇到这个问题,我重新调用mcpSyncClient.initialize(); 方法还是无法重连。 |
1.0.0-M7 版本:
client 采用sse 方式连接上 mcp server,可以正常运行;这个时候重启 mcp server, client 端就不会重连 mcp server,导致一直报错
reactor.core.Exceptions$ReactiveException: java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 20000ms in 'source(MonoCreate)' (and no fallback has been configured)
at reactor.core.Exceptions.propagate(Exceptions.java:410)
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:102)
怎么设置重连mcp server?
The text was updated successfully, but these errors were encountered: