"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stopPlaywrightServer = void 0;
exports.createPlaywrightServer = createPlaywrightServer;
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
const logger_1 = require("../../../lib/logger");
const tools_1 = require("./tools");
var lifecycle_1 = require("./lifecycle");
Object.defineProperty(exports, "stopPlaywrightServer", { enumerable: true, get: function () { return lifecycle_1.stopPlaywrightServer; } });
/**
 * Create a Playwright Browser MCP server.
 *
 * Provides 8 tools for browser automation:
 *   navigate, screenshot, click, fill, wait_for, evaluate, list_pages, close_page
 *
 * Returns a fresh McpServer instance each time. The browser is shared
 * and lazy-launched on first tool call.
 */
async function createPlaywrightServer(options) {
    const name = options?.name || 'long-tail-playwright';
    const instance = new mcp_js_1.McpServer({ name, version: '1.0.0' });
    (0, tools_1.registerTools)(instance);
    logger_1.loggerRegistry.info(`[lt-mcp:playwright] ${name} ready (8 tools registered)`);
    return instance;
}
