The address
| Code | Status | Means |
|---|---|---|
| url_required | 400 | No address was given. |
| url_not_https | 400 | Plain http. The token would travel unencrypted. |
| url_blocked | 400 | It does not resolve to a public address. |
| mcp_redirect | 502 | The server answered with a redirect. They are never followed — the destination was never checked. |
The token
| Code | Status | Means |
|---|---|---|
| mcp_token_malformed | 400 | It contains a space. Paste the token alone. |
| mcp_token_required | 401 | The server wants one and none was given. |
| mcp_unauthorized | 401 | It was refused. Rotate it with update(). |
The server
| Code | Status | Means |
|---|---|---|
| mcp_unreachable | 502 | No answer at all. |
| mcp_timeout | 504 | Past the ceiling — 30 s listing, 60 s calling. |
| mcp_http_error | 502 | A refusal at the HTTP level. |
| mcp_bad_response | 502 | The answer was not a readable protocol message. |
| mcp_error | 502 | A protocol error. The server's own message is carried. |
| mcp_protocol_unsupported | 502 | No revision in common. |
mcp_error carries the server's words
It is the one to read rather than interpret: whoever operates the server wrote that message, and it usually names the real cause — a missing capability, an unsupported version, a header that does not match the body.
Handling them
import { IaGenifyError } from "iagenify";
try {
await api.mcp.call("example", "search_docs", { query });
} catch (err) {
if (!(err instanceof IaGenifyError)) throw err;
switch (err.code) {
case "mcp_unauthorized": return rotateToken();
case "mcp_timeout":
case "mcp_unreachable": return markServerDown();
default: throw err;
}
}from iagenify import IaGenifyError
try:
api.mcp.call("example", "search_docs", {"query": query})
except IaGenifyError as error:
if error.code == "mcp_unauthorized":
rotate_token()
elif error.code in ("mcp_timeout", "mcp_unreachable", "mcp_http_error"):
mark_server_down()
else:
raiseThe last one is remembered
A connection keeps lastError, so a server whose token expired or whose address moved shows it in list() rather than only failing inside a run.