File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,12 @@ export class InspectorOAuthClientProvider implements OAuthClientProvider {
134
134
}
135
135
136
136
redirectToAuthorization ( authorizationUrl : URL ) {
137
+ if (
138
+ authorizationUrl . protocol !== "http:" &&
139
+ authorizationUrl . protocol !== "https:"
140
+ ) {
141
+ throw new Error ( "Authorization URL must be HTTP or HTTPS" ) ;
142
+ }
137
143
window . location . href = authorizationUrl . href ;
138
144
}
139
145
Original file line number Diff line number Diff line change @@ -351,6 +351,7 @@ export function useConnection({
351
351
return ;
352
352
}
353
353
354
+ let lastRequest = "" ;
354
355
try {
355
356
// Inject auth manually instead of using SSEClientTransport, because we're
356
357
// proxying through the inspector server first.
@@ -584,7 +585,9 @@ export function useConnection({
584
585
}
585
586
586
587
if ( capabilities ?. logging && defaultLoggingLevel ) {
588
+ lastRequest = "logging/setLevel" ;
587
589
await client . setLoggingLevel ( defaultLoggingLevel ) ;
590
+ lastRequest = "" ;
588
591
}
589
592
590
593
if ( onElicitationRequest ) {
@@ -598,6 +601,17 @@ export function useConnection({
598
601
setMcpClient ( client ) ;
599
602
setConnectionStatus ( "connected" ) ;
600
603
} catch ( e ) {
604
+ if (
605
+ lastRequest === "logging/setLevel" &&
606
+ e instanceof McpError &&
607
+ e . code === ErrorCode . MethodNotFound
608
+ ) {
609
+ toast ( {
610
+ title : "Error" ,
611
+ description : `Server declares logging capability but doesn't implement method: "${ lastRequest } "` ,
612
+ variant : "destructive" ,
613
+ } ) ;
614
+ }
601
615
console . error ( e ) ;
602
616
setConnectionStatus ( "error" ) ;
603
617
}
You can’t perform that action at this time.
0 commit comments