Skip to content

Stateful servers like chrome-devtools don't work with mcp-cli #21

@filipeestacio

Description

@filipeestacio

Stateful servers like chrome-devtools don't work with mcp-cli

The Problem

I'm trying to use chrome-devtools-mcp to automate some browser testing, but each mcp-cli call command spawns a fresh server process. This means the browser state gets lost between commands - I can't navigate to a page, then fill out a form, then click a button. Each command starts from scratch.

What I'm trying to do

# Step 1: Open browser to staging site
mcp-cli call chrome-devtools new_page '{"url": "https://admin.staging.mysite.com"}'
# ✓ Works - browser opens

# Step 2: Fill in login email
mcp-cli call chrome-devtools fill '{"uid": "1_5", "value": "user@example.com"}'
# ✗ Fails - new browser instance, previous page is gone

The second command spawns a new server, which tries to launch a new browser, but the profile is locked from the first command. Even if I use --isolated, I lose all the state from step 1.

This is the error I get:

The browser is already running for /home/filipe/.cache/chrome-devtools-mcp/chrome-profile.
Use --isolated to run multiple browser instances.

Why this happens

mcp-cli treats every command as independent - it starts the server, runs the command, stops the server. This works great for filesystem operations or one-off API calls, but browser automation needs the server (and browser) to stay alive across multiple commands.

What would help

Add session management so I can keep a server running across multiple commands:

# Start a persistent session
mcp-cli session start chrome-devtools --name browser

# Now these all use the same browser instance
mcp-cli session call browser new_page '{"url": "https://admin.staging.mysite.com"}'
mcp-cli session call browser fill '{"uid": "1_5", "value": "user@example.com"}'
mcp-cli session call browser fill '{"uid": "1_8", "value": "password123"}'
mcp-cli session call browser click '{"uid": "1_12"}'
mcp-cli session call browser take_screenshot '{"filePath": "/tmp/logged-in.png"}'

# Stop when done
mcp-cli session stop browser

This would:

  • Keep the server process running between commands
  • Maintain browser state across operations
  • Allow multiple named sessions for different servers
  • Stay backwards compatible with existing one-off commands

Use case

I'm trying to investigate our admin portal on staging by navigating through the UI, filling forms, taking screenshots, and checking console errors. This requires 15-20 sequential commands all operating on the same browser session, which isn't possible with the current architecture.

Other servers affected

This would also help with:

  • mcp-server-playwright (same browser automation issue)
  • Database servers that maintain connections
  • Any server with transaction or session semantics

Stateless servers like fast-filesystem and API query servers work fine as-is.

Environment

  • mcp-cli: 0.3.0
  • Server: chrome-devtools-mcp@latest
  • Platform: Linux
  • Config: Standard mcp_servers.json with npx launcher

Related

Happy to test a PR if you decide to implement this, or do some follow up work myself and see if there is something that I can contribute.

Would also be fine with just clear documentation if session management is out of scope and I should use a different approach for this use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions