chore: mcp backend switcher (#854)

This commit is contained in:
Yury Semikhatsky
2025-08-11 14:16:43 -07:00
committed by GitHub
parent db9cfe1720
commit f010164bf1
10 changed files with 224 additions and 70 deletions

View File

@@ -27,7 +27,7 @@ import type { Server } from '@modelcontextprotocol/sdk/server/index.js';
export async function createConnection(userConfig: Config = {}, contextGetter?: () => Promise<BrowserContext>): Promise<Server> {
const config = await resolveConfig(userConfig);
const factory = contextGetter ? new SimpleBrowserContextFactory(contextGetter) : contextFactory(config);
return mcpServer.createServer(new BrowserServerBackend(config, [factory]), false);
return mcpServer.createServer(new BrowserServerBackend(config, factory), false);
}
class SimpleBrowserContextFactory implements BrowserContextFactory {