File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -463,6 +463,11 @@ export class StreamableHTTPServerTransport implements Transport {
463463 * Returns true if the session is valid, false otherwise
464464 */
465465 private validateSession ( req : IncomingMessage , res : ServerResponse ) : boolean {
466+ if ( this . sessionId === undefined ) {
467+ // If the session ID is not set, the session management is disabled
468+ // and we don't need to validate the session ID
469+ return true ;
470+ }
466471 if ( ! this . _initialized ) {
467472 // If the server has not been initialized yet, reject all requests
468473 res . writeHead ( 400 ) . end ( JSON . stringify ( {
@@ -475,11 +480,7 @@ export class StreamableHTTPServerTransport implements Transport {
475480 } ) ) ;
476481 return false ;
477482 }
478- if ( this . sessionId === undefined ) {
479- // If the session ID is not set, the session management is disabled
480- // and we don't need to validate the session ID
481- return true ;
482- }
483+
483484 const sessionId = req . headers [ "mcp-session-id" ] ;
484485
485486 if ( ! sessionId ) {
You can’t perform that action at this time.
0 commit comments