Skip to content

YOLOVibeCode/browser-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

67 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Browser MCP v4.0.12 - WebSocket Architecture

AI-Powered Browser Debugging Suite for Claude Desktop, Cursor, and Windsurf

Version License Chrome Extension MCP WebSocket


🎯 What Is Browser MCP?

Browser MCP is a pure JavaScript Chrome extension that exposes complete browser state to AI assistants through the Model Context Protocol (MCP). It provides 33 powerful debugging tools for inspecting DOM, network, console, storage, and framework state - all accessible to Claude, Cursor, and Windsurf.

✨ Key Features

  • βœ… WebSocket Architecture - Fast, reliable, bidirectional communication
  • βœ… Pure JavaScript - No build step, no TypeScript compilation
  • βœ… 33 Debugging Tools - DOM inspection, network monitoring, storage management
  • βœ… Framework Detection - React, Vue, Angular, Svelte, and more
  • βœ… Zero Dependencies - Self-contained Chrome extension
  • βœ… One-Line Install - Automatic setup script
  • βœ… Cross-Platform - macOS, Linux, Windows

πŸ“¦ Quick Install

⚑ One-Command Installation

macOS / Linux:

# Interactive install
curl -fsSL https://raw.githubusercontent.com/YOLOVibeCode/browser-mcp/main/scripts/setup-mcp.sh | bash

# Auto-install (no prompts)
curl -fsSL https://raw.githubusercontent.com/YOLOVibeCode/browser-mcp/main/scripts/setup-mcp.sh | bash -s -- --yes

Windows (PowerShell):

# Interactive install
irm https://raw.githubusercontent.com/YOLOVibeCode/browser-mcp/main/scripts/setup-mcp.ps1 | iex

