Merge branch 'main' of https://github.com/modelcontextprotocol/servers into burkeholland-vscode-install-instructions

This commit is contained in:
Burke Holland
2025-04-15 16:40:03 -05:00
parent 090b6b7c1a
commit adac92f93d
4 changed files with 80 additions and 21 deletions

View File

@@ -114,8 +114,9 @@ export const createServer = () => {
let subscriptions: Set<string> = new Set();
let subsUpdateInterval: NodeJS.Timeout | undefined;
// Set up update interval for subscribed resources
let stdErrUpdateInterval: NodeJS.Timeout | undefined;
// Set up update interval for subscribed resources
subsUpdateInterval = setInterval(() => {
for (const uri of subscriptions) {
server.notification({
@@ -123,7 +124,7 @@ export const createServer = () => {
params: { uri },
});
}
}, 5000);
}, 10000);
let logLevel: LoggingLevel = "debug";
let logsUpdateInterval: NodeJS.Timeout | undefined;
@@ -152,7 +153,21 @@ export const createServer = () => {
};
if (!isMessageIgnored(message.params.level as LoggingLevel))
server.notification(message);
}, 15000);
}, 20000);
// Set up update interval for stderr messages
stdErrUpdateInterval = setInterval(() => {
const shortTimestamp = new Date().toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
});
server.notification({
method: "notifications/stderr",
params: { content: `${shortTimestamp}: A stderr message` },
});
}, 30000);
// Helper method to request sampling from client
const requestSampling = async (
@@ -676,6 +691,7 @@ export const createServer = () => {
const cleanup = async () => {
if (subsUpdateInterval) clearInterval(subsUpdateInterval);
if (logsUpdateInterval) clearInterval(logsUpdateInterval);
if (stdErrUpdateInterval) clearInterval(stdErrUpdateInterval);
};
return { server, cleanup };