@@ -88,24 +88,6 @@ export abstract class McpAgent<
8888 return websockets [ 0 ] ;
8989 }
9090
91- /** Build MessageExtraInfo from extracted headers and auth info */
92- private buildMessageExtraInfo ( extraInfo ?: {
93- headers : Record < string , string > ;
94- } ) : MessageExtraInfo | undefined {
95- if ( ! extraInfo ) return ;
96-
97- const headers = { ...extraInfo . headers } ;
98-
99- // Remove internal headers that are not part of the original request
100- delete headers [ MCP_HTTP_METHOD_HEADER ] ;
101- delete headers [ MCP_MESSAGE_HEADER ] ;
102- delete headers [ "upgrade" ] ;
103-
104- return {
105- requestInfo : { headers }
106- } ;
107- }
108-
10991 /** Returns a new transport matching the type of the Agent. */
11092 private initTransport ( ) {
11193 switch ( this . getTransportType ( ) ) {
@@ -210,7 +192,7 @@ export abstract class McpAgent<
210192 async onSSEMcpMessage (
211193 _sessionId : string ,
212194 messageBody : unknown ,
213- extraInfo ?: { headers : Record < string , string > }
195+ extraInfo ?: MessageExtraInfo
214196 ) : Promise < Error | null > {
215197 // Since we address the DO via both the protocol and the session id,
216198 // this should never happen, but let's enforce it just in case
@@ -232,10 +214,7 @@ export abstract class McpAgent<
232214 return null ; // Message was handled by elicitation system
233215 }
234216
235- // Build extra info with auth and request headers, matching StreamableHTTP behavior
236- const extra = this . buildMessageExtraInfo ( extraInfo ) ;
237-
238- this . _transport ?. onmessage ?.( parsedMessage , extra ) ;
217+ this . _transport ?. onmessage ?.( parsedMessage , extraInfo ) ;
239218 return null ;
240219 } catch ( error ) {
241220 console . error ( "Error forwarding message to SSE:" , error ) ;
0 commit comments