MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / connectionFailure

Function connectionFailure

packages/plugins/mcp/src/sdk/connection.ts:181–198  ·  view source on GitHub ↗
(
  transport: string,
  message: string,
  cause: unknown,
)

Source from the content-addressed store, hash-verified

179});
180
181const connectionFailure = (
182 transport: string,
183 message: string,
184 cause: unknown,
185): McpConnectionError | McpOAuthReauthorizationRequired => {
186 if (Predicate.isTagged(cause, "McpOAuthReauthorizationRequired")) {
187 return new McpOAuthReauthorizationRequired({ message: "MCP OAuth re-authorization required" });
188 }
189 // Carry the handshake HTTP status structurally (and in the message for
190 // humans) so the liveness health check can classify a rejected credential
191 // as expired rather than a generic connection failure.
192 const status = httpStatusFromCause(cause);
193 return new McpConnectionError({
194 transport,
195 message: status === undefined ? message : `${message} (HTTP ${status})`,
196 ...(status === undefined ? {} : { httpStatus: status }),
197 });
198};
199
200const connectClient = (input: {
201 transport: string;

Callers 1

connectClientFunction · 0.85

Calls 1

httpStatusFromCauseFunction · 0.90

Tested by

no test coverage detected