Skip to content

fix: issue #418 - check mcp client connections and re-init#419

Open
vugenti wants to merge 2 commits intomudler:mainfrom
vugenti:vugenti/issue418
Open

fix: issue #418 - check mcp client connections and re-init#419
vugenti wants to merge 2 commits intomudler:mainfrom
vugenti:vugenti/issue418

Conversation

@vugenti
Copy link
Contributor

@vugenti vugenti commented Feb 16, 2026

ping the mcp servers before adding actions for processing. if the connection is failed, re-initialize mcp actions before processing.


mcpNeedsInit := false
for _, server := range a.mcpSessions {
err := server.Ping(a.context, &mcp.PingParams{})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants