This server provides Playwright functionality through a Model Context Protocol (MCP) interface, allowing MCP clients to leverage Playwright's browser automation capabilities. The server uses Server-Sent Events (SSE) for communication with clients.
If the mcp-network doesn't exist, create it with:
docker network create mcp-network
Clone or download the repository and run the server from the project's root directory:
docker compose up --build
This starts the server on the default port 3002. You'll see a confirmation message:
playwright-sse-mcp-server | Server is running on port 3002
To run the server on a different port, set the PORT environment variable:
PORT=4000 docker compose up --build
From other containers on the same mcp-network, connect using:
playwright-sse-mcp-server:${PORT}/sse
With the default port:
playwright-sse-mcp-server:3002/sse
From your host machine, connect using:
localhost:${PORT}/sse
With the default port:
localhost:3002/sse
In Roo Code, go to MCP Servers -> Edit MCP configuration and enter:
{
"mcpServers": {
"playwright-sse-mcp-server-local": {
"url": "http://localhost:${PORT}/sse"
}
}
}
With the default port:
{
"mcpServers": {
"playwright-sse-mcp-server-local": {
"url": "http://localhost:3002/sse"
}
}
}
Note: As of March 27, 2025, Cline does not support SSE.
From a Roo Code container on the same Docker network:
{
"mcpServers": {
"playwright-sse-mcp-server-local": {
"url": "http://playwright-sse-mcp-server:3002/sse"
}
}
}
docker-compose.yml example:
services:
# Roo Code container
roo-code:
# ...
networks:
mcp-network:
external: true
When running Roo Code in a development container without joining mcp-network:
For Docker Desktop (Mac/Windows):
{
"mcpServers": {
"playwright-sse-mcp-server-local": {
"url": "http://host.docker.internal:<PORT>/sse"
}
}
}
For Linux (using bridge gateway IP):
{
"mcpServers": {
"playwright-sse-mcp-server-local": {
"url": "http://172.17.0.1:<PORT>/sse"
}
}
}
When connecting from a development container not on the mcp-network:
Connection URL:
http://<host_ip_or_dns_name>:<PORT>/sse
Host IP or DNS name determination:
host.docker.internal
http://host.docker.internal:3002/sse
ifconfig
or ip addr
)
http://192.168.1.10:3002/sse
172.17.0.1
)
http://172.17.0.1:3002/sse
This project includes shell scripts to easily manage the server from anywhere.
git clone https://github.com/torohash/playwright-sse-mcp-server.git /path/to/installation
.bashrc
or .zshrc
:# Playwright MCP Server
export PLAYWRIGHT_MCP_HOME="/path/to/installation"
source "$PLAYWRIGHT_MCP_HOME/scripts/playwright-mcp.sh"
source ~/.bashrc
playwright-mcp-start
- Start the server (default port 3002)playwright-mcp-stop
- Stop the serverplaywright-mcp-logs
- View server logsplaywright-mcp-start -p
# or
playwright-mcp-start --persistent
playwright-mcp-start -P 4000
# or
playwright-mcp-start --port 4000
playwright-mcp-start -P 4000 -p
# or
playwright-mcp-start --port 4000 --persistent
playwright-mcp-start -r always
# or
playwright-mcp-start --restart always
playwright-mcp-start -h
# or
playwright-mcp-start --help
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "playwright-sse-mcp-server-local" '{"url":"http://localhost:3002/sse"}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"playwright-sse-mcp-server-local": {
"url": "http://localhost:3002/sse"
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"playwright-sse-mcp-server-local": {
"url": "http://localhost:3002/sse"
}
}
}
3. Restart Claude Desktop for the changes to take effect