Get roots unconditionally when syncRoots is called

* In server/roots.ts
  - in syncRoots, if roots are supported fetch them

* In get-roots-list.ts,
  - Don't import and inspect current roots map, just call syncRoots to get the list.
This commit is contained in:
cliffhall
2025-12-15 19:37:56 -05:00
parent 1b8f376b90
commit c6daef707a
2 changed files with 5 additions and 14 deletions

View File

@@ -27,8 +27,8 @@ export const syncRoots = async (server: McpServer, sessionId?: string) => {
const clientCapabilities = server.server.getClientCapabilities() || {};
const clientSupportsRoots: boolean = clientCapabilities.roots !== undefined;
// If roots have not been fetched for this client, fetch them
if (clientSupportsRoots && !roots.has(sessionId)) {
// Fetch the roots list for this client
if (clientSupportsRoots) {
// Function to request the updated roots list from the client
const requestRoots = async () => {
try {