# Auto-install (no prompts)
(irm https://raw.githubusercontent.com/YOLOVibeCode/browser-mcp/main/scripts/setup-mcp.ps1) + ' -Yes' | iex

That's it! The script automatically:

  1. βœ… Checks & installs prerequisites (Node.js, npm, Git)
  2. βœ… Installs MCP server from NPM
  3. βœ… Configures your IDE (Claude/Cursor/Windsurf)
  4. βœ… Shows extension installation instructions

🎯 What You Need to Do

After running the install script:

  1. Load the extension in Chrome:
    • Open chrome://extensions/
    • Enable "Developer mode"
    • Click "Load unpacked"
    • Select the folder shown by the script (copied to clipboard!)
  2. Restart your IDE (Claude/Cursor/Windsurf)
  3. Done! πŸŽ‰

πŸ—οΈ Architecture

WebSocket-Based Communication

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   IDE (Claude)   β”‚  MCP Client
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ stdio (newline-delimited JSON)
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MCP Server      β”‚  Node.js (browser-mcp-server)
β”‚  (Node.js)       β”‚  Translates MCP ↔ Extension
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ WebSocket (ws://localhost:8765)
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Chrome Extension β”‚  Service Worker
β”‚  - WebSocket     β”‚  - Handles MCP requests
β”‚    Server        β”‚  - Routes to 33 tools
β”‚  - MCP Protocol  β”‚
β”‚  - 33 Tools      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚ Chrome DevTools Protocol
         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Browser Tabs    β”‚  DOM, Network, Console,
β”‚                  β”‚  Storage, Framework state
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Why WebSocket?

  • βœ… Fast - <1ms communication overhead
  • βœ… Reliable - Automatic reconnection
  • βœ… Simple - Standard protocol
  • βœ… Bidirectional - Real-time updates
  • βœ… Cross-platform - Works everywhere

πŸ› οΈ Available Tools (33 Total)

DOM Inspection (8 tools)

  • getElementInfo - Get complete element details
  • querySelectors - jQuery-style DOM queries
  • getAccessibilityTree - ARIA/a11y inspection
  • getComputedStyles - Full CSS cascade
  • getElementPosition - Layout & positioning
  • getVisibilityInfo - Visibility detection
  • getDOMSnapshot - Complete DOM tree
  • getEventListeners - All event handlers

Network Monitoring (6 tools)

  • getNetworkRequests - All network activity
  • getRequestHeaders - HTTP headers
  • getResponseBody - Response content
  • getResourceTiming - Performance metrics
  • getWebSocketMessages - WebSocket traffic
  • clearNetworkCache - Cache management

Console & Debugging (5 tools)

  • getConsoleLogs - All console messages
  • evaluateExpression - Execute JavaScript
  • getErrorStack - Stack traces
  • getPerformanceMetrics - Core Web Vitals
  • getMemoryUsage - Memory profiling

Storage Management (5 tools)

  • getLocalStorage - localStorage inspection
  • getSessionStorage - sessionStorage inspection
  • getCookies - Cookie management
  • getIndexedDB - IndexedDB queries
  • clearStorage - Storage cleanup

Framework Detection (4 tools)

  • detectFramework - Identify framework
  • getComponentState - React/Vue state
  • getRenderChain - Component hierarchy
  • traceDataSources - Data flow tracking

Source Mapping (3 tools)

  • resolveSourceMap - Map deployed ↔ local code
  • getOriginalPosition - Source map lookup
  • listSourceFiles - Available source files

Tab Management (2 tools)

  • listActiveTabs - All browser tabs
  • switchToTab - Tab navigation

πŸ“ Project Structure

browser-mcp/
β”‚
β”œβ”€β”€ mcp-server/                    # Node.js MCP Server
β”‚   β”œβ”€β”€ index.js                   # Main server
β”‚   β”œβ”€β”€ stdio-handler.js           # MCP protocol (stdin/stdout)
β”‚   β”œβ”€β”€ websocket-client.js        # WebSocket connection
β”‚   β”œβ”€β”€ message-queue.js           # Offline message queue
β”‚   β”œβ”€β”€ package.json               # NPM package
β”‚   └── README.md                  # Documentation
β”‚
β”œβ”€β”€ browser-mcp-extension/         # Chrome Extension
β”‚   β”œβ”€β”€ background/
β”‚   β”‚   β”œβ”€β”€ service-worker.js      # Main entry point
β”‚   β”‚   β”œβ”€β”€ websocket-server.js    # WebSocket server
β”‚   β”‚   β”œβ”€β”€ websocket-frames.js    # RFC 6455 frame parser
β”‚   β”‚   β”œβ”€β”€ mcp-server.js          # MCP protocol handler
β”‚   β”‚   β”œβ”€β”€ tab-manager.js         # Tab state management
β”‚   β”‚   β”œβ”€β”€ adapters/
β”‚   β”‚   β”‚   └── chrome-cdp.js      # Chrome DevTools Protocol
β”‚   β”‚   └── tools/                 # 33 debugging tools
β”‚   β”‚       β”œβ”€β”€ console-tools.js
β”‚   β”‚       β”œβ”€β”€ dom-tools.js
β”‚   β”‚       β”œβ”€β”€ network-tools.js
β”‚   β”‚       β”œβ”€β”€ storage-tools.js
β”‚   β”‚       β”œβ”€β”€ framework-tools.js
β”‚   β”‚       └── ... (11 total files)
β”‚   β”‚
β”‚   β”œβ”€β”€ manifest.json              # Extension manifest
β”‚   β”œβ”€β”€ icons/                     # Extension icons
β”‚   └── popup/                     # Extension UI
β”‚
β”œβ”€β”€ scripts/
β”‚   └── setup-mcp.sh               # One-line installer
β”‚
β”œβ”€β”€ package.json                   # Root package
└── README.md                      # This file

🎯 Usage Examples

Example 1: Inspect Element

Ask Claude/Cursor:

"Show me all properties of the submit button"

Browser MCP:

  • Uses getElementInfo tool
  • Returns: classes, IDs, attributes, computed styles, event listeners

Example 2: Debug Network Request

Ask Claude/Cursor:

"What API calls happened when I clicked that button?"

Browser MCP:

  • Uses getNetworkRequests tool
  • Returns: URL, method, status, headers, timing, response

Example 3: Find Component State

Ask Claude/Cursor:

"What's the current state of the UserProfile component?"

Browser MCP:

  • Uses detectFramework + getComponentState
  • Returns: props, state, hooks, context values

πŸ”§ Manual Installation

Prerequisites

  • Node.js v16+ (with npm)
  • Git
  • Chrome or Chromium

Step 1: Install MCP Server

npm install -g @rvegajr/browser-mcp-server

Step 2: Load Chrome Extension

  1. Open Chrome and go to chrome://extensions/
  2. Enable Developer mode (toggle in top-right)
  3. Click Load unpacked
  4. Select the browser-mcp-extension folder

Step 3: Configure Your IDE

Claude Desktop:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "browser-mcp": {
      "command": "browser-mcp-server"
    }
  }
}

