Install Guide
Overview
The Playwright app drives a web browser through query commands, so an agent or an operator can read a site that offers no API and act on it. The browser does not run on the Sonar host. It runs on a separate Playwright MCP server, and this app speaks to that server over MCP (JSON-RPC over HTTP).
Sonar (playwright app)
| MCP over HTTP <- the app speaks only this protocol
v
Playwright MCP server (separate host or container)
|__ Chromium + system libraries
| HTTPS
v
target web site
Installing the app therefore has two parts: standing up the MCP server, and telling Sonar where it is. Neither Node.js nor Chromium is installed on the Sonar host.
Follow the steps in order.
- Install the File Store app, if it is not installed already.
- Stand up a Playwright MCP server - Linux or Windows, below.
- Register the server in Sonar, as a connect profile or a system property.
- Register a credential profile for each site that requires a sign-in. Sites that need no account require nothing here.
Scope
optional - every action stores a screenshot, and the app does not start without it.
The query commands and the REST API both require an administrator (cluster or company),
and a connect profile grant narrows the targets further.
Requirements
| Item | Requirement | Note |
|---|---|---|
| Sonar version | 5.0.2603.0 or later | |
| Prerequisite app | File Store | Screenshot storage; the app does not start without it |
| MCP server host | Linux (Docker recommended) or Windows | Chromium runs here |
| Network allowance | TCP/8931 (Sonar -> MCP server, outbound) | Firewall policy must be updated |
| Network allowance | HTTPS (MCP server -> target site, outbound) | The server reaches the site, the Sonar host does not |
| Permission | Administrator (cluster or company) | Required for the query commands and the REST API alike |
Installing the MCP server on Linux
Docker is recommended: the image already carries Chromium and the shared libraries it needs, which is the part that otherwise requires root-level package installation.
docker run -d --name playwright-mcp --restart unless-stopped \
-p 8931:8931 \
mcr.microsoft.com/playwright/mcp \
--port 8931 --host 0.0.0.0 --allowed-hosts sonar-host \
--headless --isolated \
--ignore-https-errors --output-dir /tmp/playwright-mcp
Replace sonar-host with the hostname or address the Sonar host will use to reach this server. See Host header verification below - this is the option most installations get wrong.
Without Docker, install Node.js LTS and run the server directly. Chromium's shared library dependencies must be satisfied on the host, which on a minimal image means installing them first.
npx --yes @playwright/mcp@latest install chromium
npx --yes @playwright/mcp@latest --port 8931 --host 0.0.0.0 \
--allowed-hosts sonar-host --headless --isolated \
--ignore-https-errors --output-dir /var/lib/playwright-mcp
For continuous operation, register it as a systemd unit rather than leaving it in a shell.
Installing the MCP server on Windows
There is no Docker step here. Windows Chromium carries the libraries it needs, so no administrator-level package installation is involved.
# 1) With Node.js LTS installed, fetch the browser
npx --yes @playwright/mcp@latest install chromium
# 2) Run the server
npx --yes @playwright/mcp@latest --port 8931 --host 0.0.0.0 --allowed-hosts sonar-host --headless --isolated --ignore-https-errors --output-dir C:\playwright-mcp
For continuous operation, register it as a Windows service - for example with NSSM:
nssm install playwright-mcp "C:\Program Files\nodejs\npx.cmd" "--yes @playwright/mcp@latest --port 8931 --host 0.0.0.0 --allowed-hosts sonar-host --headless --isolated --ignore-https-errors --output-dir C:\playwright-mcp"
nssm start playwright-mcp
Server options
| Option | Why it is needed |
|---|---|
| --headless | Runs on a host with no display. |
| --isolated | Starts each session from an empty profile. Without it, login cookies persist on the server's disk, and that file becomes the equivalent of a stored credential. |
| --ignore-https-errors | Effectively required for sites with a self-signed certificate. Without it such a console fails to load at all with ERR_CERT_AUTHORITY_INVALID. |
| --output-dir | Where the server drops its own screenshot files. The app stores the image returned in the response into the file store, so this directory is scratch space and can be emptied. |
| --host / --allowed-hosts | --host is the bind address, --allowed-hosts is the Host header allow-list. Remote access needs both - see below. |
Host header verification
The server checks the Host header, and by default only accepts the hostname it was bound to. --host 0.0.0.0 alone is not enough: a server started that way answers Access is denied (HTTP 403) when reached by IP address, while localhost passes. List the hosts that will connect:
Setting --allowed-hosts to a single asterisk disables the check, but it exists to defend against DNS rebinding, so naming the hosts is preferable.
Security
onto every network that server can reach.
- Restrict port 8931 to the Sonar host with a firewall. A dedicated network segment is
recommended.
- Never expose it to a public network. An exposed server hands its network reachability
to anonymous callers.
- Where networks are segmented, run one server per segment and register one connect
profile per server.
Registering the server in Sonar
There are two ways, and with either one a command does not have to name the server.
Connect profile
Go to System > Connect Profiles, click Add, and select the Playwright MCP Server type.
| Type | Item | Setting |
|---|---|---|
| Required | MCP URL | Server endpoint. Defaults to http://localhost:8931/mcp |
| Optional | HTTP proxy | host:port |
| Optional | Connect timeout / Read timeout | In seconds. 30 / 60 if not specified |
| Optional | Settle timeout | How long a site may take to draw a screen. 10 seconds if not specified |
| Optional | Viewport | Browser window size. 1600x900 if not specified |
When exactly one server is registered, commands use it without naming it. Name one with the mcp option only when several are registered.
Test Connect checks that the server answers and that it really is a Playwright MCP server. It opens no site.
into a hamburger button below its breakpoint, and a collapsed menu is hidden by CSS
rather than merely small - it is absent from the accessibility snapshot altogether, so
the browser reads a page that appears to have no menu. Breakpoints of 1300px and above
are common, which is why the default is 1600x900.
System property
A server address can be set without creating a profile at all.
The PLAYWRIGHT_SERVER_URL environment variable does the same. A registered profile takes precedence. With none of the three set, commands refuse and say so.
Registering a credential profile
Only for sites that require a sign-in. Go to System > Connect Profiles, click Add, and select the Playwright Credential type.
| Type | Item | Setting |
|---|---|---|
| Required | Login name | Account to sign in with |
| Optional | Password | Password for the account |
| Optional | OTP mode | manual (default) has a person supply a code per run; totp generates it from a seed |
| Optional | TOTP seed | Base32 seed, used when OTP mode is totp |
| Optional | Read only | true refuses input and form submission on every session using this account |
The password and the TOTP seed are encrypted by the platform. This profile holds neither a site address nor a server address - a command names the site with url and the server with mcp, which is what lets one account be used on every address it applies to.
same care as a password.
Verifying the installation
Open a site that needs no account and read the screen. If a snapshot comes back, the server and the network path are working; take a screenshot as well to confirm the file store is.
playwright-open url="https://www.example.com/"
playwright-observe session-id="SESSION_ID"
playwright-screenshot session-id="SESSION_ID"
playwright-close session-id="SESSION_ID"
playwright-open returns the session_id the other commands take.
A session holds a browser on the shared server until it is closed or reaped for being idle, so close it when done.
Version pinning
Tool names and schemas can change between server versions. In production, pin @playwright/mcp@VERSION or a tagged Docker image, and after an upgrade use the MCP profile's connect test to confirm the browser_* tools are still present.
Air-gapped installation
# On a connected host
docker pull mcr.microsoft.com/playwright/mcp
docker save mcr.microsoft.com/playwright/mcp -o playwright-mcp.tar
# On the air-gapped host
docker load -i playwright-mcp.tar
Without Docker, carry in Node.js, the @playwright/mcp npm package, and the output of playwright install chromium (~/.cache/ms-playwright on Linux, %USERPROFILE%\AppData\Local\ms-playwright on Windows).