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) {
if (error instanceof SseError && error.code === 401) {
console.error(
"Received 401 Unauthorized from MCP server. Authentication failure."
"Received 401 Unauthorized from MCP server. Authentication failure.",
);
res.status(401).json(error);
return;
@ -305,7 +305,6 @@ app.get("/stdio", async (req, res) => {
transportToClient: webAppTransport,
transportToServer: serverTransport,
});
} catch (error) {
console.error("Error in /stdio route:", error);
res.status(500).json(error);
@ -323,7 +322,7 @@ app.get("/sse", async (req, res) => {
} catch (error) {
if (error instanceof SseError && error.code === 401) {
console.error(
"Received 401 Unauthorized from MCP server. Authentication failure."
"Received 401 Unauthorized from MCP server. Authentication failure.",
);
res.status(401).json(error);
return;
@ -333,7 +332,7 @@ app.get("/sse", async (req, res) => {
);
res.status(404).json(error);
return;
} else if (JSON.stringify(error).includes("ECONNREFUSED")) {
} else if (JSON.stringify(error).includes("ECONNREFUSED")) {
console.error("Connection refused. Is the MCP server running?");
res.status(500).json(error);
} else {
@ -355,7 +354,6 @@ app.get("/sse", async (req, res) => {
transportToServer: serverTransport,
});
}
} catch (error) {
console.error("Error in /sse route:", error);
res.status(500).json(error);

View file

@ -6,10 +6,11 @@ function onClientError(error: Error) {
}
function onServerError(error: Error) {
if (
(error?.message && error.message.includes("Error POSTing to endpoint (HTTP 404)")) ||
(error?.cause && JSON.stringify(error.cause).includes('ECONNREFUSED'))
) {
if (
(error?.message &&
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?");
} else {
console.error("Error from MCP server:", error);