How williamkapke/kapture works
Project type and purpose
• This is a full-stack browser-automation system comprised of:
• A Chrome DevTools Extension (“extension/”) that exposes a DevTools panel and background/content scripts for automating browser actions via the Chrome DevTools Protocol.
• An MCP Server (“server/”) implemented in TypeScript/Node.js that speaks the Model Context Protocol over WebSocket and manages browser tabs, commands, and resources.
• A Test Electron App (“test-app/”) as a sample client to launch and test the extension and server integration.
• End-to-end tests (“e2e/”) validating the extension’s automation commands.
• A static Website (“website/”) for documentation and usage guides.
File structure
• Top-level directories:
• extension/ – manifest.json, background.js, content-script, DevTools panel HTML/CSS/JS, a modular “modules/” folder for individual automation commands (click, fill, screenshot, etc.).
• server/ – a CLI entry (cli.ts), WebSocket transport (websocket-transport.ts), MCP handlers (browser-command-handler.ts, tool-handler.ts), tab registry/manager, YAML loaders, static assets (static/).
• test-app/ – Electron entry (main.js), preload script, renderer UI, demo of stdio↔WebSocket bridge.
• e2e/ – Mocha tests driving the extension via a headless Chrome instance.
• .github/ – CI/CD workflows for building/publishing the extension and site.
Key insights from the README
• Three-layer architecture:
1. Chrome Extension (DevTools panel + background script)
2. WebSocket Bridge (in server or via CLI “bridge” command)
3. MCP Server (handles protocol, tools, tab registry)
• Supports multiple AI clients (Claude Desktop, Cline, etc.) connecting concurrently.
• No external database; state is held in‐memory in the tab registry.
• Commands are modular and pluggable (each tool implementation in extension/modules and server/src).
Final advice
• Be exhaustive: break out the individual server modules (websocket manager, CLI, tool handlers, YAML loader) and extension modules.
• Multi-client connectivity: show multiple AI clients converging on the same WebSocket endpoint.
• Both control flow (commands) and event flow (notifications).