-
Notifications
You must be signed in to change notification settings - Fork 481
feat:[MCPClientSessionManager] can manage SSE and Stdio session both #1983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat:[MCPClientSessionManager] can manage SSE and Stdio session both #1983
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I think it could be better a bit.
if isinstance(config, StdioConfig):
async with self.create_stdio_session(config) as session:
yield session
elif isinstance(config, SseConfig):
async with self.create_sse_session(config) as session:
yield sessionThis code looks not scalable. I suggest to move create_session method to StdioConfig and SseConfig and hide them by the same interface. MCPClient should return just an interface call result this way
@asynccontextmanager
async def open_session(
self,
config: SessionConfigProtocol,
) -> AsyncIterator[ClientSession]:
async with config.create_session(self.exit_stack) as session:
yield session9f51b68 to
e30e4c0
Compare
|
@marklysze hi! The code looks fine, but can you help me with tests a bit? I am not familiar enought with your testing practice yet |
…rt-in-mcpclientsessionmanager
Codecov Report❌ Patch coverage is
... and 30 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Why are these changes needed?
MultiMCPSessionManager class can support both Stdio and SSE session now.
Related issue number
Closes #1975
Checks