Crafter.Review/interfaces/Crafter.Review-Mcp.cppm

37 lines
2 KiB
Text
Raw Normal View History

// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
export module Crafter.Review:Mcp;
import std;
import :Json;
// The Playwright MCP server a lens with the browser environment drives the
// application with (2026-10-15): one server per pass, launched by the CLI
// from --mcp-config (never from the lens's Bash), headless, an in-memory
// profile, its screenshots under the pass's own output dir in the scratch
// tree. The tools are allowlisted by name (:Tools); browser_run_code_unsafe
// runs arbitrary Node code in the server's process and is denied.
export namespace Crafter::Review::Mcp {
// @playwright/mcp, verified 2026-10-15 with CLI 2.1.300.
constexpr std::string_view PlaywrightMcpVersion = "0.0.83";
// The playwright that version depends on, exactly (its package.json):
// `crafter-review browser install` runs its installer.
constexpr std::string_view PlaywrightVersion = "1.64.0-alpha-1790635538000";
// The Chromium build that version's Playwright drives, as `npx playwright
// install chromium` puts it under ~/.cache/ms-playwright: what
// `crafter-review browser install` provides.
constexpr std::string_view ChromiumRevision = "1247";
// --browser chromium: Playwright's own Chromium; without it the server
// wants the `chrome` channel, Google Chrome at /opt/google/chrome
// (2026-10-15: every navigate of the second firing run failed on it).
std::vector<std::string> DefaultArgs();
// The --mcp-config value for one pass: the consumer's command and args (the
// pipeline's pinned default when the config names none) plus this pass's
// output dir.
Json PlaywrightConfig(const Json& functional, const std::string& outputDir);
// The config as compact JSON (DumpCompact), keys in their order.
std::string ConfigJson(const Json& config);
// <scratch>/playwright/<label with / and spaces as _>, made.
std::filesystem::path OutputDir(const std::filesystem::path& scratch, std::string_view label);
}