|
| 1 | +# Browser Context Provider (MCP Chrome Extension) |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This application is a powerful browser monitoring and interaction tool that enables AI-powered applications to capture and analyze browser data through a Chrome extension. It consists of three main components working together in a layered architecture: |
| 6 | + |
| 7 | +1. **Chrome Extension**: A browser extension that captures console logs, network activity, and DOM elements. |
| 8 | +2. **Node Server**: An intermediary server that facilitates communication between the Chrome extension and the MCP server. |
| 9 | +3. **MCP Server**: A Model Context Protocol server that provides standardized tools for AI clients to interact with the browser. |
| 10 | + |
| 11 | +## Architecture |
| 12 | + |
| 13 | +``` |
| 14 | +┌─────────────┐ ┌──────────────┐ ┌───────────────┐ ┌─────────────┐ |
| 15 | +│ MCP Client │ ──► │ MCP Server │ ──► │ Node Server │ ──► │ Chrome │ |
| 16 | +│ (e.g. │ ◄── │ (Protocol │ ◄── │ (Middleware) │ ◄── │ Extension │ |
| 17 | +│ Cursor) │ │ Handler) │ │ │ │ │ |
| 18 | +└─────────────┘ └──────────────┘ └───────────────┘ └─────────────┘ |
| 19 | +``` |
| 20 | + |
| 21 | +### Component Details |
| 22 | + |
| 23 | +#### Chrome Extension |
| 24 | + |
| 25 | +- Captures browser console logs |
| 26 | +- Monitors network requests and responses |
| 27 | +- Captures screenshots |
| 28 | +- Tracks selected DOM elements |
| 29 | +- Communicates with the Node server through DevTools protocol |
| 30 | + |
| 31 | +#### Node Server |
| 32 | + |
| 33 | +- Acts as middleware between the Chrome extension and MCP server |
| 34 | +- Processes and routes requests |
| 35 | +- Manages data transformation and communication |
| 36 | + |
| 37 | +#### MCP Server |
| 38 | + |
| 39 | +- Implements the Model Context Protocol |
| 40 | +- Provides standardized tools for AI clients |
| 41 | +- Interfaces with Anthropic Cloud LLM inference endpoints |
| 42 | +- Compatible with various MCP clients (Cursor, etc.) |
| 43 | + |
| 44 | +## Installation |
| 45 | + |
| 46 | +### 1. MCP Server Setup |
| 47 | + |
| 48 | +```bash |
| 49 | +cd mcp-server |
| 50 | +npm install |
| 51 | +npm start |
| 52 | +``` |
| 53 | + |
| 54 | +### 2. Chrome Extension Setup |
| 55 | + |
| 56 | +1. Open your Chrome-based browser |
| 57 | +2. Navigate to `chrome://extensions/` |
| 58 | +3. Enable "Developer mode" |
| 59 | +4. Click "Load unpacked" |
| 60 | +5. Select the `chrome-extension` directory from this repository |
| 61 | + |
| 62 | +### 3. MCP Client Configuration |
| 63 | + |
| 64 | +Configure your MCP client with the following: |
| 65 | + |
| 66 | +1. Command base: `node` |
| 67 | +2. Server path: `[absolute_path_to_workspace]/mcp-server/dist/mcp-server.js` |
| 68 | + |
| 69 | +## Features |
| 70 | + |
| 71 | +- Console log capture |
| 72 | +- Network request/response monitoring |
| 73 | +- Screenshot capabilities |
| 74 | +- DOM element selection |
| 75 | +- Real-time browser state monitoring |
| 76 | +- AI-powered analysis through LLM integration |
| 77 | + |
| 78 | +## Usage |
| 79 | + |
| 80 | +Once installed and configured, the system allows any compatible MCP client to: |
| 81 | + |
| 82 | +- Monitor browser console output |
| 83 | +- Capture network traffic |
| 84 | +- Take screenshots |
| 85 | +- Analyze selected elements |
| 86 | +- Interface with AI models for enhanced functionality |
| 87 | + |
| 88 | +## Compatibility |
| 89 | + |
| 90 | +- Works with any MCP-compatible client |
| 91 | +- Primarily designed for Cursor IDE integration |
| 92 | +- Supports other AI editors and MCP clients |
| 93 | + |
| 94 | +## Development |
| 95 | + |
| 96 | +The application uses TypeScript for the server components and standard web technologies for the Chrome extension. Built files are generated in the `dist` directory upon running `npm start` in the MCP server. |
0 commit comments