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