Chrome DevTools MCP: AI-Powered Browser Automation
Learn how Chrome DevTools MCP enables AI assistants to automate browser interactions using Puppeteer. Master web testing, debugging, and automation through natural language commands.
Imagine telling your AI assistant: “Test if the login form works” or “Take a screenshot of the homepage” - and it just does it. No writing Puppeteer scripts, no debugging CSS selectors.
Chrome DevTools MCP makes this possible. It’s Google’s official MCP server that connects AI agents to Chrome browser’s DevTools, enabling conversational browser automation.
What is Chrome DevTools MCP?
Chrome DevTools MCP is a specialized MCP server that acts as a bridge between AI models and real Chrome browser instances, using Puppeteer for reliable automation.
How It Works
You (natural language)
↓
Claude (MCP client)
↓
Chrome DevTools MCP Server
↓
Puppeteer (automation library)
↓
Chrome Browser (via Chrome DevTools Protocol)
Key Insight: Instead of writing Puppeteer scripts, you describe what you want in natural language, and the AI figures out the technical details.
Core Features
-
High-Level Tools 🛠️
navigate_page- Go to any URLclick_element- Click buttons, links, etc.type_text- Fill formstake_screenshot- Capture page visualslist_console_messages- See console logsexecute_script- Run JavaScript
-
Puppeteer-Powered 🤖
- Battle-tested Chrome automation
- Automatic waiting (page loads, DOM readiness)
- Handles complex interactions reliably
-
DevTools Integration 🔍
- Access Chrome DevTools Protocol (CDP)
- Inspect network requests
- Debug JavaScript errors
- Monitor performance
-
Conversational Automation 💬
- Natural language commands
- AI handles CSS selectors
- No scripting required
Installation & Setup
Prerequisites
- Chrome/Chromium browser installed
- Node.js 16+ (for Puppeteer)
Method 1: Official CLI (Recommended)
# Install globally
claude mcp add \
--scope global \
chrome-devtools \
-- npx -y @chromedevtools/chrome-devtools-mcp
# Or install for specific project
claude mcp add \
--scope project \
chrome-devtools \
-- npx -y @chromedevtools/chrome-devtools-mcp
Method 2: Manual Configuration
Edit .mcp.json or ~/.claude/.mcp.json:
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["-y", "@chromedevtools/chrome-devtools-mcp"]
}
}
}
Real-World Examples
Example 1: Automated Testing
You: "Test the login flow on https://myapp.com:
1. Navigate to the site
2. Click the login button
3. Fill in username and password
4. Submit the form
5. Check if we're redirected to /dashboard"
Chrome DevTools MCP executes:
1. navigate_page("https://myapp.com")
2. click_element("button[data-testid='login']")
3. type_text("input[name='username']", "testuser")
4. type_text("input[name='password']", "testpass123")
5. click_element("button[type='submit']")
6. Returns: Success - redirected to /dashboard
Result: Full E2E test in natural language
Example 2: Visual Regression Testing
You: "Take screenshots of https://mysite.com on different screen sizes:
desktop (1920x1080), tablet (768x1024), mobile (375x667)"
Chrome DevTools MCP executes:
1. Set viewport 1920x1080 → screenshot as desktop.png
2. Set viewport 768x1024 → screenshot as tablet.png
3. Set viewport 375x667 → screenshot as mobile.png
Result: 3 screenshots for visual comparison
Example 3: Performance Debugging
You: "Load https://myapp.com and tell me:
- How long does it take to load?
- Any console errors?
- What's the largest contentful paint (LCP)?"
Chrome DevTools MCP executes:
1. navigate_page with performance monitoring
2. list_console_messages (check for errors)
3. execute_script to get Web Vitals
Returns:
- Load time: 2.3s
- Errors: None
- LCP: 1.8s (Good)
Example 4: Data Scraping
You: "Go to https://news.ycombinator.com and get the top 10 story titles"
Chrome DevTools MCP executes:
1. navigate_page("https://news.ycombinator.com")
2. execute_script(`
return Array.from(document.querySelectorAll('.titleline > a'))
.slice(0, 10)
.map(a => a.textContent)
`)
Result: Array of top 10 story titles
Available Tools
1. navigate_page(url: string)
Navigate to a URL and wait for page load.
navigate_page("https://example.com")
2. click_element(selector: string)
Click an element by CSS selector.
click_element("button#submit")
3. type_text(selector: string, text: string)
Type text into an input field.
type_text("input[name='email']", "user@example.com")
4. take_screenshot(options?: object)
Capture a screenshot of the page.
take_screenshot({ fullPage: true })
5. list_console_messages()
Get all console logs, warnings, and errors.
list_console_messages()
// Returns: Array of console messages
6. execute_script(script: string)
Run JavaScript in the page context.
execute_script("document.querySelector('h1').textContent")
7. get_page_content()
Get the full HTML of the current page.
get_page_content()
8. wait_for_selector(selector: string, timeout?: number)
Wait for an element to appear.
wait_for_selector(".loading-complete", 5000)
Best Practices
✅ Recommended
-
Use Semantic Selectors
✅ Good: button[data-testid="submit"] ❌ Bad: div > div > button:nth-child(3) -
Wait for Dynamic Content
Always use wait_for_selector for SPAs/AJAX-heavy sites -
Handle Errors Gracefully
Ask Claude to "try clicking submit, if it fails, check console for errors" -
Responsive Testing
Test across multiple viewport sizes -
Combine with Other MCPs
- Filesystem MCP: Save screenshots - Memory MCP: Remember test results - Context7 MCP: Use latest testing best practices
❌ Avoid
- Hardcoded Delays - Use
wait_for_selectorinstead ofsetTimeout - Brittle Selectors - Prefer
data-testidover complex CSS - Ignoring Console Errors - Always check console messages
- Large Screenshots - Specify regions to reduce file size
Use Cases
| Use Case | Description | Complexity |
|---|---|---|
| E2E Testing | Automated user flow testing | ⭐⭐⭐⭐⭐ |
| Visual Regression | Screenshot comparison | ⭐⭐⭐⭐⭐ |
| Web Scraping | Extract data from websites | ⭐⭐⭐⭐ |
| Performance Monitoring | Track load times, Web Vitals | ⭐⭐⭐⭐ |
| Accessibility Testing | Check ARIA labels, contrast | ⭐⭐⭐⭐ |
| Form Automation | Auto-fill and submit forms | ⭐⭐⭐ |
Integration with Other MCPs
Chrome DevTools + Filesystem MCP
Workflow:
1. Chrome DevTools takes screenshots
2. Filesystem saves them to /screenshots
3. AI compares with baseline images
Chrome DevTools + Memory MCP
Workflow:
1. Chrome DevTools runs tests
2. Memory stores test results
3. Next run: AI compares with previous results
Chrome DevTools + Context7 MCP
Workflow:
1. Context7 fetches latest Playwright/Cypress docs
2. Chrome DevTools implements tests using best practices
Troubleshooting
Issue 1: Chrome Not Found
Error: Could not find Chrome executable
Solution:
- Install Chrome/Chromium
- Set
CHROME_PATHenvironment variable
Issue 2: Element Not Found
Error: Selector ".some-class" not found
Solution:
- Use
wait_for_selectorfirst - Ask Claude to “inspect the page and find the correct selector”
Issue 3: Timeout
Error: Navigation timeout exceeded
Solution:
- Increase timeout:
navigate_page(url, { timeout: 30000 }) - Check if site is accessible
Comparison with Traditional Tools
| Feature | Chrome DevTools MCP | Puppeteer Script | Playwright |
|---|---|---|---|
| Setup | MCP config only | Write full script | Write full script |
| Syntax | Natural language | JavaScript | JavaScript/TypeScript |
| Debugging | Conversational | console.log debugging | Built-in inspector |
| Learning Curve | Low (just describe) | Medium (API knowledge) | Medium (API knowledge) |
| Flexibility | High (AI adapts) | High (full control) | High (full control) |
When to use Chrome DevTools MCP:
- ✅ Quick ad-hoc testing
- ✅ Non-technical team members
- ✅ Exploratory testing
- ✅ Rapid prototyping
When to use traditional tools:
- ✅ Complex CI/CD pipelines
- ✅ Performance-critical automation
- ✅ Highly customized workflows
Advanced Examples
Multi-Step Form Filling
You: "Fill out the contact form on https://example.com:
- Name: John Doe
- Email: john@example.com
- Message: I'm interested in your product
- Click submit
- Wait for success message"
Claude handles:
- Finding correct input selectors
- Handling any dropdowns or checkboxes
- Waiting for form submission
- Verifying success
Accessibility Audit
You: "Check https://mysite.com for accessibility issues:
- Are all images alt-tagged?
- Do all forms have labels?
- Is color contrast sufficient?"
Claude executes audits and reports findings
Security Considerations
⚠️ Important:
- Never use with sensitive credentials in production
- Chrome runs in automated mode - easy to detect
- Always respect robots.txt and rate limits
- Don’t scrape without permission
Conclusion
Chrome DevTools MCP brings conversational browser automation to AI assistants. Instead of writing automation scripts, you describe what you want, and Claude handles the technical details.
Is It Right for You?
| Use Case | Recommendation |
|---|---|
| Manual testers | ⭐⭐⭐⭐⭐ |
| Quick debugging | ⭐⭐⭐⭐⭐ |
| Web scraping | ⭐⭐⭐⭐ |
| E2E testing | ⭐⭐⭐⭐ |
| CI/CD pipelines | ⭐⭐ (use Playwright/Cypress) |
Get Started Now
- Install:
claude mcp add --scope global chrome-devtools -- npx -y @chromedevtools/chrome-devtools-mcp - Open Claude and say: “Navigate to https://example.com and take a screenshot”
- Watch the magic happen ✨
Further Reading
- Chrome DevTools MCP GitHub
- Official Chrome Blog Post
- Addy Osmani’s Guide
- Chrome DevTools MCP Tutorial - DataCamp
- AI-Boosted Dev Guide