@opengeni/core 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1238,7 +1238,7 @@ async function validateMcpCapabilityConnection(item, probe = probeStreamableHttp
1238
1238
  };
1239
1239
  } catch (error) {
1240
1240
  throw new HTTPException6(422, {
1241
- message: `MCP capability "${item.name}" could not be enabled because OpenGeni could not initialize ${item.endpointUrl}: ${mcpProbeErrorMessage(error)}`
1241
+ message: `MCP capability "${item.name}" could not be enabled because ${mcpProbeErrorMessage(error, item.endpointUrl)}`
1242
1242
  });
1243
1243
  }
1244
1244
  }
@@ -1261,9 +1261,13 @@ async function probeStreamableHttpMcpServer(input) {
1261
1261
  await client.close().catch(() => void 0);
1262
1262
  }
1263
1263
  }
1264
- function mcpProbeErrorMessage(error) {
1264
+ function mcpProbeErrorMessage(error, endpointUrl) {
1265
1265
  const message = error instanceof Error ? error.message : String(error);
1266
- return message.replace(/\s+/g, " ").trim().slice(0, 500) || "unknown error";
1266
+ const normalized = message.replace(/\s+/g, " ").trim();
1267
+ if (/404|405|not found|unexpected token|not valid json|invalid json|failed to parse|streamable http error|unable to connect|fetch failed|econnrefused|enotfound|timeout|aborted/i.test(normalized)) {
1268
+ return `OpenGeni could not reach a valid Streamable HTTP MCP server at ${endpointUrl}. Check the endpoint URL or choose a different catalog entry.`;
1269
+ }
1270
+ return `OpenGeni could not initialize ${endpointUrl}: ${normalized.slice(0, 500) || "unknown error"}`;
1267
1271
  }
1268
1272
  async function disableCapability(input) {
1269
1273
  const item = await requireCatalogItem(input.db, input.workspaceId, input.settings, input.capabilityId);