browser-agent-mcp
Version:
Chrome extension and MCP server for comprehensive browser automation with AI agents
71 lines (59 loc) ⢠2.22 kB
JavaScript
import { spawn } from "child_process";
import path from "path";
import fs from "fs";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
console.log("š Verifying Browser Agent MCP Installation...\n");
// Check if dist/extension exists
const extensionPath = path.join(__dirname, "..", "dist", "extension");
const manifestPath = path.join(extensionPath, "manifest.json");
console.log("ā
Checking extension build...");
if (fs.existsSync(manifestPath)) {
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
console.log(` Extension v${manifest.version} ready`);
console.log(` š Extension path: ${extensionPath}`);
} else {
console.log("ā Extension not built. Run: npm run build");
process.exit(1);
}
// Check if server build exists
const serverPath = path.join(__dirname, "..", "dist", "server", "index.js");
console.log("\nā
Checking server build...");
if (fs.existsSync(serverPath)) {
console.log(" Server build ready");
} else {
console.log("ā Server not built. Run: npm run build");
process.exit(1);
}
// Test server startup (brief)
console.log("\nš Testing server startup...");
const server = spawn("node", [serverPath], {
stdio: ["pipe", "pipe", "pipe"],
timeout: 3000,
});
let serverOutput = "";
server.stdout.on("data", (data) => {
serverOutput += data.toString();
});
server.stderr.on("data", (data) => {
serverOutput += data.toString();
});
setTimeout(() => {
server.kill();
if (serverOutput.includes("WebSocket server listening")) {
console.log("ā
Server starts successfully");
console.log(
"\nš Installation verified! Browser Agent MCP is ready to use."
);
console.log("\nš Next steps:");
console.log("1. Load the Chrome extension from:", extensionPath);
console.log("2. Configure your MCP client (see examples/ folder)");
console.log("3. Start using browser automation commands!");
} else {
console.log("ā Server startup test failed");
console.log("Output:", serverOutput);
process.exit(1);
}
}, 2000);