👾

chrome-devtools-mcp の勘所

に公開

サーバー(ブラウザ)起動について

  • スラッシュコマンドでMCP使用を強制する
  • 起動枠と同じセッションでコマンドを打ち、サーバーが落ちる問題
    • あらかじめ別セッション or バックグラウンドで、サーバーを立ち上げておく( pnpm dev &などアンパサンドをつける)
    • 別セッションを立ち上げるように指示する うまくいかない
  • 起動完了前に、評価されてしまう問題
    • timeoutを設定する (プロンプトに入れるか、settngs.jsonをいじる)
  • 起動が行われない問題
    • 手動でアシストするしかない ( pnpm dev &など。)
    • その後、Allowボタンを押す。

公式の例を改変したプロンプト:

/list_console_messages to checking the page on localhost:8080
looks strange and off. Check what's happening there. 
(timeout: 20000 ms)

server has already started in a different session, 
you should just perform the check and fix it if invalid.

参考:

追記: WSLについて

  • WSL2において、Windows側のブラウザを開きたい
    • mcp.jsonへ--headless false --isolated trueを追加
      "chrome-devtools": {
        "command": "cmd.exe",
        "args": [
          "/c",
          "npx",
          "-y",
          "chrome-devtools-mcp@latest",
          "--headless",
          "false",
          "--isolated",
          "true"
        ]
      }
    

参考:

雑感

/list_console_messages/take_screenshots は最もよく使いそう。

とりいそぎ。

Discussion