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

If the mcp launches an instance it should expose some way to close the browser

Open connorosborn-sf opened this issue 2 months ago • 5 comments

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

Right now there is no way to close the browser (via mcp) that is launched via mcp. Close page will refuse to close the only page.

Describe the solution you'd like

Expose to the mcp a way to close the browsers it launched

Describe alternatives you've considered

Using os utils to close manually

Additional context

No response

connorosborn-sf avatar Oct 27 '25 18:10 connorosborn-sf

Currently the MCP client can close the browser by stopping the MCP server or you can close the browser manually. Does it work for you? Could you provide more details about the use case you have that requires closing the browser via the MCP tools?

OrKoN avatar Oct 28 '25 09:10 OrKoN

We're using claude-agent-sdk-python and I guess they don't clean up the mcp servers that they start on exit. I think I can create an issue there.

connorosborn-sf avatar Oct 28 '25 16:10 connorosborn-sf

@OrKoN Can you elaborate on the reason please why we precent closing the last tab?

natorion avatar Oct 30 '25 14:10 natorion

A few thoughts:

  • The server does not know when the client is finished
  • The client can only guess that its actually finished (e.g. a user can jump between simultanous chat sessions)
  • The client knows when the working session is done: When the client is closed or the server is shut down. At this point the server could get notified of impending shutdown and closes a debugged Chrome instances including its tabs IF its not pointing to default, ephemeral Chrome profile - I doubt users would appreciate us closing Chrome for their default profile when the server shuts down.

natorion avatar Nov 17 '25 16:11 natorion

We're using claude-agent-sdk-python and I guess they don't clean up the mcp servers that they start on exit. I think I can create an issue there.

I think that's the best way forward for now. I also raised this issue for Gemini CLI in https://github.com/google-gemini/gemini-cli/issues/13391

natorion avatar Nov 19 '25 09:11 natorion