fix: ensure MCP_PROXY_PORT is included when auth is disabled
Address PR feedback by restructuring getClientUrl to always include MCP_PROXY_PORT parameter when using non-default port, regardless of auth status. Also improved code clarity by using params.size check.
This commit is contained in:
parent
9fcfd89326
commit
9e9419bf21
1 changed files with 4 additions and 9 deletions
|
|
@ -17,19 +17,14 @@ function getClientUrl(port, authDisabled, sessionToken, serverPort) {
|
||||||
const host = process.env.HOST || "localhost";
|
const host = process.env.HOST || "localhost";
|
||||||
const baseUrl = `http://${host}:${port}`;
|
const baseUrl = `http://${host}:${port}`;
|
||||||
|
|
||||||
if (authDisabled) {
|
|
||||||
return baseUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
params.set("MCP_PROXY_AUTH_TOKEN", sessionToken);
|
|
||||||
|
|
||||||
// Add server port if it's not the default
|
|
||||||
if (serverPort && serverPort !== DEFAULT_MCP_PROXY_LISTEN_PORT) {
|
if (serverPort && serverPort !== DEFAULT_MCP_PROXY_LISTEN_PORT) {
|
||||||
params.set("MCP_PROXY_PORT", serverPort);
|
params.set("MCP_PROXY_PORT", serverPort);
|
||||||
}
|
}
|
||||||
|
if (!authDisabled) {
|
||||||
return `${baseUrl}/?${params.toString()}`;
|
params.set("MCP_PROXY_AUTH_TOKEN", sessionToken);
|
||||||
|
}
|
||||||
|
return params.size > 0 ? `${baseUrl}/?${params.toString()}` : baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function startDevServer(serverOptions) {
|
async function startDevServer(serverOptions) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue