@agentvalet/mcp-server 0.3.2 → 0.3.3
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 +23 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -338,13 +338,35 @@ async function handleListPlatforms() {
|
|
|
338
338
|
response = await fetchWithAuth(`${PROXY_URL}/v1/agent/permissions`, { method: "GET", headers: {} });
|
|
339
339
|
}
|
|
340
340
|
catch (err) {
|
|
341
|
-
return errorContent(
|
|
341
|
+
return errorContent(diagnoseNetworkError(err, PROXY_URL));
|
|
342
342
|
}
|
|
343
343
|
const body = await response.text();
|
|
344
344
|
if (!response.ok)
|
|
345
345
|
return errorContent(`Proxy error ${response.status}: ${body}`);
|
|
346
346
|
return { content: [{ type: "text", text: body }] };
|
|
347
347
|
}
|
|
348
|
+
// Translates a fetch() failure into something an end-user can actually act on.
|
|
349
|
+
// The default "Network error: fetch failed" message tells a non-developer
|
|
350
|
+
// nothing. Look at the underlying cause keyword and map to a concrete fix.
|
|
351
|
+
function diagnoseNetworkError(err, proxyUrl) {
|
|
352
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
353
|
+
const lower = raw.toLowerCase();
|
|
354
|
+
// Node's undici surfaces DNS failures as "getaddrinfo ENOTFOUND <host>".
|
|
355
|
+
if (lower.includes("enotfound") || lower.includes("getaddrinfo")) {
|
|
356
|
+
return `Network error: cannot resolve ${proxyUrl}. Check your DNS / corporate proxy / VPN, or confirm the PROXY_URL setting is correct. Raw: ${raw}`;
|
|
357
|
+
}
|
|
358
|
+
// Connection refused / unreachable / TLS handshake failure.
|
|
359
|
+
if (lower.includes("econnrefused") || lower.includes("econnreset")) {
|
|
360
|
+
return `Network error: connection to ${proxyUrl} was refused or reset. The proxy may be down — check https://status.agentvalet.ai — or a firewall is blocking the request. Raw: ${raw}`;
|
|
361
|
+
}
|
|
362
|
+
if (lower.includes("etimedout") || lower.includes("timeout") || lower.includes("aborterror")) {
|
|
363
|
+
return `Network error: request to ${proxyUrl} timed out. Likely causes: VPN routing, corporate proxy buffering, or slow network. Try again or confirm api.agentvalet.ai is reachable from this machine. Raw: ${raw}`;
|
|
364
|
+
}
|
|
365
|
+
if (lower.includes("self signed") || lower.includes("cert") || lower.includes("ssl") || lower.includes("tls")) {
|
|
366
|
+
return `Network error: TLS / certificate problem talking to ${proxyUrl}. A corporate MITM proxy may be intercepting traffic. Raw: ${raw}`;
|
|
367
|
+
}
|
|
368
|
+
return `Network error reaching ${proxyUrl}: ${raw}. Check VPN, corporate proxy, and firewall rules for api.agentvalet.ai. If the proxy itself is down, see https://status.agentvalet.ai.`;
|
|
369
|
+
}
|
|
348
370
|
// Long-poll budget — under Claude Desktop's hardcoded 60s tool timeout
|
|
349
371
|
// (with 10s of safety). After this we return a graceful "queued" message and
|
|
350
372
|
// the action lands in the user's pending-actions list (Layer 4).
|