@@ -56,6 +56,10 @@ interface SidebarProps {
56
56
setBearerToken : ( token : string ) => void ;
57
57
headerName ?: string ;
58
58
setHeaderName ?: ( name : string ) => void ;
59
+ oauthClientId : string ;
60
+ setOauthClientId : ( id : string ) => void ;
61
+ oauthScope : string ;
62
+ setOauthScope : ( scope : string ) => void ;
59
63
onConnect : ( ) => void ;
60
64
onDisconnect : ( ) => void ;
61
65
stdErrNotifications : StdErrNotification [ ] ;
@@ -83,6 +87,10 @@ const Sidebar = ({
83
87
setBearerToken,
84
88
headerName,
85
89
setHeaderName,
90
+ oauthClientId,
91
+ setOauthClientId,
92
+ oauthScope,
93
+ setOauthScope,
86
94
onConnect,
87
95
onDisconnect,
88
96
stdErrNotifications,
@@ -95,7 +103,7 @@ const Sidebar = ({
95
103
} : SidebarProps ) => {
96
104
const [ theme , setTheme ] = useTheme ( ) ;
97
105
const [ showEnvVars , setShowEnvVars ] = useState ( false ) ;
98
- const [ showBearerToken , setShowBearerToken ] = useState ( false ) ;
106
+ const [ showAuthConfig , setShowAuthConfig ] = useState ( false ) ;
99
107
const [ showConfig , setShowConfig ] = useState ( false ) ;
100
108
const [ shownEnvVars , setShownEnvVars ] = useState < Set < string > > ( new Set ( ) ) ;
101
109
const [ copiedServerEntry , setCopiedServerEntry ] = useState ( false ) ;
@@ -308,51 +316,6 @@ const Sidebar = ({
308
316
/>
309
317
) }
310
318
</ div >
311
- < div className = "space-y-2" >
312
- < Button
313
- variant = "outline"
314
- onClick = { ( ) => setShowBearerToken ( ! showBearerToken ) }
315
- className = "flex items-center w-full"
316
- data-testid = "auth-button"
317
- aria-expanded = { showBearerToken }
318
- >
319
- { showBearerToken ? (
320
- < ChevronDown className = "w-4 h-4 mr-2" />
321
- ) : (
322
- < ChevronRight className = "w-4 h-4 mr-2" />
323
- ) }
324
- Authentication
325
- </ Button >
326
- { showBearerToken && (
327
- < div className = "space-y-2" >
328
- < label className = "text-sm font-medium" > Header Name</ label >
329
- < Input
330
- placeholder = "Authorization"
331
- onChange = { ( e ) =>
332
- setHeaderName && setHeaderName ( e . target . value )
333
- }
334
- data-testid = "header-input"
335
- className = "font-mono"
336
- value = { headerName }
337
- />
338
- < label
339
- className = "text-sm font-medium"
340
- htmlFor = "bearer-token-input"
341
- >
342
- Bearer Token
343
- </ label >
344
- < Input
345
- id = "bearer-token-input"
346
- placeholder = "Bearer Token"
347
- value = { bearerToken }
348
- onChange = { ( e ) => setBearerToken ( e . target . value ) }
349
- data-testid = "bearer-token-input"
350
- className = "font-mono"
351
- type = "password"
352
- />
353
- </ div >
354
- ) }
355
- </ div >
356
319
</ >
357
320
) }
358
321
@@ -521,6 +484,94 @@ const Sidebar = ({
521
484
</ Tooltip >
522
485
</ div >
523
486
487
+ < div className = "space-y-2" >
488
+ < Button
489
+ variant = "outline"
490
+ onClick = { ( ) => setShowAuthConfig ( ! showAuthConfig ) }
491
+ className = "flex items-center w-full"
492
+ data-testid = "auth-button"
493
+ aria-expanded = { showAuthConfig }
494
+ >
495
+ { showAuthConfig ? (
496
+ < ChevronDown className = "w-4 h-4 mr-2" />
497
+ ) : (
498
+ < ChevronRight className = "w-4 h-4 mr-2" />
499
+ ) }
500
+ Authentication
501
+ </ Button >
502
+ { showAuthConfig && (
503
+ < >
504
+ { /* Bearer Token Section */ }
505
+ < div className = "space-y-2 p-3 rounded border" >
506
+ < h4 className = "text-sm font-semibold flex items-center" >
507
+ API Token Authentication
508
+ </ h4 >
509
+ < div className = "space-y-2" >
510
+ < label className = "text-sm font-medium" > Header Name</ label >
511
+ < Input
512
+ placeholder = "Authorization"
513
+ onChange = { ( e ) =>
514
+ setHeaderName && setHeaderName ( e . target . value )
515
+ }
516
+ data-testid = "header-input"
517
+ className = "font-mono"
518
+ value = { headerName }
519
+ />
520
+ < label
521
+ className = "text-sm font-medium"
522
+ htmlFor = "bearer-token-input"
523
+ >
524
+ Bearer Token
525
+ </ label >
526
+ < Input
527
+ id = "bearer-token-input"
528
+ placeholder = "Bearer Token"
529
+ value = { bearerToken }
530
+ onChange = { ( e ) => setBearerToken ( e . target . value ) }
531
+ data-testid = "bearer-token-input"
532
+ className = "font-mono"
533
+ type = "password"
534
+ />
535
+ </ div >
536
+ </ div >
537
+ { transportType !== "stdio" && (
538
+ // OAuth Configuration
539
+ < div className = "space-y-2 p-3 rounded border" >
540
+ < h4 className = "text-sm font-semibold flex items-center" >
541
+ OAuth 2.0 Flow
542
+ </ h4 >
543
+ < div className = "space-y-2" >
544
+ < label className = "text-sm font-medium" > Client ID</ label >
545
+ < Input
546
+ placeholder = "Client ID"
547
+ onChange = { ( e ) => setOauthClientId ( e . target . value ) }
548
+ value = { oauthClientId }
549
+ data-testid = "oauth-client-id-input"
550
+ className = "font-mono"
551
+ />
552
+ < label className = "text-sm font-medium" >
553
+ Redirect URL
554
+ </ label >
555
+ < Input
556
+ readOnly
557
+ placeholder = "Redirect URL"
558
+ value = { window . location . origin + "/oauth/callback" }
559
+ className = "font-mono"
560
+ />
561
+ < label className = "text-sm font-medium" > Scope</ label >
562
+ < Input
563
+ placeholder = "Scope (space-separated)"
564
+ onChange = { ( e ) => setOauthScope ( e . target . value ) }
565
+ value = { oauthScope }
566
+ data-testid = "oauth-scope-input"
567
+ className = "font-mono"
568
+ />
569
+ </ div >
570
+ </ div >
571
+ ) }
572
+ </ >
573
+ ) }
574
+ </ div >
524
575
{ /* Configuration */ }
525
576
< div className = "space-y-2" >
526
577
< Button
0 commit comments