(_e?: unknown, retryCount: number = 0)
| 445 | }; |
| 446 | |
| 447 | const connect = async (_e?: unknown, retryCount: number = 0) => { |
| 448 | const clientCapabilities = { |
| 449 | capabilities: { |
| 450 | sampling: {}, |
| 451 | elicitation: { |
| 452 | form: {}, |
| 453 | url: {}, |
| 454 | }, |
| 455 | roots: { |
| 456 | listChanged: true, |
| 457 | }, |
| 458 | tasks: { |
| 459 | list: {}, |
| 460 | cancel: {}, |
| 461 | ...(onPendingRequest || onElicitationRequest |
| 462 | ? { |
| 463 | requests: { |
| 464 | ...(onPendingRequest |
| 465 | ? { sampling: { createMessage: {} } } |
| 466 | : undefined), |
| 467 | ...(onElicitationRequest |
| 468 | ? { elicitation: { create: {} } } |
| 469 | : undefined), |
| 470 | }, |
| 471 | } |
| 472 | : undefined), |
| 473 | }, |
| 474 | }, |
| 475 | }; |
| 476 | |
| 477 | const client = new Client<Request, Notification, Result>( |
| 478 | CLIENT_IDENTITY, |
| 479 | clientCapabilities, |
| 480 | ); |
| 481 | |
| 482 | // Only check proxy health for proxy connections |
| 483 | if (connectionType === "proxy") { |
| 484 | try { |
| 485 | await checkProxyHealth(); |
| 486 | } catch { |
| 487 | setConnectionStatus("error-connecting-to-proxy"); |
| 488 | return; |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | let lastRequest = ""; |
| 493 | try { |
| 494 | // Inject auth manually instead of using SSEClientTransport, because we're |
| 495 | // proxying through the inspector server first. |
| 496 | const headers: HeadersInit = {}; |
| 497 | |
| 498 | // Create an auth provider with the current server URL |
| 499 | const serverAuthProvider = new InspectorOAuthClientProvider(sseUrl); |
| 500 | |
| 501 | // Use custom headers (migration is handled in App.tsx) |
| 502 | let finalHeaders: CustomHeaders = customHeaders || []; |
| 503 | |
| 504 | const isEmptyAuthHeader = (header: CustomHeaders[number]) => |
nothing calls this directly
no test coverage detected