Skip to content

Commit 1d54f29

Browse files
committed
fix: Return negotiated protocol version in initialize
The initialize method should return the protocol version requested by the client (after validation), not the server's default protocol version. This ensures proper protocol version negotiation per MCP spec 2025-06-18. - Changed InitializeResult to use negotiated protocol_version - Fixed doctest to validate correct protocol version handling - Ensures client and server agree on the protocol version being used Signed-off-by: Mihai Criveti <[email protected]>
1 parent 638e53e commit 1d54f29

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mcpgateway/cache/session_registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ async def handle_initialize_logic(self, body: Dict[str, Any], session_id: Option
12511251
logger.debug(f"Stored capabilities for session {session_id}: {client_capabilities}")
12521252

12531253
return InitializeResult(
1254-
protocolVersion=settings.protocol_version,
1254+
protocolVersion=protocol_version,
12551255
capabilities=ServerCapabilities(
12561256
prompts={"listChanged": True},
12571257
resources={"subscribe": True, "listChanged": True},

0 commit comments

Comments
 (0)