@@ -114,16 +114,17 @@ export const createServer = () => {
114
114
115
115
let subscriptions : Set < string > = new Set ( ) ;
116
116
let subsUpdateInterval : NodeJS . Timeout | undefined ;
117
- // Set up update interval for subscribed resources
117
+ let stdErrUpdateInterval : NodeJS . Timeout | undefined ;
118
118
119
+ // Set up update interval for subscribed resources
119
120
subsUpdateInterval = setInterval ( ( ) => {
120
121
for ( const uri of subscriptions ) {
121
122
server . notification ( {
122
123
method : "notifications/resources/updated" ,
123
124
params : { uri } ,
124
125
} ) ;
125
126
}
126
- } , 5000 ) ;
127
+ } , 10000 ) ;
127
128
128
129
let logLevel : LoggingLevel = "debug" ;
129
130
let logsUpdateInterval : NodeJS . Timeout | undefined ;
@@ -152,7 +153,21 @@ export const createServer = () => {
152
153
} ;
153
154
if ( ! isMessageIgnored ( message . params . level as LoggingLevel ) )
154
155
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 ) ;
156
171
157
172
// Helper method to request sampling from client
158
173
const requestSampling = async (
@@ -676,6 +691,7 @@ export const createServer = () => {
676
691
const cleanup = async ( ) => {
677
692
if ( subsUpdateInterval ) clearInterval ( subsUpdateInterval ) ;
678
693
if ( logsUpdateInterval ) clearInterval ( logsUpdateInterval ) ;
694
+ if ( stdErrUpdateInterval ) clearInterval ( stdErrUpdateInterval ) ;
679
695
} ;
680
696
681
697
return { server, cleanup } ;
0 commit comments