#!/usr/bin/env node /** * server.ts * * Entry point for the Playwright Pilot AI MCP (Model Context Protocol) server. * * This file does three things: * 1. Creates and wires together all shared service instances that the MCP tools need * (browser, DOM analyzer, page observer, healing engine, skill orchestrator, etc.). * 2. Registers a ListTools handler that advertises the 9 Playwright Pilot AI tools to the * MCP client (Claude Desktop or Claude Code). * 3. Registers a CallTool handler that dispatches incoming tool calls to the correct * implementation function and returns the result. * * Communication protocol: * - All JSON-RPC messages travel over stdout (MCP protocol). * - All log output goes to stderr (never stdout) to avoid corrupting the JSON stream. * * Project root resolution: * The server is compiled to dist/mcp/server.js, so `__dirname` is `dist/mcp/`. * Going two levels up (`../..`) gives the project root regardless of the working * directory. This is important because Claude Desktop launches the server with * cwd='/', which would break all relative path lookups. * * Role in the overall flow: * Claude Desktop / Claude Code → MCP stdio transport → server.ts * → ListTools (tool discovery) / CallTool (tool execution) → individual tool functions */ export {}; //# sourceMappingURL=server.d.ts.map