How to open two isolated browser sessions in chrome-devtools-mcp?
The chrome-devtools-mcp server (v0.17.1) drives a single Chrome instance for its lifetime, so an MCP client like Claude Code cannot keep two authenticated users open at once — e.g. to verify a real-time WebSocket chat feature. The feature request "Multi-session support for parallel browser instances" is closed as completed. How do I use the new multi-session API?
Originally asked on GitHub: https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/926
6 answers
Status: fixed. The feature request is closed as completed. The implementation landed as an optional
browserContextparameter on thenew_pagetool (PR #991, based on v0.17.1); the thread does not state which release contains it.The originally proposed
create_session/list_sessions/close_sessiontools were dropped after maintainer feedback. Instead,new_pageaccepts an optionalbrowserContextname:new_page url="https://app.com/chat" browserContext="userA" new_page url="https://app.com/chat" browserContext="userB"Each new name creates an isolated browser context (incognito-like) inside the same Chrome process: separate cookies, localStorage, IndexedDB, and WebSocket connections. Contexts discovered at runtime get auto-named (
browser-context-1,browser-context-2), the page list shows the context per page (browserContext=admin), closing the last page in a context cleans it up, and omittingbrowserContextkeeps today's single-browser behavior — fully backward compatible.For real-time WebSocket testing, the flow from the thread is:
new_pagewithbrowserContext="userA", then again withbrowserContext="userB"select_page pageId=1→ send a message as user Aselect_page pageId=2→ verify the message arrives for user B
Why not MCP protocol sessions? The contributor investigated
Mcp-Session-Id(Streamable HTTP) and found no MCP client supports multiple concurrent sessions to the same server — they keep one connection per server name, and an LLM has no way to route a tool call to a specific session — so the tool-parameter approach was chosen.Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
The reporter proposed three session tools (create_session, list_sessions, close_session) plus an optional sessionId on every existing tool, backed by PR #899. Maintainers did not accept that API shape; one asked for more conviction and another later said the session tools are unnecessary.
Source: https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/926 (opens external site)
Did this work for you?What @RobertWsp tried on GitHub (Worked)
After checking Mcp-Session-Id and finding no client supports concurrent sessions to one server, the reporter refactored to browser.createBrowserContext(), E2E-tested two isolated DuckDuckGo searches, confirmed all 333 existing tests pass with zero type errors, and opened PR #991.
Did this work for you?What @OrKoN tried on GitHub (Partly worked)
A maintainer suggested using MCP protocol-level sessions (Mcp-Session-Id) or, alternatively, browser contexts inside one Chrome instance. The browser-context approach was adopted; the protocol-session approach was rejected because clients cannot route tool calls to multiple sessions.
Did this work for you?What @OrKoN tried on GitHub (Worked)
A maintainer proposed dropping the session tools entirely and instead letting new_page accept an optional browserContext: string parameter, auto-naming unknown contexts, and including browserContext in page-list snapshots. The reporter implemented exactly this design.
Did this work for you?What @RobertWsp tried on GitHub (Worked)
The reporter reworked PR #991 to the browserContext-parameter design (no session tools) and demonstrated the two-user WebSocket chat verification flow using select_page to switch between the two contexts.
Did this work for you?
Related questions
- Why does chrome-devtools-mcp snapshot miss table/ARIA semantics?
- Why is --load-extension ignored by chrome-devtools-mcp?
- How do I use chrome-devtools-mcp from WSL when Chrome is installed on Windows?
- chrome-devtools-mcp --autoConnect times out on every tool call with Chrome 144
- How to select which Chrome profile chrome-devtools-mcp automates when several are open?