@@ -16,14 +16,22 @@ import {
1616 ListToolsResultSchema ,
1717 ProgressNotificationSchema ,
1818 ReadResourceResultSchema ,
19+ Request ,
1920 Resource ,
2021 ResourceTemplate ,
22+ Result ,
2123 Root ,
2224 ServerNotification ,
2325 Tool ,
2426} from "@modelcontextprotocol/sdk/types.js" ;
2527import { useCallback , useEffect , useRef , useState } from "react" ;
2628
29+ import {
30+ Notification ,
31+ StdErrNotification ,
32+ StdErrNotificationSchema
33+ } from "./lib/notificationTypes" ;
34+
2735import { Tabs , TabsList , TabsTrigger } from "@/components/ui/tabs" ;
2836import {
2937 Bell ,
@@ -82,6 +90,9 @@ const App = () => {
8290 > ( [ ] ) ;
8391 const [ mcpClient , setMcpClient ] = useState < Client | null > ( null ) ;
8492 const [ notifications , setNotifications ] = useState < ServerNotification [ ] > ( [ ] ) ;
93+ const [ stdErrNotifications , setStdErrNotifications ] = useState <
94+ StdErrNotification [ ]
95+ > ( [ ] ) ;
8596 const [ roots , setRoots ] = useState < Root [ ] > ( [ ] ) ;
8697 const [ env , setEnv ] = useState < Record < string , string > > ( { } ) ;
8798
@@ -380,7 +391,7 @@ const App = () => {
380391
381392 const connectMcpServer = async ( ) => {
382393 try {
383- const client = new Client (
394+ const client = new Client < Request , Notification , Result > (
384395 {
385396 name : "mcp-inspector" ,
386397 version : "0.0.1" ,
@@ -408,8 +419,6 @@ const App = () => {
408419 }
409420
410421 const clientTransport = new SSEClientTransport ( backendUrl ) ;
411- await client . connect ( clientTransport ) ;
412-
413422 client . setNotificationHandler (
414423 ProgressNotificationSchema ,
415424 ( notification ) => {
@@ -420,6 +429,18 @@ const App = () => {
420429 } ,
421430 ) ;
422431
432+ client . setNotificationHandler (
433+ StdErrNotificationSchema ,
434+ ( notification ) => {
435+ setStdErrNotifications ( ( prevErrorNotifications ) => [
436+ ...prevErrorNotifications ,
437+ notification ,
438+ ] ) ;
439+ } ,
440+ ) ;
441+
442+ await client . connect ( clientTransport ) ;
443+
423444 client . setRequestHandler ( CreateMessageRequestSchema , ( request ) => {
424445 return new Promise < CreateMessageResult > ( ( resolve , reject ) => {
425446 setPendingSampleRequests ( ( prev ) => [
@@ -456,6 +477,7 @@ const App = () => {
456477 env = { env }
457478 setEnv = { setEnv }
458479 onConnect = { connectMcpServer }
480+ stdErrNotifications = { stdErrNotifications }
459481 />
460482 < div className = "flex-1 flex flex-col overflow-hidden" >
461483 < div className = "flex-1 overflow-auto" >
0 commit comments