Enhanced MCP server for browser automation with simplified tools, advanced JavaScript execution, and comprehensive debugging capabilities.
- Safe Mode (Default): Secure, sandboxed execution with RPC architecture
- Unsafe Mode: Direct DOM access for advanced automation scenarios
- Clear API separation with async/await patterns
- Component-based capture for accurate selection
- Accessibility-aware element identification
- Automatic trusted click handling for OAuth/popups
- Advanced validation and tracking
// Safe Mode - Controlled DOM access
await api.getText('h1')
await api.click('#submit')
await api.setValue('input', 'text')
await api.exists('.element')
await api.getPageInfo()
// Unsafe Mode - Full browser access
(function(){ return document.title })()- Console log capture
- Network request monitoring
- Performance metrics
- Error tracking with stack traces
- Node.js 20+
- Chrome/Chrome Canary
- Claude Desktop with MCP support
git clone https://github.com/david-strejc/browsermcp-enhanced.git
cd browsermcp-enhanced
./scripts/deploy- Clone and build:
git clone https://github.com/david-strejc/browsermcp-enhanced.git
cd browsermcp-enhanced
npm install
npm run build-
Install Chrome Extension:
- Open
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked"
- Select the
chrome-extensionfolder
- Open
-
Configure Claude Desktop:
Add to ~/.claude/mcp_servers.json:
{
"mcp-server-browsermcp-enhanced": {
"command": "node",
"args": ["/path/to/browsermcp-enhanced/dist/index.js"],
"env": {
"BROWSER_MCP_ALLOWED_ORIGINS": "*"
}
}
}- Restart Claude Desktop
// Navigate to a URL
await browser_navigate({ url: "https://example.com" })
// Take a snapshot
await browser_snapshot()
// Click an element
await browser_click({ ref: "button-1", element: "Submit button" })// Get text content
const result = await browser_execute_js({
code: "return await api.getText('h1')"
})
// Check element existence
const exists = await browser_execute_js({
code: "return await api.exists('#login-form')"
})
// Complex operations
const data = await browser_execute_js({
code: `
const title = await api.getText('h1');
const hasForm = await api.exists('form');
return { title, hasForm };
`
})// Direct DOM access (requires IIFE wrapper)
const result = await browser_execute_js({
code: "(function(){ return document.title })()",
unsafe: true
})
// Access framework internals
const vueData = await browser_execute_js({
code: "(function(){ return document.querySelector('#app').__vue__.$data })()",
unsafe: true
})// Multi-step form filling
await browser_multitool({
intent: "form_fill",
snapshot: snapshotData,
fields: {
"username": "john.doe",
"email": "[email protected]",
"message": "Hello world"
}
})// Attach debugger
await browser_debugger_attach({ domains: ["console", "network"] })
// Get console logs
const logs = await browser_debugger_get_data({ type: "console" })
// Monitor network
const requests = await browser_debugger_get_data({ type: "network" })# Allow all origins (development)
BROWSER_MCP_ALLOWED_ORIGINS="*"
# Specific origins (production)
BROWSER_MCP_ALLOWED_ORIGINS="https://example.com,https://app.example.com"
# Custom WebSocket port
BROWSER_MCP_PORT=8765- Open extension popup
- Configure:
- Auto-reconnect intervals
- Debug logging
- Performance monitoring
browser_navigate- Navigate to URLbrowser_snapshot- Capture page statebrowser_click- Click elementsbrowser_type- Type textbrowser_execute_js- Execute JavaScript
browser_multitool- Pattern-based automationbrowser_debugger_*- Debugging utilitiesbrowser_tab_*- Tab management
# Run tests
npm test
# Quick test
npm run test:quick
# With coverage
npm run test:coverage# Watch mode
npm run watch
# Type checking
npm run typecheck
# Inspector
npm run inspectorSee CHANGELOG.md for detailed version history.
- π First production-ready release
- β RPC-based safe mode execution
- β Sandboxed iframe isolation
- β Comprehensive testing suite
- β Full documentation
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Model Context Protocol team for the MCP specification
- Playwright for browser automation inspiration
- Claude and the o3 model for architectural guidance
- All contributors and testers
- WebSocket reconnection may require Chrome restart
- Some sites with strict CSP may require unsafe mode
- Safari and Firefox support coming in v2.0.0
Made with β€οΈ by the BrowserMCP Enhanced Contributors
