fix: negotiate MCP protocol version instead of hardcoding#324
Merged
bensig merged 3 commits intoMemPalace:mainfrom Apr 9, 2026
Merged
Conversation
The initialize handler hardcoded protocolVersion "2024-11-05", which causes newer MCP clients (e.g. Claude Code) to reject the connection when they negotiate "2025-11-25" or later. Echo the client's requested version if it is in the supported set, otherwise fall back to the latest supported version. This keeps backwards compatibility with older clients while allowing newer ones to connect. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
bensig
approved these changes
Apr 9, 2026
6 tasks
gnusam
pushed a commit
to gnusam/mempalace-pgsql
that referenced
this pull request
Apr 9, 2026
The initialize handler replied with a fixed protocolVersion "2024-11-05", which causes newer MCP clients (Claude Code negotiating 2025-11-25) to refuse the connection. Echo the client's requested version when it is in the supported set, otherwise fall back to the newest we know. Ported from upstream 950d52b (PR MemPalace#324), by @virgil-at-biocompute. Amusing note: the upstream commit is co-authored by Claude Opus 4.6. Co-Authored-By: virgil-at-biocompute <[email protected]> Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
initializehandler hardcodesprotocolVersion: "2024-11-05", which causes newer MCP clients (Claude Code, Cursor, etc.) to reject the connection when they negotiate2025-11-25or laterSUPPORTED_PROTOCOL_VERSIONSlist for easy maintenance as new versions are releasedWhat broke
Claude Code's MCP client sends
protocolVersion: "2025-11-25"in theinitializerequest. The server responded with"2024-11-05", causing the client to reject the handshake. All 18 mempalace tools failed to load as a result.Changes
mempalace/mcp_server.pySUPPORTED_PROTOCOL_VERSIONSlist (2025-11-25through2024-11-05)tests/test_mcp_server.pytest_initialize_negotiates_client_version— client sends2025-11-25, server echoes ittest_initialize_negotiates_older_supported_version— client sends2025-03-26, server echoes ittest_initialize_unknown_version_falls_back_to_latest— unknown version gets latest supportedtest_initialize_missing_version_uses_oldest— no version in params gets2024-11-05(backwards compat)Test plan
TestHandleRequesttests passruff checkandruff format --checkclean