feat: Add protocol_version parameter to ClientSession#2321
feat: Add protocol_version parameter to ClientSession#2321goingforstudying-ctrl wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
|
Tested the logic of this PR against |
db9da1c to
132d8a2
Compare
|
Hi @jspahrsummers, just checking in on this PR. Please let me know if any changes are needed. Happy to address any feedback! |
|
Hi @maintainer, just checking in on this PR. Please let me know if any changes are needed. Happy to address any feedback! |
1 similar comment
|
Hi @maintainer, just checking in on this PR. Please let me know if any changes are needed. Happy to address any feedback! |
|
Hi @jspahrsummers and MCP maintainers, Just checking in on this PR — it's been about a month since opening and three days since my last ping. @tsingh2k15 kindly tested the changes against Snowflake's managed MCP server and confirmed the fix works correctly with backwards compatibility. Is there anything I can do to help move this forward? Happy to rebase, add more tests, or make any adjustments needed. Thanks for your time! |
|
Hi @jspahrsummers and MCP maintainers! 👋 Just checking in on this PR — it's been about 6 weeks since opening. @tsingh2k15 kindly tested the changes against Snowflake's managed MCP server and confirmed they work correctly. The CI is all green. Could someone please review when you have a moment? This would help users who need to specify a protocol version. Thanks! |
This change allows users to specify a custom protocol version when initializing a ClientSession, instead of always using LATEST_PROTOCOL_VERSION. This is needed for connecting to MCP servers that require a specific protocol version (e.g., Snowflake's managed MCP server requires 2025-06-18). Changes: - Added protocol_version parameter to ClientSession.__init__() - Stored protocol_version as instance variable _protocol_version - Updated initialize() to use self._protocol_version instead of hardcoded constant - Added tests for both custom and default protocol version scenarios Backwards compatible: defaults to LATEST_PROTOCOL_VERSION when not specified. Fixes modelcontextprotocol#2307
132d8a2 to
b3e0468
Compare
|
Hi maintainers, just checking in on this PR. Please let me know if any changes are needed. Happy to address any feedback! |
|
Hi @tsingh2k15 and MCP maintainers! 👋 Just following up on this PR — it's been about 6 weeks since the last activity. The I'm happy to make any adjustments needed, rebase against the latest main, or add additional tests. Please let me know if there's anything I can do to help move this forward! Thanks for maintaining the Python SDK! 🙏 |
|
Closing this PR as part of weekly cleanup. Reason: Superseded by newer PR #2458 (feat: JSONRPCDispatcher) created on 2026-04-16T16:48:28Z. If this was closed in error, please feel free to reopen. |
Summary
Fixes #2307 - Adds the ability to specify a custom protocol version in ClientSession.initialize().
Problem
ClientSession.initialize() hardcodes protocolVersion=types.LATEST_PROTOCOL_VERSION with no way for the caller to override it. When connecting to an MCP server that requires a specific protocol version (e.g., Snowflake's managed MCP server requires "2025-06-18"), the only workaround is to mutate the module-level constant before calling initialize().
Solution
Added an optional protocol_version parameter to ClientSession.init():
Then use it in initialize():
Changes
Testing
Backwards Compatibility
Fully backwards compatible - existing callers get the current default (LATEST_PROTOCOL_VERSION) when protocol_version is not specified.
Closes #2307