import fs from "fs";
import path from "path";
function withDefaultLifecycle(servers) {
    return Object.fromEntries(Object.entries(servers).map(([name, server]) => [
        name,
        "lifecycle" in server ? server : { ...server, lifecycle: "eager" },
    ]));
}
export function writePiMcpConfig(options) {
    fs.mkdirSync(options.agentDir, { recursive: true });
    const configPath = path.join(options.agentDir, "mcp.json");
    const config = {
        mcpServers: withDefaultLifecycle(options.servers),
        settings: {
            // Expose each MCP server tool as a native tool (e.g. `playwright__browser_navigate`)
            // instead of routing through Pi's generic `mcp` proxy. This matches the Claude
            // path where MCP tools are first-class to the model.
            directTools: true,
            // The generic `mcp` proxy tool is redundant once direct tools are exposed and only
            // confuses the model (it triggers "MCP not initialized" when called without args).
            disableProxyTool: true,
            // VisionClaw is a trusted agent: bypass per-tool consent.
            autoAuth: true,
        },
    };
    fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
    return configPath;
}
//# sourceMappingURL=mcp-config.js.map