r/ClaudeCode • u/Dorbank_Justt • 22m ago
Help/Question Playwright MCP across several Claude Code sessions: how do you share logins without "Browser is already in use"?
I use Claude Code every day for work that isn't coding, and a lot of it runs through the Playwright MCP driving a logged-in browser. The first time I had two sessions open at once, the second one failed with "Browser is already in use". The fix that day was finding the session that still held the profile and closing it.
The README explains why. A persistent profile can only be used by one browser instance at a time, so two MCP clients in the same workspace will conflict, and the suggested way to run several in parallel is to start the extra ones with --isolated or point each one at its own --user-data-dir.
What I ended up with is one MCP server per set of logins, each with its own user data dir, plus one isolated server for pages that need no login, which any number of sessions can use. It works, but every new login means another server entry and another profile to sign into by hand, and nothing stops two sessions from reaching for the same profile at the same moment.
There is also --storage-state, which loads cookies and local storage from a file into an isolated context. In theory that lets parallel sessions share one login without fighting over a profile, but then someone has to keep that file fresh.
For people running several Claude Code sessions against logged-in sites: do you keep a profile per login, export storage state, use the browser extension mode, or something else? And how do you stop two sessions grabbing the same profile at once?
•
u/AutoModerator 22m ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/YouthRealistic7125 Vibe Coder 19m ago
something else, I don't use playwright for logged in sites at all. I use the Claude in Chrome extension, it works in my normal chrome where I'm already logged in, and each session gets its own tab group. so no profile per login and no state file to keep fresh. playwright is only for pages without login
for two sessions at once, they don't fight over the profile anymore but they can still edit the same thing in the same account, and nothing locks that. what I do is one session owns one thing. I had two on the same ad account last week and one messaged the other "don't touch this campaign, I'm changing it". it's a convention, not a lock
1
u/Starks1293 12m ago
one more option u didnt list, start one chrome urself with
--remote-debugging-port=9222and point every playwright mcp entry at it with--cdp-endpoint http://localhost:9222. they all attach to the same running browser so they share the logins, and theres no profile lock to fight over because none of them launches its owntwo catches. newer chrome ignores the debugging port on ur default profile, so give that chrome its own
--user-data-dirand sign into things there once. and the sessions share one browser, so tell each one to open its own tab and stay in it, otherwise two of them will happily drive the same pagefor the same-account thing the other comment mentioned theres no lock anywhere really, one session per account at a time is basically the only rule that works