MCPcopy Create free account
hub / github.com/Noumena-Network/code / handleRemoteAuthFailure

Function handleRemoteAuthFailure

src/services/mcp/client.ts:351–372  ·  view source on GitHub ↗

* Shared handler for sse/http/managed-proxy auth failures during connect: * emits ncode_mcp_server_needs_auth, caches the needs-auth entry, and returns * the needs-auth connection result.

(
  name: string,
  serverRef: ScopedMcpServerConfig,
  transportType: 'sse' | 'http' | 'managed-proxy',
)

Source from the content-addressed store, hash-verified

349 * the needs-auth connection result.
350 */
351function handleRemoteAuthFailure(
352 name: string,
353 serverRef: ScopedMcpServerConfig,
354 transportType: 'sse' | 'http' | 'managed-proxy',
355): MCPServerConnection {
356 logEvent('ncode_mcp_server_needs_auth', {
357 transportType:
358 transportType as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
359 ...mcpBaseUrlAnalytics(serverRef),
360 })
361 const label: Record<typeof transportType, string> = {
362 sse: 'SSE',
363 http: 'HTTP',
364 'managed-proxy': 'managed proxy',
365 }
366 logMCPDebug(
367 name,
368 `Authentication required for ${label[transportType]} server`,
369 )
370 setMcpAuthCacheEntry(name)
371 return { name, type: 'needs-auth', config: serverRef }
372}
373
374/**
375 * Fetch wrapper for managed proxy connections. Attaches the OAuth bearer

Callers 1

client.tsFile · 0.85

Calls 4

mcpBaseUrlAnalyticsFunction · 0.85
logMCPDebugFunction · 0.85
setMcpAuthCacheEntryFunction · 0.85
logEventFunction · 0.50

Tested by

no test coverage detected