Skip to content

D3OXY/chrome-pilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Chrome MCP Server

A Model Context Protocol (MCP) server that enables AI assistants like Claude to control Chrome browsers through a Chrome extension and WebSocket communication. Perfect for cross-platform automation, especially WSL/Windows setups.

πŸš€ Features

  • Browser Automation: Navigate, click, scroll, fill forms, take screenshots
  • Cross-Platform: Works across WSL/Windows network boundaries
  • Dual Communication: Native messaging (local) + WebSocket (network)
  • Claude Integration: Direct integration with Claude Code and Claude Desktop
  • Real-time Control: Live browser interaction through MCP tools
  • Chrome Extension: Easy-to-install browser extension with popup controls

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    WebSocket     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    MCP/stdio    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Windows   β”‚ ←─────────────→  β”‚     WSL     β”‚ ←─────────────→ β”‚ Claude Code β”‚
β”‚   Chrome    β”‚   ws://IP:9222   β”‚   Server    β”‚                 β”‚             β”‚
β”‚ + Extension β”‚                  β”‚             β”‚                 β”‚             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“¦ Installation

Prerequisites

  • Node.js >= 18.0.0
  • Chrome/Chromium browser
  • TypeScript (for development)

Quick Setup

  1. Clone the repository

    git clone https://github.com/deoxy/chrome-pilot.git
    cd chrome-pilot
  2. Install dependencies

    cd server
    npm install
    npm run build
  3. Start the WebSocket server

    node dist/index.js --websocket
  4. Load Chrome extension

    • Open chrome://extensions/
    • Enable "Developer mode"
    • Click "Load unpacked"
    • Select the extension folder
  5. Configure extension

    • Click extension icon
    • Enter WebSocket URL: ws://YOUR_IP:9222/ws
    • Click "Save Configuration" and "Reconnect"

πŸ”§ Configuration

For Claude Code (WSL)

Add to ~/.claude/settings.json:

{
  "mcpServers": {
    "chrome-pilot": {
      "command": "node",
      "args": ["/path/to/chrome-pilot/server/dist/index.js", "--websocket"],
      "env": {}
    }
  }
}

For Claude Desktop

Add to Claude Desktop settings:

{
  "mcpServers": {
    "chrome-pilot": {
      "command": "node",
      "args": ["/path/to/chrome-pilot/server/dist/index.js"]
    }
  }
}

πŸ› οΈ Available Tools

Tool Description Parameters
navigate Navigate to a URL url, tabId?
get_tabs Get all open browser tabs -
get_current_tab Get currently active tab -
close_tab Close a browser tab tabId
click Click on an element selector, tabId?
type Type text into an input selector, text, tabId?
scroll Scroll the page direction, amount?, tabId?
screenshot Take a screenshot tabId?
get_content Extract page content selector?, tabId?
get_interactive_elements Find clickable elements tabId?
wait_for_element Wait for element to appear selector, timeout?, tabId?

🌐 Network Setup (WSL/Windows)

1. Find WSL IP

ip route | grep default

2. Configure Windows Firewall

# Run as Administrator
New-NetFirewallRule -DisplayName "Chrome MCP Server" -Direction Inbound -Port 9222 -Protocol TCP -Action Allow

3. Extension Setup

  1. Access extension via \\wsl$\Ubuntu\path\to\chrome-pilot\extension
  2. Load in Windows Chrome
  3. Configure WebSocket URL in popup
  4. Test connection

πŸ§ͺ Testing

Test WebSocket Server

curl http://localhost:9222/info
curl -X POST http://localhost:9222/command \
  -H "Content-Type: application/json" \
  -d '{"action": "get_tabs", "params": {}}'

Test with Claude

Can you navigate to google.com and take a screenshot?

πŸ“ Project Structure

chrome-pilot/
β”œβ”€β”€ server/                 # MCP Server (TypeScript)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ index.ts        # Main server entry
β”‚   β”‚   β”œβ”€β”€ websocket-server.ts    # WebSocket server
β”‚   β”‚   β”œβ”€β”€ native-host.ts  # Native messaging
β”‚   β”‚   └── tools/          # Browser automation tools
β”‚   β”œβ”€β”€ package.json
β”‚   └── tsconfig.json
β”œβ”€β”€ extension/              # Chrome Extension
β”‚   β”œβ”€β”€ manifest.json       # Extension config
β”‚   β”œβ”€β”€ background-websocket.js   # Service worker
β”‚   β”œβ”€β”€ content.js          # Content script
β”‚   β”œβ”€β”€ popup.html          # Extension popup
β”‚   └── popup.js
β”œβ”€β”€ native-host/            # Native messaging setup
β”‚   β”œβ”€β”€ install.sh          # Installation script
β”‚   └── com.chrome_mcp.host.json.template
└── docs/                   # Documentation

πŸ” Troubleshooting

Extension Not Connecting

  • Verify WebSocket URL in extension popup
  • Check WSL IP address hasn't changed
  • Ensure server is running on correct port
  • Check Windows firewall settings

MCP Tools Not Working

  • Restart Chrome extension
  • Verify "Connected" status in popup
  • Check server logs for errors
  • Ensure extension has necessary permissions

Performance Issues

  • Use ethernet connection for best performance
  • Monitor network latency between WSL and Windows
  • Consider running on fixed IP

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“ License

MIT License - see LICENSE file for details.

πŸ™ Acknowledgments

  • Built with MCP SDK by Anthropic
  • Uses Chrome Extension APIs for browser automation
  • WebSocket communication for cross-platform support

πŸ“ž Support

About

Chrome MCP Server - AI-powered browser automation through Claude with WebSocket support for WSL/Windows

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors