File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -442,6 +442,12 @@ export class Server<
442442
443443 const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS . includes ( requestedVersion ) ? requestedVersion : LATEST_PROTOCOL_VERSION ;
444444
445+ // Inform the transport of the negotiated protocol version.
446+ // This allows the transport to validate subsequent request headers.
447+ if ( this . transport ?. setProtocolVersion ) {
448+ this . transport . setProtocolVersion ( protocolVersion ) ;
449+ }
450+
445451 return {
446452 protocolVersion,
447453 capabilities : this . getCapabilities ( ) ,
Original file line number Diff line number Diff line change @@ -122,7 +122,14 @@ export interface Transport {
122122 sessionId ?: string ;
123123
124124 /**
125- * Sets the protocol version used for the connection (called when the initialize response is received).
125+ * Sets the protocol version after negotiation during initialization.
126+ * This is called by the Server/Client class after the initialize handshake completes.
126127 */
127128 setProtocolVersion ?: ( version : string ) => void ;
129+
130+ /**
131+ * Gets the negotiated protocol version, if set.
132+ * Available after initialization completes.
133+ */
134+ protocolVersion ?: string ;
128135}
You can’t perform that action at this time.
0 commit comments