File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,11 @@ export type TransportOptions = {
15
15
16
16
function createSSETransport ( options : TransportOptions ) : Transport {
17
17
const baseUrl = new URL ( options . url ?? "" ) ;
18
+ // Create new URL while preserving the port from baseUrl
18
19
const sseUrl = new URL ( "/sse" , baseUrl ) ;
20
+ if ( baseUrl . port ) {
21
+ sseUrl . port = baseUrl . port ;
22
+ }
19
23
20
24
return new SSEClientTransport ( sseUrl ) ;
21
25
}
Original file line number Diff line number Diff line change @@ -280,6 +280,8 @@ export function useConnection({
280
280
return ;
281
281
}
282
282
let mcpProxyServerUrl ;
283
+ const originalUrl = new URL ( sseUrl ) ;
284
+
283
285
switch ( transportType ) {
284
286
case "stdio" :
285
287
mcpProxyServerUrl = new URL ( `${ getMCPProxyAddress ( config ) } /stdio` ) ;
@@ -290,12 +292,12 @@ export function useConnection({
290
292
291
293
case "sse" :
292
294
mcpProxyServerUrl = new URL ( `${ getMCPProxyAddress ( config ) } /sse` ) ;
293
- mcpProxyServerUrl . searchParams . append ( "url" , sseUrl ) ;
295
+ mcpProxyServerUrl . searchParams . append ( "url" , originalUrl . toString ( ) ) ;
294
296
break ;
295
297
296
298
case "streamable-http" :
297
299
mcpProxyServerUrl = new URL ( `${ getMCPProxyAddress ( config ) } /mcp` ) ;
298
- mcpProxyServerUrl . searchParams . append ( "url" , sseUrl ) ;
300
+ mcpProxyServerUrl . searchParams . append ( "url" , originalUrl . toString ( ) ) ;
299
301
break ;
300
302
}
301
303
( mcpProxyServerUrl as URL ) . searchParams . append (
You can’t perform that action at this time.
0 commit comments