Prevent MCP HTTP/SSE premature connection and support MCP ImageContent responses #368
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prevent MCP HTTP/SSE premature connection and support MCP ImageContent responses
This fixes the issue in v2.6.0, but does not apply to main branch. The functionality has been partially split off into the cogito library in the main branch.
This relates to fixing and enhancing the mcp client. HTTP/SSE connections are being prematurely closed, so it seems like only STDIO works currently. This will prevent the premature closure of HTTP/SSE connections by the mcp client.
But it looks like, since v2.6.0, functionality has been shifted to cogito library. The Execute() function in cogito mcp.go has a different signature compared to the Run() function in the LocalAGI mcp.go. Since the Run() method returns types.ActionResult, it was very easy to support multi-part mcp response with base64 image. But looking at cogito, the Execute() method returns only a string. I don't see a proper way to handle the mcp.ImageContent responses yet.