Skip to content

Commit d3c168e

Browse files
Merge branch 'main' into fix-630
2 parents f128060 + 2feac76 commit d3c168e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

client/src/lib/auth.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ export class InspectorOAuthClientProvider implements OAuthClientProvider {
134134
}
135135

136136
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+
}
137143
window.location.href = authorizationUrl.href;
138144
}
139145

client/src/lib/hooks/useConnection.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ export function useConnection({
351351
return;
352352
}
353353

354+
let lastRequest = "";
354355
try {
355356
// Inject auth manually instead of using SSEClientTransport, because we're
356357
// proxying through the inspector server first.
@@ -584,7 +585,9 @@ export function useConnection({
584585
}
585586

586587
if (capabilities?.logging && defaultLoggingLevel) {
588+
lastRequest = "logging/setLevel";
587589
await client.setLoggingLevel(defaultLoggingLevel);
590+
lastRequest = "";
588591
}
589592

590593
if (onElicitationRequest) {
@@ -598,6 +601,17 @@ export function useConnection({
598601
setMcpClient(client);
599602
setConnectionStatus("connected");
600603
} 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+
}
601615
console.error(e);
602616
setConnectionStatus("error");
603617
}

0 commit comments

Comments
 (0)