Cursor:

  • macOS/Linux: ~/.cursor/mcp.json
  • Windows: %USERPROFILE%\.cursor\mcp.json
{
  "mcpServers": {
    "browser-mcp": {
      "command": "browser-mcp-server"
    }
  }
}

Windsurf:

  • macOS/Linux: ~/.codeium/windsurf/mcp_config.json
  • Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
{
  "mcpServers": {
    "browser-mcp": {
      "command": "browser-mcp-server"
    }
  }
}

Step 4: Restart Your IDE

Quit completely (Cmd+Q) and reopen.


πŸ§ͺ Testing

Test MCP Server

# Start server
browser-mcp-server

# In another terminal, send test message
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | nc localhost 8765

Test in IDE

  1. Open your IDE (Claude/Cursor/Windsurf)
  2. Ask: "What MCP servers are available?"
  3. Should see: "browser-mcp" with 33 tools
  4. Try: "List all tabs in my browser"

πŸ”§ Troubleshooting

Extension Not Loading

  1. Check Chrome version (requires v90+)
  2. Enable Developer mode in chrome://extensions/
  3. Check console for errors in extension

MCP Server Not Connecting

  1. Verify server is installed: which browser-mcp-server
  2. Check if extension is loaded
  3. Check WebSocket server started: Look for "WebSocket server started" in extension console
  4. Check port 8765 is not in use: lsof -i :8765

IDE Not Detecting MCP Server

  1. Verify config file location
  2. Restart IDE completely (Cmd+Q, then reopen)
  3. Check IDE logs for MCP errors
  4. Verify browser-mcp-server is in PATH

πŸ“š Documentation


πŸ†• What's New in v4.0.0

πŸŽ‰ Complete Architecture Rewrite

  • βœ… WebSocket-based - Replaced Chrome Native Messaging with WebSocket
  • βœ… Faster - <1ms communication overhead (vs ~50ms with Native Messaging)
  • βœ… More Reliable - Auto-reconnect, message queueing
  • βœ… Simpler - No manifest files, no Chrome-specific setup
  • βœ… Better DX - Easier to test and debug

πŸ”₯ Breaking Changes

  • browser-mcp-native-host β†’ browser-mcp-server (new NPM package)
  • No more native messaging manifests required
  • Extension now requires sockets permission instead of nativeMessaging

πŸ“¦ Migration from v3.x

# Uninstall old package
npm uninstall -g browser-mcp-native-host

# Install new package
npm install -g @rvegajr/browser-mcp-server

# Update IDE config - change command name:
# OLD: "command": "browser-mcp-host"
# NEW: "command": "browser-mcp-server"

# Reload extension in Chrome

🀝 Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new features
  4. Submit a pull request

πŸ“„ License

MIT License - see LICENSE


🌟 Why Browser MCP?

  • Pure JavaScript - No build step, instant development
  • Chrome Native - Uses official Chrome DevTools Protocol
  • MCP Compatible - Works with Claude, Cursor, Windsurf
  • Self-Contained - No external dependencies
  • Production Ready - Fully tested with 33 tools
  • WebSocket Fast - Modern, efficient communication

Made with ❀️ by YOLOVibeCode

⭐ Star this repo if it helps your debugging workflow!


πŸ”— Links