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 {
463
463
* Returns true if the session is valid, false otherwise
464
464
*/
465
465
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
+ }
466
471
if ( ! this . _initialized ) {
467
472
// If the server has not been initialized yet, reject all requests
468
473
res . writeHead ( 400 ) . end ( JSON . stringify ( {
@@ -475,11 +480,7 @@ export class StreamableHTTPServerTransport implements Transport {
475
480
} ) ) ;
476
481
return false ;
477
482
}
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
+
483
484
const sessionId = req . headers [ "mcp-session-id" ] ;
484
485
485
486
if ( ! sessionId ) {
You can’t perform that action at this time.
0 commit comments