@@ -337,7 +337,8 @@ public actor Server {
337337 } catch {
338338 // Only add errors to response for requests (notifications don't have responses)
339339 if case . request( let request) = item {
340- let mcpError = error as? MCPError ?? MCPError . internalError ( error. localizedDescription)
340+ let mcpError =
341+ error as? MCPError ?? MCPError . internalError ( error. localizedDescription)
341342 responses. append ( AnyMethod . response ( id: request. id, error: mcpError) )
342343 }
343344 }
@@ -365,7 +366,9 @@ public actor Server {
365366 /// - request: The request to handle
366367 /// - sendResponse: Whether to send the response immediately (true) or return it (false)
367368 /// - Returns: The response when sendResponse is false
368- private func handleRequest( _ request: Request < AnyMethod > , sendResponse: Bool = true ) async throws -> Response < AnyMethod > ? {
369+ private func handleRequest( _ request: Request < AnyMethod > , sendResponse: Bool = true )
370+ async throws -> Response < AnyMethod > ?
371+ {
369372 // Check if this is a pre-processed error request (empty method)
370373 if request. method. isEmpty && !sendResponse {
371374 // This is a placeholder for an invalid request that couldn't be parsed in batch mode
@@ -478,12 +481,6 @@ public actor Server {
478481 throw MCPError . invalidRequest ( " Server is already initialized " )
479482 }
480483
481- // Validate protocol version
482- guard Version . latest == params. protocolVersion else {
483- throw MCPError . invalidRequest (
484- " Unsupported protocol version: \( params. protocolVersion) " )
485- }
486-
487484 // Call initialization hook if registered
488485 if let hook = initializeHook {
489486 try await hook ( params. clientInfo, params. capabilities)
0 commit comments