This commit is contained in:
cliffhall 2025-05-30 17:51:22 -04:00
commit b732ab4085
2 changed files with 8 additions and 9 deletions

View file

@ -259,7 +259,7 @@ app.get("/stdio", async (req, res) => {
} catch (error) { } catch (error) {
if (error instanceof SseError && error.code === 401) { if (error instanceof SseError && error.code === 401) {
console.error( console.error(
"Received 401 Unauthorized from MCP server. Authentication failure." "Received 401 Unauthorized from MCP server. Authentication failure.",
); );
res.status(401).json(error); res.status(401).json(error);
return; return;
@ -305,7 +305,6 @@ app.get("/stdio", async (req, res) => {
transportToClient: webAppTransport, transportToClient: webAppTransport,
transportToServer: serverTransport, transportToServer: serverTransport,
}); });
} catch (error) { } catch (error) {
console.error("Error in /stdio route:", error); console.error("Error in /stdio route:", error);
res.status(500).json(error); res.status(500).json(error);
@ -323,7 +322,7 @@ app.get("/sse", async (req, res) => {
} catch (error) { } catch (error) {
if (error instanceof SseError && error.code === 401) { if (error instanceof SseError && error.code === 401) {
console.error( console.error(
"Received 401 Unauthorized from MCP server. Authentication failure." "Received 401 Unauthorized from MCP server. Authentication failure.",
); );
res.status(401).json(error); res.status(401).json(error);
return; return;
@ -355,7 +354,6 @@ app.get("/sse", async (req, res) => {
transportToServer: serverTransport, transportToServer: serverTransport,
}); });
} }
} catch (error) { } catch (error) {
console.error("Error in /sse route:", error); console.error("Error in /sse route:", error);
res.status(500).json(error); res.status(500).json(error);

View file

@ -7,8 +7,9 @@ function onClientError(error: Error) {
function onServerError(error: Error) { function onServerError(error: Error) {
if ( if (
(error?.message && error.message.includes("Error POSTing to endpoint (HTTP 404)")) || (error?.message &&
(error?.cause && JSON.stringify(error.cause).includes('ECONNREFUSED')) error.message.includes("Error POSTing to endpoint (HTTP 404)")) ||
(error?.cause && JSON.stringify(error.cause).includes("ECONNREFUSED"))
) { ) {
console.error("Connection refused. Is the MCP server running?"); console.error("Connection refused. Is the MCP server running?");
} else { } else {