Skip to content

Commit 1d4ca43

Browse files
authored
Merge branch 'main' into fix-214
2 parents 1b754f5 + e47b1d8 commit 1d4ca43

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
@@ -371,36 +371,37 @@ const Sidebar = ({
371371
</Select>
372372

373373
<div className="flex items-center space-x-2">
374-
<a
375-
href="https://modelcontextprotocol.io/docs/tools/inspector"
376-
target="_blank"
377-
rel="noopener noreferrer"
378-
>
379-
<Button variant="ghost" title="Inspector Documentation">
380-
<CircleHelp className="w-4 h-4 text-gray-800" />
381-
</Button>
382-
</a>
383-
<a
384-
href="https://modelcontextprotocol.io/docs/tools/debugging"
385-
target="_blank"
386-
rel="noopener noreferrer"
387-
>
388-
<Button variant="ghost" title="Debugging Guide">
389-
<Bug className="w-4 h-4 text-gray-800" />
390-
</Button>
391-
</a>
392-
<a
393-
href="https://github.com/modelcontextprotocol/inspector"
394-
target="_blank"
395-
rel="noopener noreferrer"
374+
<Button variant="ghost" title="Inspector Documentation" asChild>
375+
<a
376+
href="https://modelcontextprotocol.io/docs/tools/inspector"
377+
target="_blank"
378+
rel="noopener noreferrer"
379+
>
380+
<CircleHelp className="w-4 h-4 text-foreground" />
381+
</a>
382+
</Button>
383+
<Button variant="ghost" title="Debugging Guide" asChild>
384+
<a
385+
href="https://modelcontextprotocol.io/docs/tools/debugging"
386+
target="_blank"
387+
rel="noopener noreferrer"
388+
>
389+
<Bug className="w-4 h-4 text-foreground" />
390+
</a>
391+
</Button>
392+
<Button
393+
variant="ghost"
394+
title="Report bugs or contribute on GitHub"
395+
asChild
396396
>
397-
<Button
398-
variant="ghost"
399-
title="Report bugs or contribute on GitHub"
397+
<a
398+
href="https://github.com/modelcontextprotocol/inspector"
399+
target="_blank"
400+
rel="noopener noreferrer"
400401
>
401-
<Github className="w-4 h-4 text-gray-800" />
402-
</Button>
403-
</a>
402+
<Github className="w-4 h-4 text-foreground" />
403+
</a>
404+
</Button>
404405
</div>
405406
</div>
406407
</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)