Opencode and chromium via MCP

Posted

Prerequisites

Install chromium-browser via apt.
Install npm if not already on your system.

Start Script

Create a script for starting it:

#!/bin/bash
# Start Chromium Browser MCP
# Kill existing Chrome processes using the same profile
pkill -f "chromium.*user-data-dir=/tmp/chrome-profile" 2>/dev/null || true
# Launch Chromium with remote debugging enabled
chromium-browser \
  --remote-debugging-port=9222 \
  --user-data-dir=/tmp/chrome-profile \
  --disable-gpu \
  --no-sandbox \
  --disable-dev-shm-usage \
  --headless=new

Start via service

This can also be started via systemd:

[Unit]
Description=Chromium Browser for bb-browser MCP
After=network.target
[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/home/adrian/mcp-services/start-chrome-mcp.sh
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target

Put it into:

/home/<your username>/.config/systemd/user/chrome-mcp.service

Then reload the daemon and start the server:

systemctl --user daemon-reload
systemctl --user start chrome-mcp

Opencode config

{ 
 "$schema": "https://opencode.ai/config.json",
... some other settings ...
 "mcp": {
    "chrome": {
      "type": "local",
      "command": [
        "npx",
        "-y",
        "chrome-devtools-mcp@latest",
        "--browser-url=http://127.0.0.1:9222",
        "--slim"
      ],
      "enabled": true,
      "timeout": 30000
    }
  }
}

Check that it works

opencode mcp list

Expected:

adrian@bigdelli:~/services$ opencode mcp list
┌  MCP Servers
│
●  ✓ chrome connected
│      npx -y chrome-devtools-mcp@latest --browser-url=http://127.0.0.1:9222 --slim
│
└  1 server(s)

Author
Categories AI, Programming