@@ -337,7 +337,8 @@ public actor Server {
337
337
} catch {
338
338
// Only add errors to response for requests (notifications don't have responses)
339
339
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)
341
342
responses. append ( AnyMethod . response ( id: request. id, error: mcpError) )
342
343
}
343
344
}
@@ -365,7 +366,9 @@ public actor Server {
365
366
/// - request: The request to handle
366
367
/// - sendResponse: Whether to send the response immediately (true) or return it (false)
367
368
/// - 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
+ {
369
372
// Check if this is a pre-processed error request (empty method)
370
373
if request. method. isEmpty && !sendResponse {
371
374
// This is a placeholder for an invalid request that couldn't be parsed in batch mode
@@ -478,12 +481,6 @@ public actor Server {
478
481
throw MCPError . invalidRequest ( " Server is already initialized " )
479
482
}
480
483
481
- // Validate protocol version
482
- guard Version . latest == params. protocolVersion else {
483
- throw MCPError . invalidRequest (
484
- " Unsupported protocol version: \( params. protocolVersion) " )
485
- }
486
-
487
484
// Call initialization hook if registered
488
485
if let hook = initializeHook {
489
486
try await hook ( params. clientInfo, params. capabilities)
0 commit comments