Skip to content

Conversation

@vugenti
Copy link

@vugenti vugenti commented Dec 6, 2025

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.

Copy link
Owner

@mudler mudler left a comment

Choose a reason for hiding this comment

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

Looks good, thank you

@mudler
Copy link
Owner

mudler commented Dec 8, 2025

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.

Indeed, cogito would need to be educated into supporting image content as well

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