fix: issue #418 - check mcp client connections and re-init#419
fix: issue #418 - check mcp client connections and re-init#419vugenti wants to merge 2 commits intomudler:mainfrom
Conversation
|
|
||
| mcpNeedsInit := false | ||
| for _, server := range a.mcpSessions { | ||
| err := server.Ping(a.context, &mcp.PingParams{}) |
There was a problem hiding this comment.
while I like this, can we make it restart only the sessions which are unresponsive? it sounds safer to re-start only the MCP session which doesn't reply to Pings
There was a problem hiding this comment.
while I like this, can we make it restart only the sessions which are unresponsive? it sounds safer to re-start only the MCP session which doesn't reply to Pings
Agree that would be better but the code to init the mcp actions is a bit tangled and would need a refactor which I don't have time to dig into at the moment given my level of experience with Golang. While I dug into the mcp library for a bit I couldn't find how to quickly re-establish connection in that context. Although again, given my level of experience in Golang this could easily be an oversight on my part.
I'm using this code now and it really solves my problem. Do you have any thoughts on the best way to restructure the initMcpActions to support the re-init of the individual connection? Before investing more time I want to make sure it's in line with your vision for the project.
There was a problem hiding this comment.
gotcha, I see. One way would be to simply collect the ones that don't respond to the ping and call Close on these individually. If you have issues just ping me, we can merge this otherwise and I would take over
ping the mcp servers before adding actions for processing. if the connection is failed, re-initialize mcp actions before processing.