@@ -114,16 +114,17 @@ export const createServer = () => {
114114
115115 let subscriptions : Set < string > = new Set ( ) ;
116116 let subsUpdateInterval : NodeJS . Timeout | undefined ;
117- // Set up update interval for subscribed resources
117+ let stdErrUpdateInterval : NodeJS . Timeout | undefined ;
118118
119+ // Set up update interval for subscribed resources
119120 subsUpdateInterval = setInterval ( ( ) => {
120121 for ( const uri of subscriptions ) {
121122 server . notification ( {
122123 method : "notifications/resources/updated" ,
123124 params : { uri } ,
124125 } ) ;
125126 }
126- } , 5000 ) ;
127+ } , 10000 ) ;
127128
128129 let logLevel : LoggingLevel = "debug" ;
129130 let logsUpdateInterval : NodeJS . Timeout | undefined ;
@@ -152,7 +153,21 @@ export const createServer = () => {
152153 } ;
153154 if ( ! isMessageIgnored ( message . params . level as LoggingLevel ) )
154155 server . notification ( message ) ;
155- } , 15000 ) ;
156+ } , 20000 ) ;
157+
158+
159+ // Set up update interval for stderr messages
160+ stdErrUpdateInterval = setInterval ( ( ) => {
161+ const shortTimestamp = new Date ( ) . toLocaleTimeString ( [ ] , {
162+ hour : '2-digit' ,
163+ minute : '2-digit' ,
164+ second : '2-digit'
165+ } ) ;
166+ server . notification ( {
167+ method : "notifications/stderr" ,
168+ params : { content : `${ shortTimestamp } : A stderr message` } ,
169+ } ) ;
170+ } , 30000 ) ;
156171
157172 // Helper method to request sampling from client
158173 const requestSampling = async (
@@ -676,6 +691,7 @@ export const createServer = () => {
676691 const cleanup = async ( ) => {
677692 if ( subsUpdateInterval ) clearInterval ( subsUpdateInterval ) ;
678693 if ( logsUpdateInterval ) clearInterval ( logsUpdateInterval ) ;
694+ if ( stdErrUpdateInterval ) clearInterval ( stdErrUpdateInterval ) ;
679695 } ;
680696
681697 return { server, cleanup } ;
0 commit comments