Skip to content

feat: ClientConnectionManager to manage multiple sessions without async with #1133

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hanhan1123
Copy link

@hanhan1123 hanhan1123 commented Jul 12, 2025

This PR introduces a ClientConnectionManager that allows users to manage multiple sessions without needing to explicitly use async with. This provides more flexibility in long-running or dynamic session use cases.

Motivation and Context

In developing AI agents, the MCP client is often just one part of a larger system. However, the requirement to use async with when initiating sessions makes it difficult to integrate MCP into more complex workflows, especially when other asynchronous components are involved.

To address this, I implemented a ClientConnectionManager that completely removes the need for async with during usage. This provides much greater flexibility in designing and structuring other components, particularly in long-running or modular systems.

How Has This Been Tested?

Code branches are covered via pytest unit tests.

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@hanhan1123 hanhan1123 changed the title feat: add client connection manager to manage multiple sessions witho… feat: ClientConnectionManager to manage multiple sessions without async with Jul 12, 2025
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