Skip to content

Commit d332352

Browse files
authored
Merge pull request modelcontextprotocol#286 from Cloudkkk/main
feat: 🎸 Add clear button for error notifications
2 parents 8f7680d + d0622d3 commit d332352

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

client/src/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,10 @@ const App = () => {
467467
setLogLevel(level);
468468
};
469469

470+
const clearStdErrNotifications = () => {
471+
setStdErrNotifications([]);
472+
};
473+
470474
if (window.location.pathname === "/oauth/callback") {
471475
const OAuthCallback = React.lazy(
472476
() => import("./components/OAuthCallback"),
@@ -502,6 +506,7 @@ const App = () => {
502506
logLevel={logLevel}
503507
sendLogLevelRequest={sendLogLevelRequest}
504508
loggingSupported={!!serverCapabilities?.logging || false}
509+
clearStdErrNotifications={clearStdErrNotifications}
505510
/>
506511
<div className="flex-1 flex flex-col overflow-hidden">
507512
<div className="flex-1 overflow-auto">

client/src/components/Sidebar.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ interface SidebarProps {
5454
onConnect: () => void;
5555
onDisconnect: () => void;
5656
stdErrNotifications: StdErrNotification[];
57+
clearStdErrNotifications: () => void;
5758
logLevel: LoggingLevel;
5859
sendLogLevelRequest: (level: LoggingLevel) => void;
5960
loggingSupported: boolean;
@@ -78,6 +79,7 @@ const Sidebar = ({
7879
onConnect,
7980
onDisconnect,
8081
stdErrNotifications,
82+
clearStdErrNotifications,
8183
logLevel,
8284
sendLogLevelRequest,
8385
loggingSupported,
@@ -514,9 +516,19 @@ const Sidebar = ({
514516
{stdErrNotifications.length > 0 && (
515517
<>
516518
<div className="mt-4 border-t border-gray-200 pt-4">
517-
<h3 className="text-sm font-medium">
518-
Error output from MCP server
519-
</h3>
519+
<div className="flex justify-between items-center">
520+
<h3 className="text-sm font-medium">
521+
Error output from MCP server
522+
</h3>
523+
<Button
524+
variant="outline"
525+
size="sm"
526+
onClick={clearStdErrNotifications}
527+
className="h-8 px-2"
528+
>
529+
Clear
530+
</Button>
531+
</div>
520532
<div className="mt-2 max-h-80 overflow-y-auto">
521533
{stdErrNotifications.map((notification, index) => (
522534
<div

client/src/components/__tests__/Sidebar.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe("Sidebar Environment Variables", () => {
2929
onConnect: jest.fn(),
3030
onDisconnect: jest.fn(),
3131
stdErrNotifications: [],
32+
clearStdErrNotifications: jest.fn(),
3233
logLevel: "info" as const,
3334
sendLogLevelRequest: jest.fn(),
3435
loggingSupported: true,

0 commit comments

Comments
 (0)