Skip to content

Commit 0215557

Browse files
authored
Merge branch 'main' into cleanup-old-transports
2 parents da0c855 + e47b1d8 commit 0215557

File tree

3 files changed

+51
-40
lines changed

3 files changed

+51
-40
lines changed

client/src/components/Sidebar.tsx

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -381,36 +381,37 @@ const Sidebar = ({
381381
</Select>
382382

383383
<div className="flex items-center space-x-2">
384-
<a
385-
href="https://modelcontextprotocol.io/docs/tools/inspector"
386-
target="_blank"
387-
rel="noopener noreferrer"
388-
>
389-
<Button variant="ghost" title="Inspector Documentation">
390-
<CircleHelp className="w-4 h-4 text-gray-800" />
391-
</Button>
392-
</a>
393-
<a
394-
href="https://modelcontextprotocol.io/docs/tools/debugging"
395-
target="_blank"
396-
rel="noopener noreferrer"
397-
>
398-
<Button variant="ghost" title="Debugging Guide">
399-
<Bug className="w-4 h-4 text-gray-800" />
400-
</Button>
401-
</a>
402-
<a
403-
href="https://github.com/modelcontextprotocol/inspector"
404-
target="_blank"
405-
rel="noopener noreferrer"
384+
<Button variant="ghost" title="Inspector Documentation" asChild>
385+
<a
386+
href="https://modelcontextprotocol.io/docs/tools/inspector"
387+
target="_blank"
388+
rel="noopener noreferrer"
389+
>
390+
<CircleHelp className="w-4 h-4 text-foreground" />
391+
</a>
392+
</Button>
393+
<Button variant="ghost" title="Debugging Guide" asChild>
394+
<a
395+
href="https://modelcontextprotocol.io/docs/tools/debugging"
396+
target="_blank"
397+
rel="noopener noreferrer"
398+
>
399+
<Bug className="w-4 h-4 text-foreground" />
400+
</a>
401+
</Button>
402+
<Button
403+
variant="ghost"
404+
title="Report bugs or contribute on GitHub"
405+
asChild
406406
>
407-
<Button
408-
variant="ghost"
409-
title="Report bugs or contribute on GitHub"
407+
<a
408+
href="https://github.com/modelcontextprotocol/inspector"
409+
target="_blank"
410+
rel="noopener noreferrer"
410411
>
411-
<Github className="w-4 h-4 text-gray-800" />
412-
</Button>
413-
</a>
412+
<Github className="w-4 h-4 text-foreground" />
413+
</a>
414+
</Button>
414415
</div>
415416
</div>
416417
</div>

client/src/lib/hooks/useConnection.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import {
1919
McpError,
2020
CompleteResultSchema,
2121
ErrorCode,
22+
CancelledNotificationSchema,
23+
ResourceListChangedNotificationSchema,
24+
ToolListChangedNotificationSchema,
25+
PromptListChangedNotificationSchema,
2226
} from "@modelcontextprotocol/sdk/types.js";
2327
import { useState } from "react";
2428
import { toast } from "react-toastify";
@@ -250,20 +254,24 @@ export function useConnection({
250254
});
251255

252256
if (onNotification) {
253-
client.setNotificationHandler(
257+
[
258+
CancelledNotificationSchema,
254259
ProgressNotificationSchema,
255-
onNotification,
256-
);
257-
258-
client.setNotificationHandler(
260+
LoggingMessageNotificationSchema,
259261
ResourceUpdatedNotificationSchema,
260-
onNotification,
261-
);
262+
ResourceListChangedNotificationSchema,
263+
ToolListChangedNotificationSchema,
264+
PromptListChangedNotificationSchema,
265+
].forEach((notificationSchema) => {
266+
client.setNotificationHandler(notificationSchema, onNotification);
267+
});
262268

263-
client.setNotificationHandler(
264-
LoggingMessageNotificationSchema,
265-
onNotification,
266-
);
269+
client.fallbackNotificationHandler = (
270+
notification: Notification,
271+
): Promise<void> => {
272+
onNotification(notification);
273+
return Promise.resolve();
274+
};
267275
}
268276

269277
if (onStdErrNotification) {

client/src/lib/notificationTypes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ export const StdErrNotificationSchema = BaseNotificationSchema.extend({
1414

1515
export const NotificationSchema = ClientNotificationSchema.or(
1616
StdErrNotificationSchema,
17-
).or(ServerNotificationSchema);
17+
)
18+
.or(ServerNotificationSchema)
19+
.or(BaseNotificationSchema);
1820

1921
export type StdErrNotification = z.infer<typeof StdErrNotificationSchema>;
2022
export type Notification = z.infer<typeof NotificationSchema>;

0 commit comments

Comments
 (0)