Skip to content

Fix MCP connection leak and "Not Acceptable" error#8

Open
dmatscheko wants to merge 1 commit into
mainfrom
fix-mcp-not-acceptable-error-14071015176736618620
Open

Fix MCP connection leak and "Not Acceptable" error#8
dmatscheko wants to merge 1 commit into
mainfrom
fix-mcp-not-acceptable-error-14071015176736618620

Conversation

@dmatscheko

Copy link
Copy Markdown
Owner

The MCP transport in the JS code was leaking connections because it didn't always read the response body of POST requests that returned SSE streams (which is common in FastMCP-based servers). This caused intermittent "Not Acceptable" errors when browser connection limits were reached.

The fix ensures that the response body is always consumed, even when only headers are needed. It also improves the SSE fallback parsing to correctly handle error messages and refines the Accept header for better compatibility.


PR created automatically by Jules for task 14071015176736618620 started by @dmatscheko

This change addresses a connection leak in the MCP plugin where SSE streams
returned by POST requests were not always consumed or closed. This led to
hitting browser connection limits and causing intermittent failures.

Changes:
- Refined the Accept header to 'text/event-stream,application/json'.
- Ensured all fetch responses always have their body consumed via resp.text().
- Improved robust parsing of JSON-RPC responses wrapped in SSE events.
- Updated initialization to correctly handle the new return type.
- Fixed Playwright tests to use correct tool prefixes.

Co-authored-by: dmatscheko <38495897+dmatscheko@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant