File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,7 @@ const App = () => {
204
204
] ) ;
205
205
} ,
206
206
getRoots : ( ) => rootsRef . current ,
207
+ defaultLoggingLevel : "debug"
207
208
} ) ;
208
209
209
210
useEffect ( ( ) => {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
28
28
ToolListChangedNotificationSchema ,
29
29
PromptListChangedNotificationSchema ,
30
30
Progress ,
31
+ LoggingLevel ,
31
32
} from "@modelcontextprotocol/sdk/types.js" ;
32
33
import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js" ;
33
34
import { useState } from "react" ;
@@ -63,6 +64,7 @@ interface UseConnectionOptions {
63
64
onPendingRequest ?: ( request : any , resolve : any , reject : any ) => void ;
64
65
// eslint-disable-next-line @typescript-eslint/no-explicit-any
65
66
getRoots ?: ( ) => any [ ] ;
67
+ defaultLoggingLevel ?: LoggingLevel ,
66
68
}
67
69
68
70
export function useConnection ( {
@@ -78,6 +80,7 @@ export function useConnection({
78
80
onStdErrNotification,
79
81
onPendingRequest,
80
82
getRoots,
83
+ defaultLoggingLevel,
81
84
} : UseConnectionOptions ) {
82
85
const [ connectionStatus , setConnectionStatus ] =
83
86
useState < ConnectionStatus > ( "disconnected" ) ;
@@ -521,6 +524,10 @@ export function useConnection({
521
524
} ) ;
522
525
}
523
526
527
+ if ( capabilities ?. logging && defaultLoggingLevel ) {
528
+ await client . setLoggingLevel ( defaultLoggingLevel ) ;
529
+ }
530
+
524
531
setMcpClient ( client ) ;
525
532
setConnectionStatus ( "connected" ) ;
526
533
} catch ( e ) {
You can’t perform that action at this time.
0 commit comments