fix: connect error when sse with multiple clients#233
Conversation
hustcc
commented
Nov 20, 2025
- fixed 这个mcp两个client同时连接第2个会阻塞 #232
Summary of ChangesHello @hustcc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical issue preventing multiple clients from simultaneously connecting via Server-Sent Events (SSE). The solution involves refactoring the server setup to ensure each client connection operates with its own isolated server instance, thereby eliminating resource contention. The changes are validated with new tests specifically designed to confirm stable multi-client SSE and streamable connections. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively resolves the connection error for multiple SSE clients by instantiating a new server for each connection. The core logic change is sound and well-implemented in src/server.ts and src/services/sse.ts. I appreciate the addition of new tests in __tests__/server.spec.ts to cover multiple client scenarios for both SSE and streamable transports, which will help prevent future regressions. I have one suggestion to refactor the new tests to reduce code duplication and improve maintainability.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #233 +/- ##
=======================================
Coverage 79.69% 79.69%
=======================================
Files 41 41
Lines 1788 1788
Branches 31 31
=======================================
Hits 1425 1425
Misses 361 361
Partials 2 2
🚀 New features to boost your workflow:
|