Skip to content

Commit fc6c209

Browse files
committed
fix(filesystem): distinguish CLI-override from unsupported-roots in log message
Addresses review feedback on #3938. The else branch is now reached in two cases (client lacks roots capability, or CLI dirs override client roots), so log separately to avoid misleading debug output.
1 parent f8204c5 commit fc6c209

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/filesystem/index.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,11 @@ server.server.oninitialized = async () => {
746746
console.error("Failed to request initial roots from client:", error instanceof Error ? error.message : String(error));
747747
}
748748
} else {
749-
if (allowedDirectories.length > 0) {
749+
if (cliDirectoriesProvided) {
750+
console.error("CLI directories provided - ignoring client MCP roots:", allowedDirectories);
751+
} else if (allowedDirectories.length > 0) {
750752
console.error("Client does not support MCP Roots, using allowed directories set from server args:", allowedDirectories);
751-
}else{
753+
} else {
752754
throw new Error(`Server cannot operate: No allowed directories available. Server was started without command-line directories and client either does not support MCP roots protocol or provided empty roots. Please either: 1) Start server with directory arguments, or 2) Use a client that supports MCP roots protocol and provides valid root directories.`);
753755
}
754756
}

0 commit comments

Comments
 (0)