MCPcopy Index your code
hub / github.com/codeaashu/claude-code / handleRemoteAuthFailure

Function handleRemoteAuthFailure

src/services/mcp/client.ts:340–361  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

338 * the needs-auth connection result.
339 */
340function handleRemoteAuthFailure(
341 name: string,
342 serverRef: ScopedMcpServerConfig,
343 transportType: 'sse' | 'http' | 'claudeai-proxy',
344): MCPServerConnection {
345 logEvent('tengu_mcp_server_needs_auth', {
346 transportType:
347 transportType as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
348 ...mcpBaseUrlAnalytics(serverRef),
349 })
350 const label: Record<typeof transportType, string> = {
351 sse: 'SSE',
352 http: 'HTTP',
353 'claudeai-proxy': 'claude.ai proxy',
354 }
355 logMCPDebug(
356 name,
357 `Authentication required for ${label[transportType]} server`,
358 )
359 setMcpAuthCacheEntry(name)
360 return { name, type: 'needs-auth', config: serverRef }
361}
362
363/**
364 * Fetch wrapper for claude.ai proxy connections. Attaches the OAuth bearer

Callers 1

client.tsFile · 0.85

Calls 4

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

Tested by

no test coverage detected