chore: refactor initialize (#812)
This commit is contained in:
@@ -43,9 +43,16 @@ export class BrowserServerBackend implements ServerBackend {
|
||||
this._tools = filteredTools(config);
|
||||
}
|
||||
|
||||
async initialize() {
|
||||
async initialize(server: mcpServer.Server): Promise<void> {
|
||||
this._sessionLog = this._config.saveSession ? await SessionLog.create(this._config) : undefined;
|
||||
this._context = new Context(this._tools, this._config, this._browserContextFactory, this._sessionLog);
|
||||
this._context = new Context({
|
||||
tools: this._tools,
|
||||
config: this._config,
|
||||
browserContextFactory: this._browserContextFactory,
|
||||
sessionLog: this._sessionLog,
|
||||
clientVersion: server.getClientVersion(),
|
||||
capabilities: server.getClientCapabilities() as mcpServer.ClientCapabilities,
|
||||
});
|
||||
}
|
||||
|
||||
tools(): mcpServer.ToolSchema<any>[] {
|
||||
@@ -69,10 +76,6 @@ export class BrowserServerBackend implements ServerBackend {
|
||||
return response.serialize();
|
||||
}
|
||||
|
||||
serverInitialized(version: mcpServer.ClientVersion | undefined) {
|
||||
this._context!.clientVersion = version;
|
||||
}
|
||||
|
||||
serverClosed() {
|
||||
void this._context!.dispose().catch(logUnhandledError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user