File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { findActualExecutable } from "spawn-rx";
20
20
import mcpProxy from "./mcpProxy.js" ;
21
21
22
22
const SSE_HEADERS_PASSTHROUGH = [ "authorization" ] ;
23
+ const STREAMABLE_HTTP_HEADERS_PASSTHROUGH = [ "authorization" ] ;
23
24
24
25
const defaultEnvironment = {
25
26
...getDefaultEnvironment ( ) ,
@@ -96,8 +97,24 @@ const createTransport = async (req: express.Request): Promise<Transport> => {
96
97
console . log ( "Connected to SSE transport" ) ;
97
98
return transport ;
98
99
} else if ( transportType === "streamable - http ") {
100
+ const headers : HeadersInit = { } ;
101
+
102
+ for ( const key of STREAMABLE_HTTP_HEADERS_PASSTHROUGH ) {
103
+ if ( req . headers [ key ] === undefined ) {
104
+ continue ;
105
+ }
106
+
107
+ const value = req . headers [ key ] ;
108
+ headers [ key ] = Array . isArray ( value ) ? value [ value . length - 1 ] : value ;
109
+ }
110
+
99
111
const transport = new StreamableHTTPClientTransport (
100
112
new URL ( query . url as string ) ,
113
+ {
114
+ requestInit : {
115
+ headers,
116
+ } ,
117
+ } ,
101
118
) ;
102
119
await transport . start ( ) ;
103
120
console . log ( "Connected to Streamable HTTP transport" ) ;
You can’t perform that action at this time.
0 commit comments