chrome-mcp

chrome-mcp

Local MCP server for persistent Chrome automation with multi-profile support, enabling tab management, page inspection, element interaction, JavaScript evaluation, and screenshots while preserving login sessions across restarts.

Category
Visit Server

README

Chrome MCP

简体中文

Chrome MCP is a local Model Context Protocol server for persistent, multi-profile Chrome automation. It lets an MCP client launch or reconnect to Chrome, keep login sessions across client restarts, manage tabs, inspect pages, interact with elements, evaluate JavaScript, and capture screenshots.

Chrome is started only when a browser lifecycle tool is called. Multiple MCP clients can connect to the same running Chrome process without creating duplicate browsers.

Chrome MCP controlling Google through a persistent browser profile

Platform requirements

  • Debian or Ubuntu on amd64
  • systemd
  • A non-root login with sudo access

The installer adds Google Chrome, Node.js 22 when the installed Node.js is too old, Xvfb, fonts, and the exact npm dependencies from package-lock.json.

Install the runtime

git clone https://github.com/wzxklm/chrome-mcp.git
cd chrome-mcp
./setup-chrome-mcp.sh

Run the installer as the same non-root user that runs Codex or Claude Code. The script invokes sudo only for system packages and services. Chrome keeps its sandbox enabled by default and refuses to launch as root.

The installer deliberately does not edit any MCP client configuration.

Add to Codex

From the cloned repository, run:

CHROME_MCP_DIR="$(pwd)"
codex mcp add chrome \
  --env CHROME_PATH=/usr/bin/google-chrome-stable \
  --env CHROME_DEFAULT_PROFILE_DIR="$HOME/.chrome-profile" \
  --env CHROME_PROFILES_DIR="$HOME/.chrome-profiles" \
  --env DISPLAY=:99 \
  -- node "$CHROME_MCP_DIR/src/server.js"

Verify the registration:

codex mcp list

Restart Codex after adding the server. In the Codex terminal UI, /mcp shows its connection and tools. Codex stores this user configuration in ~/.codex/config.toml. See the official Codex MCP documentation.

Add to Claude Code

From the cloned repository, run:

CHROME_MCP_DIR="$(pwd)"
claude mcp add \
  --env CHROME_PATH=/usr/bin/google-chrome-stable \
  --env CHROME_DEFAULT_PROFILE_DIR="$HOME/.chrome-profile" \
  --env CHROME_PROFILES_DIR="$HOME/.chrome-profiles" \
  --env DISPLAY=:99 \
  --transport stdio \
  --scope user \
  chrome -- node "$CHROME_MCP_DIR/src/server.js"

Verify the registration:

claude mcp list
claude mcp get chrome

Use /mcp inside Claude Code to inspect the server. Replace --scope user with --scope local to keep the registration local to the current project. See the official Claude Code MCP documentation.

Ask the AI to use Chrome

After the server appears as connected in /mcp, describe the browser task to Codex or Claude Code in natural language. Mention chrome MCP when you specifically want this server rather than another browser integration. The AI receives Chrome MCP's built-in lifecycle instructions and decides whether to create, reconnect to, or reuse a browser profile before operating the page.

Examples:

Use chrome MCP with the default browser profile. Open example.com, inspect the
page, and summarize the main content. Keep the browser running afterward.
Use chrome MCP with a separate profile named research. Search for the official
documentation for this API and compare the current options in a table.
Reconnect to the default chrome MCP profile and continue working in the tabs
that are already open. Do not close the browser when finished.

Browser profiles persist cookies and login sessions. For a site that needs authentication, ask the AI to open the login page in a named profile, complete any interactive login through the optional noVNC view, then ask the AI to continue. Say explicitly when the AI should close Chrome; leaving it unspecified allows the existing browser session to remain available for later tasks.

Deleting a browser profile permanently removes its browser data. Request profile deletion only when that is your explicit intent.

Configuration

Variable Purpose Default
CHROME_PATH Chrome executable /usr/bin/google-chrome-stable
CHROME_DEFAULT_PROFILE_DIR Directory for the profile named default $HOME/.chrome-profile
CHROME_PROFILES_DIR Parent directory for named profiles $HOME/.chrome-profiles
DISPLAY X display used by Chrome :99
CHROME_DISABLE_SANDBOX Explicitly disable Chrome's sandbox false

Profile paths must be absolute, must not overlap each other or this repository, and must not point to broad directories such as / or the user's home directory.

CHROME_DISABLE_SANDBOX=true is an escape hatch for a deliberately isolated container or an existing root-only deployment. It weakens Chrome's security boundary and should not be used on a general-purpose host.

Optional noVNC access

To view display :99 in a browser:

VNC_PASSWORD='choose-a-strong-password' ./setup-novnc.sh

x11vnc listens on 127.0.0.1:5900 and noVNC on 127.0.0.1:6080. Keep both private. If remote access is required, put noVNC behind an authenticated HTTPS reverse proxy.

Development and verification

npm ci
npm run check

npm run check validates JavaScript and shell syntax, runs the MCP contract and safety tests, and runs the full Chrome integration test when Chrome and display :99 are available.

Repository layout:

src/server.js          MCP server, browser lifecycle, and page tools
test/mcp.test.js       Contract, safety, concurrency, and browser tests
systemd/               Xvfb and optional noVNC services
setup-chrome-mcp.sh    Reproducible runtime installer
setup-novnc.sh         Optional local VNC installer

Security

Browser profiles contain cookies, authenticated sessions, history, and other private data. Keep them outside this repository and never commit them. Review MCP tool calls before using Chrome MCP against sensitive accounts; page content can contain prompt injection.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured