Preserve original URL
This commit is contained in:
parent
cdab12a8e5
commit
d16e89df1e
2 changed files with 8 additions and 2 deletions
|
|
@ -15,7 +15,11 @@ export type TransportOptions = {
|
|||
|
||||
function createSSETransport(options: TransportOptions): Transport {
|
||||
const baseUrl = new URL(options.url ?? "");
|
||||
// Create new URL while preserving the port from baseUrl
|
||||
const sseUrl = new URL("/sse", baseUrl);
|
||||
if (baseUrl.port) {
|
||||
sseUrl.port = baseUrl.port;
|
||||
}
|
||||
|
||||
return new SSEClientTransport(sseUrl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,6 +280,8 @@ export function useConnection({
|
|||
return;
|
||||
}
|
||||
let mcpProxyServerUrl;
|
||||
const originalUrl = new URL(sseUrl);
|
||||
|
||||
switch (transportType) {
|
||||
case "stdio":
|
||||
mcpProxyServerUrl = new URL(`${getMCPProxyAddress(config)}/stdio`);
|
||||
|
|
@ -290,12 +292,12 @@ export function useConnection({
|
|||
|
||||
case "sse":
|
||||
mcpProxyServerUrl = new URL(`${getMCPProxyAddress(config)}/sse`);
|
||||
mcpProxyServerUrl.searchParams.append("url", sseUrl);
|
||||
mcpProxyServerUrl.searchParams.append("url", originalUrl.toString());
|
||||
break;
|
||||
|
||||
case "streamable-http":
|
||||
mcpProxyServerUrl = new URL(`${getMCPProxyAddress(config)}/mcp`);
|
||||
mcpProxyServerUrl.searchParams.append("url", sseUrl);
|
||||
mcpProxyServerUrl.searchParams.append("url", originalUrl.toString());
|
||||
break;
|
||||
}
|
||||
(mcpProxyServerUrl as URL).searchParams.append(
|
||||
|
|
|
|||
Loading…
Reference in a new issue