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 = () => {
204204 ] ) ;
205205 } ,
206206 getRoots : ( ) => rootsRef . current ,
207+ defaultLoggingLevel : "debug"
207208 } ) ;
208209
209210 useEffect ( ( ) => {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
2828 ToolListChangedNotificationSchema ,
2929 PromptListChangedNotificationSchema ,
3030 Progress ,
31+ LoggingLevel ,
3132} from "@modelcontextprotocol/sdk/types.js" ;
3233import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js" ;
3334import { useState } from "react" ;
@@ -63,6 +64,7 @@ interface UseConnectionOptions {
6364 onPendingRequest ?: ( request : any , resolve : any , reject : any ) => void ;
6465 // eslint-disable-next-line @typescript-eslint/no-explicit-any
6566 getRoots ?: ( ) => any [ ] ;
67+ defaultLoggingLevel ?: LoggingLevel ,
6668}
6769
6870export function useConnection ( {
@@ -78,6 +80,7 @@ export function useConnection({
7880 onStdErrNotification,
7981 onPendingRequest,
8082 getRoots,
83+ defaultLoggingLevel,
8184} : UseConnectionOptions ) {
8285 const [ connectionStatus , setConnectionStatus ] =
8386 useState < ConnectionStatus > ( "disconnected" ) ;
@@ -521,6 +524,10 @@ export function useConnection({
521524 } ) ;
522525 }
523526
527+ if ( capabilities ?. logging && defaultLoggingLevel ) {
528+ await client . setLoggingLevel ( defaultLoggingLevel ) ;
529+ }
530+
524531 setMcpClient ( client ) ;
525532 setConnectionStatus ( "connected" ) ;
526533 } catch ( e ) {
You can’t perform that action at this time.
0 commit comments