管理chrome-devtools-mcp服务及OpenClaw内置Chrome浏览器,用于基于MCP的浏览器自动化。适用于用户需要使用chrome-devtools-mcp功能时。
Manage OpenClaw's built-in Chrome browser and chrome-devtools-mcp integration for browser automation via MCP protocol.
This skill manages two components:
openclaw profile) - The browser instancetext
┌─────────────────┐ ┌─────────────────────┐ ┌─────────────────┐
│ OpenClaw │────▶│ Built-in Chrome │◀────│ chrome-devtools│
│ (browser tool)│ │ (CDP Port 18800) │ │ -mcp (MCP srv) │
└─────────────────┘ └─────────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ MCP Client │
│ (mcporter etc) │
└─────────────────┘
browser toolbrowser(action: "open")javascript
browser({
action: "status",
profile: "openclaw"
})
Expected running state:
json
{
"enabled": true,
"profile": "openclaw",
"running": true,
"cdpReady": true,
"cdpPort": 18800,
"cdpUrl": "http://127.0.0.1:18800"
}
powershell
Invoke-WebRequest -Uri "http://localhost:18800/json/version" -Method GET
Expected response:
json
{
"Browser": "Chrome/134.0.0.0",
"Protocol-Version": "1.3",
"User-Agent": "Mozilla/5.0...",
"V8-Version": "...",
"WebKit-Version": "...",
"webSocketDebuggerUrl": "ws://localhost:18800/devtools/browser/..."
}
Since chrome-devtools-mcp runs as a stdio service per MCP client session, there's no persistent process to check. Instead, verify the MCP configuration is correct.
javascript
// Open a blank page to start Chrome
browser({
action: "open",
profile: "openclaw",
url: "about:blank"
})
// Or navigate to a specific URL
browser({
action: "open",
profile: "openclaw",
url: "https://chat.deepseek.com/"
})
javascript
browser({
action: "stop",
profile: "openclaw"
})
javascript
// Stop first
browser({ action: "stop", profile: "openclaw" })
// Then start
browser({ action: "open", profile: "openclaw", url: "about:blank" })
Configure mcporter to use chrome-devtools-mcp:
bash
# Add MCP server to mcporter
mcporter server add chrome-devtools \
--command "npx" \
--args "chrome-devtools-mcp@latest,--browserUrl,http://127.0.0.1:18800,--no-usage-statistics"
# Or with auto-connect (Chrome will be started if not running)
mcporter server add chrome-devtools \
--command "npx" \
--args "chrome-devtools-mcp@latest,--autoConnect,--no-usage-statistics"
Add to claude_desktop_config.json:
json
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": [
"chrome-devtools-mcp@latest",
"--browserUrl", "http://127.0.0.1:18800",
"--no-usage-statistics"
]
}
}
}
powershell
# Disable usage statistics
$env:CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS = "1"
# Enable debug logging
$env:DEBUG = "*"
Verify built-in Chrome is ready: javascript
const status = await browser({ action: "status", profile: "openclaw" })
if (!status.cdpReady) {
await browser({ action: "open", profile: "openclaw", url: "about:blank" })
}
Test CDP connection: powershell
Invoke-WebRequest -Uri "http://localhost:18800/json/version"
Configure MCP client (mcporter, Claude Desktop, etc.)
Test MCP connection: bash
mcporter call chrome-devtools.list_pages
Ensure Chrome is running (before MCP operations): javascript
const status = await browser({ action: "status", profile: "openclaw" })
if (!status.cdpReady) {
await browser({ action: "open", profile: "openclaw", url: "about:blank" })
await new Promise(r => setTimeout(r, 2000)) // Wait for startup
}
Use MCP tools via mcporter or other MCP client
Keep Chrome running for subsequent operations
Once connected via chrome-devtools-mcp, these tools are available:
list_pages - List all open tabs/pagesnew_page - Create new tabselect_page - Switch to specific tabclose_page - Close a tabnavigate_page - Navigate to URL / back / forward / refreshclick - Click element by uidfill - Fill input fieldtype_text - Type textpress_key - Press keyboard keyselect_option - Select dropdown optiontake_snapshot - Get accessibility tree snapshottake_screenshot - Capture screenshotevaluate_script - Execute JavaScriptwait_for - Wait for text/elementget_browser_state - Get cookies, localStorage, etc.set_browser_state - Set cookies, localStorage, etc.This skill uses chrome-devtools-mcp via mcporter:
bash
# 1. Ensure Chrome is running (via browser tool)
# 2. Use mcporter to call MCP tools
mcporter call chrome-devtools.navigate_page type: "url" url: "https://chat.deepseek.com/"
mcporter call chrome-devtools.take_snapshot
mcporter call chrome-devtools.type_text text: "查询内容"
mcporter call chrome-devtools.press_key key: "Enter"
mcporter call chrome-devtools.evaluate_script function: '() => document.body.innerText'
Symptoms: browser({ action: "status" }) shows cdpReady: false
Solutions:
Restart Chrome: javascript
browser({ action: "stop", profile: "openclaw" })
browser({ action: "open", profile: "openclaw", url: "about:blank" })
Check for port conflicts: powershell
Get-NetTCPConnection -LocalPort 18800
Symptoms: MCP server fails to connect
Solutions:
Verify CDP endpoint is accessible: powershell
curl http://localhost:18800/json/version
Check Windows Firewall isn't blocking localhost
Ensure Chrome was started with remote debugging enabled (built-in profile does this automatically)
This is normal behavior! The MCP server:
Check what's using the port:
powershell
Get-NetTCPConnection -LocalPort 18800 |
Select-Object LocalPort, State, OwningProcess, @{Name="ProcessName";Expression={(Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue).Name}}
Kill conflicting process:
powershell
Get-Process -Id (Get-NetTCPConnection -LocalPort 18800).OwningProcess | Stop-Process -Force
about:blank for quick startup when you don't need a specific pageTaskCommandCheck Chrome statusbrowser({ action: "status", profile: "openclaw" })Start Chromebrowser({ action: "open", profile: "openclaw", url: "about:blank" })Stop Chromebrowser({ action: "stop", profile: "openclaw" })Test CDPInvoke-WebRequest http://localhost:18800/json/versionAdd MCP to mcportermcporter server add chrome-devtools --command "npx" --args "..."List MCP pagesmcporter call chrome-devtools.list_pages