* 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', )
| 338 | * the needs-auth connection result. |
| 339 | */ |
| 340 | function 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 |
no test coverage detected