UNPKG

browser-agent-mcp

Version:

Chrome extension and MCP server for comprehensive browser automation with AI agents

71 lines (59 loc) • 2.22 kB
#!/usr/bin/env node 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);