chore: handle list roots in the server, with timeout (#898)
This commit is contained in:
@@ -45,11 +45,9 @@ export class BrowserServerBackend implements ServerBackend {
|
||||
this._tools = filteredTools(config);
|
||||
}
|
||||
|
||||
async initialize(server: mcpServer.Server): Promise<void> {
|
||||
const capabilities = server.getClientCapabilities();
|
||||
async initialize(clientVersion: mcpServer.ClientVersion, roots: mcpServer.Root[]): Promise<void> {
|
||||
let rootPath: string | undefined;
|
||||
if (capabilities?.roots) {
|
||||
const { roots } = await server.listRoots();
|
||||
if (roots.length > 0) {
|
||||
const firstRootUri = roots[0]?.uri;
|
||||
const url = firstRootUri ? new URL(firstRootUri) : undefined;
|
||||
rootPath = url ? fileURLToPath(url) : undefined;
|
||||
@@ -60,7 +58,7 @@ export class BrowserServerBackend implements ServerBackend {
|
||||
config: this._config,
|
||||
browserContextFactory: this._browserContextFactory,
|
||||
sessionLog: this._sessionLog,
|
||||
clientInfo: { ...server.getClientVersion(), rootPath },
|
||||
clientInfo: { ...clientVersion, rootPath },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user