chrome-devtools-mcp icon indicating copy to clipboard operation
chrome-devtools-mcp copied to clipboard

[enh request] Support for UserAgent string while opening the browser

Open shrn01 opened this issue 2 months ago • 4 comments

Is your feature request related to a problem? Please describe.

Currently there is no way to open chrome devtools mcp with a mobile UI. Though we have an option to resize to a mobile layout, a lot of websites use useragent string to instead load the relevant site (Desktop/Mobile).

Describe the solution you'd like

Since Puppeteer already supports this, could we extend this to the mcp config as well? This could be a simple option in the mcp config file

{
  "mcpServers": {
    "chrome-devtools": {
      "command": "npx",
      "args": [
        "chrome-devtools-mcp@latest",
        "--headless=true",
        "--viewport=1440x900",
        "--user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1"// <-- Set the user agent to load the page with
      ]
    }
  }
}

Describe alternatives you've considered

Currently there is no way to trigger this flow. Currently once the chrome window loads up, I load up responsive mode before the mcp starts testing, but this needs to be done everytime the page is closed and re-loaded.

Additional context

No response

shrn01 avatar Oct 16 '25 05:10 shrn01

One more addition to the same enhancement would be device presets.

	"--device=iPhone 14 Pro",

shrn01 avatar Oct 16 '25 05:10 shrn01

@shrn01 could you please provide more details about your use case? would not it be easier to use if you could set these emulations at runtime via a tool call?

OrKoN avatar Oct 16 '25 07:10 OrKoN

@OrKoN For me it's tool call. As natorion mentions in #410:

Responsive design and layout issues (e.g., "This button is off-screen on mobile").

Great for helping with mobile specific issues like touch events.

Aidurber avatar Oct 23 '25 10:10 Aidurber

Hi @OrKoN, thank you for your response.

If there is a tool to set the user agent, I could use that directly, but the mcp currently doesn't support a tool for this purpose. We only have a tool to set the dimensions currently. Same with the device name as well. Please let me know if I'm missing something.

shrn01 avatar Oct 24 '25 06:10 shrn01