This guide provides comprehensive instructions for setting up and using chrome-devtools-mcp on Windows with various AI coding assistants.
- Installation Steps
- Configuration for Different IDEs
- Running the MCP Server
- Testing the Connection
- Troubleshooting
- Security Considerations
Download and install Node.js LTS version from https://nodejs.org/
Verify installation:
node --version
npm --versionYou should see version numbers (Node.js 16.x or higher recommended).
Install globally so it's available from any directory:
npm install -g chrome-devtools-mcpAlternatively, use npx to run without global installation:
npx chrome-devtools-mcp --versionEnsure Google Chrome is installed at the default location:
C:\Program Files\Google\Chrome\Application\chrome.exe
If Chrome is installed elsewhere, you will need to update the paths in the PowerShell scripts.
Codex uses a TOML configuration file located at:
%USERPROFILE%\.codex\config.toml
To configure:
- Copy one of the example files from this repository:
Copy-Item .\examples\config.headful.toml $env:USERPROFILE\.codex\config.toml- Edit the file and replace
<YOUR_USER>with your Windows username:
notepad $env:USERPROFILE\.codex\config.toml- Save and restart Codex IDE.
Cursor also supports MCP configuration. To set up:
- Open Cursor Settings (Ctrl+,)
- Navigate to MCP Settings or Extensions
- Add a new MCP server with these details:
- Name: chrome-devtools
- Command:
C:\\Users\\<YOUR_USER>\\AppData\\Roaming\\npm\\chrome-devtools-mcp.cmd - Args:
["--browser-url", "http://localhost:9222"]
Alternatively, if Cursor uses a config file similar to Codex, place the configuration in the appropriate location.
Windsurf configuration process:
- Locate the Windsurf configuration directory (typically in %APPDATA% or %USERPROFILE%)
- Create or edit the MCP configuration file
- Add the chrome-devtools-mcp server configuration similar to the Codex example
- Restart Windsurf
For Continue.dev extension in VS Code:
- Open VS Code settings
- Find Continue configuration
- Add MCP server configuration in the settings JSON:
{
"continue.mcpServers": {
"chrome-devtools": {
"command": "C:\\Users\\<YOUR_USER>\\AppData\\Roaming\\npm\\chrome-devtools-mcp.cmd",
"args": ["--browser-url", "http://localhost:9222"]
}
}
}For any editor that supports the Model Context Protocol:
- Locate the MCP configuration file or settings panel
- Add chrome-devtools-mcp as a server
- Provide the full path to chrome-devtools-mcp.cmd
- Include appropriate arguments for your use case
Use this method when working with sites that have anti-bot protection:
.\scripts\Start-Chrome-Debug.ps1This script:
- Terminates any existing Chrome processes
- Launches Chrome with a visible window
- Enables remote debugging on port 9222
- Starts the MCP server attached to that browser instance
You can manually interact with Chrome to complete CAPTCHA or Cloudflare challenges.
Use this for automated tasks on sites without bot protection:
.\scripts\Start-ChromeMCP.ps1This script:
- Terminates existing Chrome processes
- Launches Chrome in modern headless mode
- Enables remote debugging
- Starts the MCP server in headless mode
Note: Some websites detect headless browsers and may block access.
For complete control, launch Chrome and the MCP server separately:
Step 1: Start Chrome with debugging
& "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir=C:\chrome-debugStep 2: Start the MCP server
chrome-devtools-mcp --browser-url http://localhost:9222Or if you want to use npx:
npx chrome-devtools-mcp --browser-url http://localhost:9222If you have configured the MCP server in your IDE's config file, the IDE will automatically start and manage the chrome-devtools-mcp process. You still need to ensure Chrome is running with remote debugging enabled.
Open a web browser and navigate to:
http://localhost:9222/json/version
You should see JSON output like:
{
"Browser": "Chrome/119.0.6045.199",
"Protocol-Version": "1.3",
"User-Agent": "Mozilla/5.0...",
"V8-Version": "11.9.169.7",
"WebKit-Version": "537.36"
}If you see this, Chrome is accepting debugging connections.
Visit:
http://localhost:9222/json
This shows all open tabs and their WebSocket debugging URLs.
Ask your AI assistant a simple question:
What is the status of the chrome-devtools MCP server?
Or try a browser command:
Open https://example.com and tell me what you see
Verify port 9222 is listening:
netstat -ano | findstr :9222You should see output showing port 9222 in LISTENING state.
Symptom: Error message when running scripts, or Chrome doesn't appear
Solutions:
- Check if Chrome is already running:
Get-Process chrome -ErrorAction SilentlyContinue- Force kill all Chrome instances:
taskkill /F /IM chrome.exe- Verify Chrome installation path:
Test-Path "C:\Program Files\Google\Chrome\Application\chrome.exe"- Try running Chrome manually:
& "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222Symptom: "Address already in use" error
Solutions:
- Find the process using port 9222:
netstat -ano | findstr :9222Note the PID (last column).
- Kill that specific process:
taskkill /PID <PID> /F- Or kill all Chrome processes:
taskkill /F /IM chrome.exeSymptom: IDE reports MCP server connection failure
Solutions:
- Verify chrome-devtools-mcp is installed:
chrome-devtools-mcp --version- Check the path in your config file:
Get-Command chrome-devtools-mcpThis shows the actual location. Update your config.toml to match.
- Test manual connection:
chrome-devtools-mcp --browser-url http://localhost:9222- Increase the timeout in your config file:
startup_timeout_ms = 60000Symptom: "Checking your browser" or "Access denied" messages
Solutions:
- Use headful mode instead of headless:
.\scripts\Start-Chrome-Debug.ps1-
Manually complete the Cloudflare challenge in the visible Chrome window
-
Do not attempt to bypass automated detection systems
-
Some sites may simply not allow automation
Symptom: AI assistant doesn't respond, or reports timeouts
Solutions:
-
Check Chrome is responsive by visiting http://localhost:9222/json
-
Restart both Chrome and the MCP server
-
Check Windows Firewall isn't blocking localhost connections
-
Try a simpler test command first
Symptom: PowerShell or config parsing errors
Solutions:
- In PowerShell, always quote paths with spaces:
& "C:\Program Files\Google\Chrome\Application\chrome.exe"- In TOML config files, use double backslashes:
command = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"Symptom: Access denied when creating directories or running scripts
Solutions:
-
Run PowerShell as Administrator
-
Check that C:\ is writable or change user-data-dir to a different location:
--user-data-dir=$env:LOCALAPPDATA\chrome-debug- Adjust script execution policy if needed:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserMany websites use sophisticated bot detection:
- Cloudflare Turnstile: Requires browser verification
- reCAPTCHA: Needs human interaction
- Behavioral analysis: Detects automated patterns
Best practices:
- Always use headful mode when encountering these systems
- Manually complete verification challenges
- Do not attempt to bypass security measures
- Respect robots.txt and terms of service
Do:
- Test your own applications
- Automate tasks on sites where you have permission
- Use for legitimate research and development
- Respect rate limits and server resources
Do not:
- Bypass security mechanisms
- Scrape sites that prohibit automated access
- Attempt to access unauthorized resources
- Use for malicious purposes or terms of service violations
Port 9222 exposure:
The Chrome debugging port (9222) should never be exposed to the internet:
- Only bind to localhost (127.0.0.1)
- Use Windows Firewall to block external access
- Never use --remote-debugging-address=0.0.0.0 in production
Check firewall rules:
Get-NetFirewallRule | Where-Object {$_.DisplayName -like "*Chrome*"}When automating browser tasks:
- Be aware of what data you are collecting
- Don't store sensitive information in logs
- Clear browser data periodically
- Use isolated user-data-dir for testing
You can add additional Chrome flags to the launch scripts:
--disable-extensions
--disable-gpu
--no-sandbox
--disable-dev-shm-usage
--disable-blink-features=AutomationControlledEdit scripts/Start-Chrome-Debug.ps1 to add flags as needed.
To run multiple Chrome instances with different profiles:
# Instance 1 on port 9222
& "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir=C:\chrome-debug-1
# Instance 2 on port 9223
& "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9223 --user-data-dir=C:\chrome-debug-2Configure separate MCP servers for each port.
Set environment variables for the MCP server:
env = {
SystemRoot = "C:\\Windows",
PROGRAMFILES = "C:\\Program Files",
CHROME_DEBUG_PORT = "9222"
}If you continue to experience issues:
- Review this entire guide carefully
- Check the main README.md for updates
- Search existing GitHub issues
- Create a new issue with:
- Your Windows version (run
winver) - Node.js version (
node --version) - Chrome version (chrome://version)
- Exact error messages
- Steps to reproduce
- Your Windows version (run
- chrome-devtools-mcp npm package documentation
- Model Context Protocol specification
- Chrome DevTools Protocol documentation
- PowerShell scripting guides for Windows automation
With proper configuration, chrome-devtools-mcp provides powerful browser automation capabilities for AI coding assistants on Windows. Remember to use these tools responsibly and ethically, respecting website terms of service and security measures.