Skip to content

Conversation

@bjoaquinc
Copy link

@bjoaquinc bjoaquinc commented Nov 3, 2025

Store server information in ClientSession._client_info after initialization when using the default client info. This allows users to access server details without manually capturing them from the InitializeResult.

Motivation and Context

Resolves #1018

How Has This Been Tested?

Created and ran a live integration test that launches a real MCP server via stdio transport. The test verifies that session._client_info is correctly updated with server info after initialization when using default client info, and that custom client_info is preserved when explicitly provided. Normal server operations (like listing tools, etc...) continue to work correctly after initialization.

Screenshot 2025-11-03 at 1 50 50 AM

Breaking Changes

None. This change only affects the internal _client_info field when using the default client info. Users who explicitly provide their own client_info will see no behavior change. The _client_info field is private and not part of the public API.

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

@bjoaquinc
Copy link
Author

Hmmm... the test failure doesnt seem related. Looks like a server failure

@maxisbey maxisbey added the P3 Nice to haves, rare edge cases label Nov 4, 2025
Copy link
Contributor

@maxisbey maxisbey left a comment

Choose a reason for hiding this comment

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

Please add unit tests for this

@maxisbey maxisbey added the needs confirmation Needs confirmation that the PR is actually required or needed. label Nov 4, 2025
@bjoaquinc bjoaquinc requested a review from maxisbey November 4, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs confirmation Needs confirmation that the PR is actually required or needed. P3 Nice to haves, rare edge cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update _client_info on the ClientSession upon initialization with serverInfo

2 participants